diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 881565977a..4ff90f5b41 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: os.c,v 1.89.12.7 2011/02/21 23:45:48 tbox Exp $ */ +/* $Id: os.c,v 1.89.12.8 2011/11/30 23:06:40 marka Exp $ */ /*! \file */ @@ -460,14 +460,16 @@ ns_os_daemonize(void) { void ns_os_started(void) { char buf = 0; + int n; /* * Signal to the parent that we started successfully. */ if (dfd[0] != -1 && dfd[1] != -1) { - if (write(dfd[1], &buf, 1) != 1) + if ((n = write(dfd[1], &buf, 1)) != 1) ns_main_earlyfatal("unable to signal parent that we " - "otherwise started successfully."); + "otherwise started successfully " + "(%d,%d).", n, errno); close(dfd[1]); dfd[0] = dfd[1] = -1; } diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index e259dcedd1..aa0df64540 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -16,14 +16,14 @@ */ /* - * $Id: tkey.c,v 1.90.118.6 2011/03/12 04:57:28 tbox Exp $ + * $Id: tkey.c,v 1.90.118.7 2011/11/30 23:06:40 marka Exp $ */ /*! \file */ #include #include #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include #include -#define TKEY_RANDOM_AMOUNT 16 +#define TKEY_RANDOM_AMOUNT ISC_SHA256_DIGESTLENGTH #define RETERR(x) do { \ result = (x); \ @@ -215,6 +215,7 @@ static isc_result_t compute_secret(isc_buffer_t *shared, isc_region_t *queryrandomness, isc_region_t *serverrandomness, isc_buffer_t *secret) { +#if 0 isc_md5_t md5ctx; isc_region_t r, r2; unsigned char digests[32]; @@ -259,7 +260,52 @@ compute_secret(isc_buffer_t *shared, isc_region_t *queryrandomness, isc_buffer_add(secret, sizeof(digests)); } return (ISC_R_SUCCESS); +#else + isc_sha256_t sha256ctx; + isc_region_t r, r2; + unsigned char digests[ISC_SHA256_DIGESTLENGTH*2]; + unsigned int i; + isc_buffer_usedregion(shared, &r); + + /* + * sha256 ( query data | DH value ). + */ + isc_sha256_init(&sha256ctx); + isc_sha256_update(&sha256ctx, queryrandomness->base, + queryrandomness->length); + isc_sha256_update(&sha256ctx, r.base, r.length); + isc_sha256_final(digests, &sha256ctx); + + /* + * sha256 ( server data | DH value ). + */ + isc_sha256_init(&sha256ctx); + isc_sha256_update(&sha256ctx, serverrandomness->base, + serverrandomness->length); + isc_sha256_update(&sha256ctx, r.base, r.length); + isc_sha256_final(&digests[ISC_SHA256_DIGESTLENGTH], &sha256ctx); + + /* + * XOR ( DH value, sha256-1 | sha256-2). + */ + isc_buffer_availableregion(secret, &r); + isc_buffer_usedregion(shared, &r2); + if (r.length < sizeof(digests) || r.length < r2.length) + return (ISC_R_NOSPACE); + if (r2.length > sizeof(digests)) { + memcpy(r.base, r2.base, r2.length); + for (i = 0; i < sizeof(digests); i++) + r.base[i] ^= digests[i]; + isc_buffer_add(secret, r2.length); + } else { + memcpy(r.base, digests, sizeof(digests)); + for (i = 0; i < r2.length; i++) + r.base[i] ^= r2.base[i]; + isc_buffer_add(secret, sizeof(digests)); + } + return (ISC_R_SUCCESS); +#endif } static isc_result_t @@ -288,13 +334,16 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, return (DNS_R_REFUSED); } - if (!dns_name_equal(&tkeyin->algorithm, DNS_TSIG_HMACMD5_NAME)) { + if (!dns_name_equal(&tkeyin->algorithm, DNS_TSIG_HMACSHA256_NAME) && + !dns_name_equal(&tkeyin->algorithm, DNS_TSIG_HMACMD5_NAME)) { tkey_log("process_dhtkey: algorithms other than " - "hmac-md5 are not supported"); + "hmac-md5 or hmac-sha256 are not supported"); tkeyout->error = dns_tsigerror_badalg; return (ISC_R_SUCCESS); } + tkey_log("process_dhtkey: tkeyin->algorithm ok"); + /* * Look for a DH KEY record that will work with ours. */ @@ -308,6 +357,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, &keyset); if (result != ISC_R_SUCCESS) continue; + tkey_log("process_dhtkey: found KEY rrset"); for (result = dns_rdataset_first(keyset); result == ISC_R_SUCCESS && !found_key; @@ -321,10 +371,12 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, continue; } if (dst_key_alg(pubkey) == DNS_KEYALG_DH) { + tkey_log("process_dhtkey: found DH"); if (dst_key_paramcompare(pubkey, tctx->dhkey)) { found_key = ISC_TRUE; ttl = keyset->ttl; + tkey_log("process_dhtkey: match"); break; } else found_incompatible = ISC_TRUE; @@ -409,6 +461,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, return (ISC_R_SUCCESS); failure: + tkey_log("process_dhtkey: failure: %s", dns_result_totext(result)); if (!ISC_LIST_EMPTY(*namelist)) free_namelist(msg, namelist); if (shared != NULL) diff --git a/lib/isc/unix/errno2result.c b/lib/isc/unix/errno2result.c index 606c5600c2..8dad7c919a 100644 --- a/lib/isc/unix/errno2result.c +++ b/lib/isc/unix/errno2result.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: errno2result.c,v 1.17 2007/06/19 23:47:18 tbox Exp $ */ +/* $Id: errno2result.c,v 1.17.332.1 2011/11/30 23:06:41 marka Exp $ */ /*! \file */ @@ -34,7 +34,7 @@ * not already there. */ isc_result_t -isc__errno2result(int posixerrno) { +isc___errno2result(int posixerrno, const char *file, unsigned int line) { char strbuf[ISC_STRERRORSIZE]; switch (posixerrno) { @@ -108,8 +108,7 @@ isc__errno2result(int posixerrno) { return (ISC_R_CONNREFUSED); default: isc__strerror(posixerrno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "unable to convert errno " + UNEXPECTED_ERROR(file, line, "unable to convert errno " "to isc_result: %d: %s", posixerrno, strbuf); /* diff --git a/lib/isc/unix/errno2result.h b/lib/isc/unix/errno2result.h index b5b658d500..2cfbcffdb5 100644 --- a/lib/isc/unix/errno2result.h +++ b/lib/isc/unix/errno2result.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: errno2result.h,v 1.12 2007/06/19 23:47:18 tbox Exp $ */ +/* $Id: errno2result.h,v 1.12.332.1 2011/11/30 23:06:41 marka Exp $ */ #ifndef UNIX_ERRNO2RESULT_H #define UNIX_ERRNO2RESULT_H 1 @@ -31,8 +31,10 @@ ISC_LANG_BEGINDECLS +#define isc__errno2result(x) isc___errno2result(x, __FILE__, __LINE__) + isc_result_t -isc__errno2result(int posixerrno); +isc___errno2result(int posixerrno, const char *file, unsigned int line); ISC_LANG_ENDDECLS diff --git a/util/check-pullups.pl b/util/check-pullups.pl index 9eb3a32694..003bded4ed 100644 --- a/util/check-pullups.pl +++ b/util/check-pullups.pl @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: check-pullups.pl,v 1.12 2007/06/19 23:47:24 tbox Exp $ +# $Id: check-pullups.pl,v 1.12.332.1 2011/11/30 23:06:41 marka Exp $ # Given two CHANGES files, list [bug] entries present in the # first one but not in the second one. @@ -87,7 +87,7 @@ foreach my $c (sort {$a <=> $b} keys %$c1) { print $c1->{$c}->{text}; } if (exists($c2->{$c}) && $category ne "placeholder" && - $c2->{$c}->{text} ne $text) { + !exists($c3->{$c}) && $c2->{$c}->{text} ne $text) { if ($msg ne "TEXT\n") { $msg = "TEXT\n"; print $msg;