diff options
Diffstat (limited to 'dhcpctl')
-rw-r--r-- | dhcpctl/remote.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/dhcpctl/remote.c b/dhcpctl/remote.c index 6d14807a..a7c32521 100644 --- a/dhcpctl/remote.c +++ b/dhcpctl/remote.c @@ -74,12 +74,26 @@ dhcpctl_status dhcpctl_new_authenticator (dhcpctl_handle *h, } strcpy (key -> name, name); - key -> algorithm = dmalloc (strlen (algorithm) + 1, MDL); - if (!key -> algorithm) { - omapi_auth_key_dereference (&key, MDL); - return ISC_R_NOMEMORY; + /* If the algorithm name isn't an FQDN, tack on the + .SIG-ALG.REG.NET. domain. */ + if (strchr (algorithm, '.') == 0) { + 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); if (status != ISC_R_SUCCESS) { |