From 3ffc07defb567e7789d5deb30539bddb6c46446c Mon Sep 17 00:00:00 2001 From: Thomas Markwalder Date: Mon, 8 Sep 2014 11:26:57 -0400 Subject: [master] Addes addtional HMAC TSIG algorithms to DDNS Merges in rt36947 --- omapip/isclib.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'omapip') diff --git a/omapip/isclib.c b/omapip/isclib.c index 69edc2ef..3e5e1c2b 100644 --- a/omapip/isclib.c +++ b/omapip/isclib.c @@ -289,12 +289,24 @@ isclib_make_dst_key(char *inname, dns_name_t *name; dns_fixedname_t name0; isc_buffer_t b; + unsigned int algorithm_code; isc_buffer_init(&b, secret, length); isc_buffer_add(&b, length); - /* We only support HMAC_MD5 currently */ - if (strcasecmp(algorithm, DHCP_HMAC_MD5_NAME) != 0) { + if (strcasecmp(algorithm, DHCP_HMAC_MD5_NAME) == 0) { + algorithm_code = DST_ALG_HMACMD5; + } else if (strcasecmp(algorithm, DHCP_HMAC_SHA1_NAME) == 0) { + algorithm_code = DST_ALG_HMACSHA1; + } else if (strcasecmp(algorithm, DHCP_HMAC_SHA224_NAME) == 0) { + algorithm_code = DST_ALG_HMACSHA224; + } else if (strcasecmp(algorithm, DHCP_HMAC_SHA256_NAME) == 0) { + algorithm_code = DST_ALG_HMACSHA256; + } else if (strcasecmp(algorithm, DHCP_HMAC_SHA384_NAME) == 0) { + algorithm_code = DST_ALG_HMACSHA384; + } else if (strcasecmp(algorithm, DHCP_HMAC_SHA512_NAME) == 0) { + algorithm_code = DST_ALG_HMACSHA512; + } else { return(DHCP_R_INVALIDARG); } @@ -303,7 +315,7 @@ isclib_make_dst_key(char *inname, return(result); } - return(dst_key_frombuffer(name, DST_ALG_HMACMD5, DNS_KEYOWNER_ENTITY, + return(dst_key_frombuffer(name, algorithm_code, DNS_KEYOWNER_ENTITY, DNS_KEYPROTO_DNSSEC, dns_rdataclass_in, &b, dhcp_gbl_ctx.mctx, dstkey)); } -- cgit v1.2.1