mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-29 13:28:14 +00:00
Properly add ".SIG-ALG.REG.INT." to OMAPI key algorithms.
This commit is contained in:
parent
a323900510
commit
8c3c655296
@ -74,12 +74,26 @@ dhcpctl_status dhcpctl_new_authenticator (dhcpctl_handle *h,
|
|||||||
}
|
}
|
||||||
strcpy (key -> name, name);
|
strcpy (key -> name, name);
|
||||||
|
|
||||||
key -> algorithm = dmalloc (strlen (algorithm) + 1, MDL);
|
/* If the algorithm name isn't an FQDN, tack on the
|
||||||
if (!key -> algorithm) {
|
.SIG-ALG.REG.NET. domain. */
|
||||||
omapi_auth_key_dereference (&key, MDL);
|
if (strchr (algorithm, '.') == 0) {
|
||||||
return ISC_R_NOMEMORY;
|
static char add[] = ".SIG-ALG.REG.INT.";
|
||||||
|
key -> algorithm = dmalloc (strlen (algorithm) +
|
||||||
|
sizeof (add), MDL);
|
||||||
|
if (!key -> algorithm) {
|
||||||
|
omapi_auth_key_dereference (&key, MDL);
|
||||||
|
return ISC_R_NOMEMORY;
|
||||||
|
}
|
||||||
|
strcpy (key -> algorithm, algorithm);
|
||||||
|
strcat (key -> algorithm, add);
|
||||||
|
} else {
|
||||||
|
key -> algorithm = dmalloc (strlen (algorithm) + 1, MDL);
|
||||||
|
if (!key -> algorithm) {
|
||||||
|
omapi_auth_key_dereference (&key, MDL);
|
||||||
|
return ISC_R_NOMEMORY;
|
||||||
|
}
|
||||||
|
strcpy (key -> algorithm, algorithm);
|
||||||
}
|
}
|
||||||
strcpy (key -> algorithm, algorithm);
|
|
||||||
|
|
||||||
status = omapi_data_string_new (&key -> key, secret_len, MDL);
|
status = omapi_data_string_new (&key -> key, secret_len, MDL);
|
||||||
if (status != ISC_R_SUCCESS) {
|
if (status != ISC_R_SUCCESS) {
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <omapip/omapip_p.h>
|
#include <omapip/omapip_p.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <arpa/nameser.h>
|
||||||
|
|
||||||
OMAPI_OBJECT_ALLOC (omapi_connection,
|
OMAPI_OBJECT_ALLOC (omapi_connection,
|
||||||
omapi_connection_object_t, omapi_type_connection)
|
omapi_connection_object_t, omapi_type_connection)
|
||||||
@ -373,6 +374,7 @@ isc_result_t omapi_connection_connect (omapi_object_t *h)
|
|||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
printf("EINPROGRESS\n");
|
||||||
c -> state = omapi_connection_connecting;
|
c -> state = omapi_connection_connecting;
|
||||||
return ISC_R_INCOMPLETE;
|
return ISC_R_INCOMPLETE;
|
||||||
}
|
}
|
||||||
@ -456,7 +458,11 @@ static isc_result_t make_dst_key (DST_KEY **dst_key, omapi_object_t *a) {
|
|||||||
(a, (omapi_object_t *)0, "key", &key);
|
(a, (omapi_object_t *)0, "key", &key);
|
||||||
|
|
||||||
if (status == ISC_R_SUCCESS) {
|
if (status == ISC_R_SUCCESS) {
|
||||||
if (omapi_td_strcmp (algorithm -> value, "hmac-md5") == 0) {
|
if ((algorithm -> value -> type == omapi_datatype_data ||
|
||||||
|
algorithm -> value -> type == omapi_datatype_string) &&
|
||||||
|
strncasecmp (algorithm -> value -> u.buffer.value,
|
||||||
|
NS_TSIG_ALG_HMAC_MD5 ".",
|
||||||
|
algorithm -> value -> u.buffer.len) == 0) {
|
||||||
algorithm_id = KEY_HMAC_MD5;
|
algorithm_id = KEY_HMAC_MD5;
|
||||||
} else {
|
} else {
|
||||||
status = ISC_R_INVALIDARG;
|
status = ISC_R_INVALIDARG;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user