From: Willem Toorop Date: Tue, 17 Jan 2012 11:18:30 +0000 (+0000) Subject: Code review fixes. X-Git-Tag: release-1.6.13rc1~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5d7cbe4afa90165fbc7b4a3985e734b8e147304;p=thirdparty%2Fldns.git Code review fixes. Clarify -S option in ldns-read-zone manpage Fix spelling of dnssec_trust_tree in doxygen documentation in dnssec_verify.h Use rfc1982 serial arithmetics when comparing soa serial numbers in ldns_rrsig_check_timestamps, ldns_soa_serial_datecounter and ldns_soa_serial_unixtime. Thanks Wouter! --- diff --git a/dnssec_verify.c b/dnssec_verify.c index 18af5d2f..503fdd30 100644 --- a/dnssec_verify.c +++ b/dnssec_verify.c @@ -2108,11 +2108,11 @@ ldns_rrsig_check_timestamps(ldns_rr* rrsig, time_t now) /* bad sig, expiration before inception?? Tsssg */ return LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION; } - if (now - inception < 0) { + if (((int32_t) now) - inception < 0) { /* bad sig, inception date has not yet come to pass */ return LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED; } - if (expiration - now < 0) { + if (expiration - ((int32_t) now) < 0) { /* bad sig, expiration date has passed */ return LDNS_STATUS_CRYPTO_SIG_EXPIRED; } diff --git a/examples/ldns-read-zone.1 b/examples/ldns-read-zone.1 index 49cd3e58..81f238d6 100644 --- a/examples/ldns-read-zone.1 +++ b/examples/ldns-read-zone.1 @@ -44,8 +44,8 @@ in datecounter or in unixtime format respectively. Though is the updated serial number is smaller than the original one, the original one is simply increased by one. -When updating a zone's serial serial number, it will be stripped from DNSSEC -data as well. +When updating a serial number, records of type NSEC, NSEC3, RRSIG and DNSKEY +will be skipped when printing the zone. .TP diff --git a/ldns/dnssec_verify.h b/ldns/dnssec_verify.h index 1350f485..32036a8c 100644 --- a/ldns/dnssec_verify.h +++ b/ldns/dnssec_verify.h @@ -209,7 +209,7 @@ ldns_status ldns_dnssec_trust_tree_add_parent(ldns_dnssec_trust_tree *tree, const ldns_status parent_status); /** - * Generates a dnssec_trust_ttree for the given rr from the + * Generates a dnssec_trust_tree for the given rr from the * given data_chain * * This does not clone the actual data; Don't free the @@ -224,7 +224,7 @@ ldns_dnssec_trust_tree *ldns_dnssec_derive_trust_tree( ldns_rr *rr); /** - * Generates a dnssec_trust_ttree for the given rr from the + * Generates a dnssec_trust_tree for the given rr from the * given data_chain * * This does not clone the actual data; Don't free the diff --git a/ldns/rr_functions.h b/ldns/rr_functions.h index 3db3b3df..09a28dd7 100644 --- a/ldns/rr_functions.h +++ b/ldns/rr_functions.h @@ -268,18 +268,18 @@ typedef uint32_t (*ldns_soa_serial_increment_func_t)(uint32_t, void*); /** * Function to be used with dns_rr_soa_increment_func_int, to set the soa * serial number. - * \param[in] _ the (unused) current serial number. + * \param[in] unused the (unused) current serial number. * \param[in] data the serial number to be set. */ -uint32_t ldns_soa_serial_identity(uint32_t _, void *data); +uint32_t ldns_soa_serial_identity(uint32_t unused, void *data); /** * Function to be used with dns_rr_soa_increment_func, to increment the soa * serial number with one. * \param[in] s the current serial number. - * \param[in] _ unused. + * \param[in] unused unused. */ -uint32_t ldns_soa_serial_increment(uint32_t s, void *_); +uint32_t ldns_soa_serial_increment(uint32_t s, void *unused); /** * Function to be used with dns_rr_soa_increment_func_int, to increment the soa diff --git a/rr_functions.c b/rr_functions.c index b4847d62..13bf6a7b 100644 --- a/rr_functions.c +++ b/rr_functions.c @@ -341,12 +341,12 @@ ldns_rr_dnskey_key_size(const ldns_rr *key) ); } -uint32_t ldns_soa_serial_identity(uint32_t ATTR_UNUSED(_), void *data) +uint32_t ldns_soa_serial_identity(uint32_t ATTR_UNUSED(unused), void *data) { return (uint32_t) (intptr_t) data; } -uint32_t ldns_soa_serial_increment(uint32_t s, void *ATTR_UNUSED(_)) +uint32_t ldns_soa_serial_increment(uint32_t s, void *ATTR_UNUSED(unused)) { return ldns_soa_serial_increment_by(s, (void *)1); } @@ -360,19 +360,19 @@ uint32_t ldns_soa_serial_datecounter(uint32_t s, void *data) { struct tm tm; char s_str[11]; - uint32_t new_s; + int32_t new_s; time_t t = data ? (time_t) (intptr_t) data : ldns_time(NULL); (void) strftime(s_str, 11, "%Y%m%d00", localtime_r(&t, &tm)); - new_s = (uint32_t) atoi(s_str); - return new_s > s ? new_s : s+1; + new_s = (int32_t) atoi(s_str); + return new_s - ((int32_t) s) < 0 ? s+1 : ((uint32_t) new_s); } uint32_t ldns_soa_serial_unixtime(uint32_t s, void *data) { - uint32_t new_s = data ? (uint32_t) (intptr_t) data - : (uint32_t) ldns_time(NULL); - return new_s > s ? new_s : s+1; + int32_t new_s = data ? (int32_t) (intptr_t) data + : (int32_t) ldns_time(NULL); + return new_s - ((int32_t) s) < 0 ? s+1 : ((uint32_t) new_s); } void