diff options
author | Shawn Routhier <sar@isc.org> | 2010-09-08 22:20:01 +0000 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2010-09-08 22:20:01 +0000 |
commit | f26c4a0bef7e566b33e142b2681da2a038c8f61d (patch) | |
tree | ee79fb7a985cefc610a8b52027c3bbb70ad667a7 /common | |
parent | dede8b83c832f66f4d84b0494be0ebb89d08deae (diff) | |
download | isc-dhcp-f26c4a0bef7e566b33e142b2681da2a038c8f61d.tar.gz |
Minor code fixes
[ISC-Bugs #19566] When trying to find the zone for a name for ddns allow
the name to be at the apex of the zone.
[ISC-Bugs #19617] Restrict length of interface name read from command line
in dhcpd - based on a patch from David Cantrell at Red Hat.
[ISC-Bugs #20039] Correct some error messages in dhcpd.c
[ISC-Bugs #20070] Better range check on values when creating a DHCID.
[ISC-Bugs #20198] Avoid writing past the end of the field when adding
overly long file or server names to a packet and add a log message
if the configuration supplied overly long names for these fields.
[ISC-Bugs #21497] Add a little more randomness to rng seed in client
Diffstat (limited to 'common')
-rw-r--r-- | common/dns.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/common/dns.c b/common/dns.c index b9d6d2ac..8f1db46b 100644 --- a/common/dns.c +++ b/common/dns.c @@ -658,13 +658,16 @@ find_cached_zone(dhcp_ddns_cb_t *ddns_cb, int direction) /* * For each subzone, try to find a cached zone. - * Skip the first zone as that shouldn't work. */ - for (np = strchr(np, '.'); np != NULL; np = strchr(np, '.')) { - np++; + for (;;) { status = dns_zone_lookup (&zone, np); if (status == ISC_R_SUCCESS) break; + + np = strchr(np, '.'); + if (np == NULL) + break; + np++; } if (status != ISC_R_SUCCESS) @@ -805,7 +808,11 @@ int get_dhcid (struct data_string *id, id->buffer->data[0] = ISC_MD5_DIGESTLENGTH * 2 + 2; /* Put the type in the next two bytes. */ - id->buffer->data[1] = "0123456789abcdef"[type >> 4]; + id->buffer->data[1] = "0123456789abcdef"[(type >> 4) & 0xf]; + /* This should have been [type & 0xf] but now that + * it is in use we need to leave it this way in order + * to avoid disturbing customer's lease files + */ id->buffer->data[2] = "0123456789abcdef"[type % 15]; /* Mash together an MD5 hash of the identifier. */ |