This commit was generated by cvs2svn to compensate for changes in r93507,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
Murray Stokely 2002-04-01 07:54:44 +00:00
commit 7ca37d5578
15 changed files with 225 additions and 84 deletions

View File

@ -215,7 +215,7 @@ MINORVERSION=MinorVersion
#CF = cf/rhapsody.h
#COPTS = -Ddarwin -Wall -Wno-unused -Wno-implicit -Wno-comment \
# -Wno-uninitialized -Wno-switch -Werror -pipe $(BINDDEF) $(CC_OPTIONS)
##SCRIPT=rhapsody
#SCRIPT=freebsd
##--darwin--
## NetBSD

View File

@ -1,7 +1,7 @@
Internet Software Consortium DHCP Distribution
Version 3.0.1
Release Candidate 6
January 17, 2002
Release Candidate 8
February 21, 2002
README FILE
@ -143,14 +143,14 @@ information. On Digital Unix, type ``man pfilt''.
To build the DHCP Distribution, unpack the compressed tar file using
the tar utility and the gzip command - type something like:
zcat dhcp-3.0.1rc6.tar.gz |tar xvf -
zcat dhcp-3.0.1rc8.tar.gz |tar xvf -
On BSD/OS, you have to type gzcat, not zcat, and you may run into
similar problems on other operating systems.
CONFIGURING IT
Now, cd to the dhcp-3.0.1rc6 subdirectory that you've just
Now, cd to the dhcp-3.0.1rc8 subdirectory that you've just
created and configure the source tree by typing:
./configure

View File

@ -1,7 +1,7 @@
Internet Software Consortium DHCP Distribution
Version 3.0.1
Release Candidate 6
January 17, 2002
Release Candidate 8
February 21, 2002
Release Notes
@ -46,6 +46,80 @@ Murrell at BC Tel Advanced Communications. I'd like to express my
thanks to all of these good people here, both for working on the code
and for prodding me into improving it.
Changes since 3.0.1rc7
- Fix two compiler warnings that are generated when compiling on Solaris
with gcc. These stop the build, even though they weren't actually
errors, because we prefer that our builds generate no warnings.
Changes since 3.0.1rc6
- Don't allow a lease that's in the EXPIRED, RELEASED or RESET state
to be renewed.
- Implement lease stealing for cases where the primary has fewer leases
than the secondary, as called for by the standard.
- Add a fudge factor to the lease expiry acceptance code, (suggested
by Kevin Miller of CMU).
- Fix a bug in permit_list_match that made it much too willing to say
that two permit lists matched.
- Unless DEBUG_DNS_UPDATES is defined, print more user-friendly (and
also more compact) messages about DNS updates.
- Fix a bug in generating wire-format domain names for the FQDN option.
- Fix a bug where the FQDN option would not be returned if the client
requested it, contrary to the standard.
- On Darwin, use the freebsd DHCP client script.
- On NetBSD/sparc, don't check for casting warnings.
- Add a flag in the DHCP client to disable updating the client's A
record when sending an FQDN option indicating that the client is
going to update its A record.
- In the client, don't attempt a DNS update until one second after
configuring the new IP address, and if the update times out, keep
trying until a response, positive or negative, is received from the
DNS server.
- Fix an uninitialized memory bug in the DHCP client.
- Apply some FreeBSD-specific bug fixes suggested by Murray Stokely.
- Fix a bug in ns_parserr(), where it was returning the wrong sort
of result code in some cases (suggested by Ben Harris of the
NetBSD project).
- Fix a bug in is_identifier(), where it was checking against EOF
instead of the END_OF_FILE token (also suggested by Ben Harris).
- Fix a bug where if an option universe contained no options, the
DHCP server could dump core (Walter Steiner).
- Fix a bug in the handling of encapsulated options.
- Fix a bug that prevented NWIP suboptions from being processed.
- Delete the FTS_BOOTP and FTS_RESERVED states and implement them
as modifier flags to the FTS_ACTIVE state, as called for in the
failover protocol standard.
- Fix bugs in the pool merging code that resulted in references and
dereferences of null pointers. This bug had no impact unless the
POINTER_DEBUG flag was defined.
- In the server, added a do-forward-updates flag that can be used to
disable forward updates in all cases, so that sites that want the
clients to take sole responsibility for updating their A record can
do so.
- Make it possible to disable optimization of PTR record updates.
Changes since 3.0.1rc5
- Include some new documentation and changes provided by Karl Auer.

View File

@ -3,7 +3,7 @@
Lexical scanner for dhcpd config file... */
/*
* Copyright (c) 1995-2001 Internet Software Consortium.
* Copyright (c) 1995-2002 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: conflex.c,v 1.92.2.4 2002/01/10 19:35:59 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: conflex.c,v 1.92.2.5 2002/02/09 03:15:17 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -612,6 +612,8 @@ static enum dhcp_token intern (atom, dfv)
return DOMAIN;
if (!strcasecmp (atom + 1, "omain-name"))
return DOMAIN_NAME;
if (!strcasecmp (atom + 1, "o-forward-update"))
return DO_FORWARD_UPDATE;
if (!strcasecmp (atom + 1, "ebug"))
return TOKEN_DEBUG;
if (!strcasecmp (atom + 1, "eny"))

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: dns.c,v 1.35.2.10 2001/10/26 21:26:39 mellon Exp $ Copyright (c) 2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: dns.c,v 1.35.2.12 2002/02/20 22:28:17 mellon Exp $ Copyright (c) 2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -619,14 +619,9 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
*/
result = minires_nupdate (&resolver_state, ISC_LIST_HEAD (updqueue));
#ifdef DEBUG_DNS_UPDATES
print_dns_status ((int)result, &updqueue);
while (!ISC_LIST_EMPTY (updqueue)) {
updrec = ISC_LIST_HEAD (updqueue);
ISC_LIST_UNLINK (updqueue, updrec, r_link);
minires_freeupdrec (updrec);
}
#endif
/*
* If this update operation succeeds, the updater can conclude that it
@ -636,8 +631,12 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
* -- "Interaction between DHCP and DNS"
*/
if (result == ISC_R_SUCCESS)
return result;
if (result == ISC_R_SUCCESS) {
log_info ("Added new forward map from %.*s to %s",
(int)ddns_fwd_name -> len,
(const char *)ddns_fwd_name -> data, ddns_address);
goto error;
}
/*
@ -653,9 +652,19 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
* -- "Interaction between DHCP and DNS"
*/
if (result != (rrsetp ? ISC_R_YXRRSET : ISC_R_YXDOMAIN))
return result;
if (result != (rrsetp ? ISC_R_YXRRSET : ISC_R_YXDOMAIN)) {
log_error ("Unable to add forward map from %.*s to %s: %s",
(int)ddns_fwd_name -> len,
(const char *)ddns_fwd_name -> data, ddns_address,
isc_result_totext (result));
goto error;
}
while (!ISC_LIST_EMPTY (updqueue)) {
updrec = ISC_LIST_HEAD (updqueue);
ISC_LIST_UNLINK (updqueue, updrec, r_link);
minires_freeupdrec (updrec);
}
/*
* DHCID RR exists, and matches client identity.
@ -716,7 +725,27 @@ isc_result_t ddns_update_a (struct data_string *ddns_fwd_name,
*/
result = minires_nupdate (&resolver_state, ISC_LIST_HEAD (updqueue));
if (result != ISC_R_SUCCESS) {
if (result == YXRRSET || result == YXDOMAIN ||
result == NXRRSET || result == NXDOMAIN)
log_error ("Forward map from %.*s to %s already in use",
(int)ddns_fwd_name -> len,
(const char *)ddns_fwd_name -> data,
ddns_address);
else
log_error ("Can't update forward map %.*s to %s: %s",
(int)ddns_fwd_name -> len,
(const char *)ddns_fwd_name -> data,
ddns_address, isc_result_totext (result));
} else {
log_info ("Added new forward map from %.*s to %s",
(int)ddns_fwd_name -> len,
(const char *)ddns_fwd_name -> data, ddns_address);
}
#if defined (DEBUG_DNS_UPDATES)
print_dns_status ((int)result, &updqueue);
#endif
/*
* If this query succeeds, the updater can conclude that the current

View File

@ -3,7 +3,7 @@
DHCP options parsing and reassembly. */
/*
* Copyright (c) 1995-2001 Internet Software Consortium.
* Copyright (c) 1995-2002 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: options.c,v 1.85.2.6 2001/10/18 20:11:38 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: options.c,v 1.85.2.8 2002/02/19 20:36:52 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@ -373,9 +373,16 @@ int fqdn_universe_decode (struct option_state *options,
*s = '.';
s += len + 1;
total_len += len;
total_len += len + 1;
}
/* We wind up with a length that's one too many because
we shouldn't increment for the last label, but there's
no way to tell we're at the last label until we exit
the loop. :'*/
if (total_len > 0)
total_len--;
if (!terminated) {
first_len = total_len;
}
@ -508,6 +515,7 @@ int cons_options (inpacket, outpacket, lease, client_state,
priority_list [priority_len++] = DHO_DHCP_LEASE_TIME;
priority_list [priority_len++] = DHO_DHCP_MESSAGE;
priority_list [priority_len++] = DHO_DHCP_REQUESTED_ADDRESS;
priority_list [priority_len++] = DHO_FQDN;
if (prl && prl -> len > 0) {
if ((op = lookup_option (&dhcp_universe, cfg_options,
@ -544,7 +552,8 @@ int cons_options (inpacket, outpacket, lease, client_state,
if (cfg_options -> site_code_min) {
for (i = 0; i < OPTION_HASH_SIZE; i++) {
hash = cfg_options -> universes [dhcp_universe.index];
for (pp = hash [i]; pp; pp = pp -> cdr) {
if (hash) {
for (pp = hash [i]; pp; pp = pp -> cdr) {
op = (struct option_cache *)(pp -> car);
if (op -> option -> code <
cfg_options -> site_code_min &&
@ -553,6 +562,7 @@ int cons_options (inpacket, outpacket, lease, client_state,
DHO_DHCP_AGENT_OPTIONS))
priority_list [priority_len++] =
op -> option -> code;
}
}
}
}
@ -561,8 +571,9 @@ int cons_options (inpacket, outpacket, lease, client_state,
is no site option space, we'll be cycling through the
dhcp option space. */
for (i = 0; i < OPTION_HASH_SIZE; i++) {
hash = (cfg_options -> universes
[cfg_options -> site_universe]);
hash = (cfg_options -> universes
[cfg_options -> site_universe]);
if (hash)
for (pp = hash [i]; pp; pp = pp -> cdr) {
op = (struct option_cache *)(pp -> car);
if (op -> option -> code >=
@ -770,8 +781,9 @@ int store_options (buffer, buflen, packet, lease, client_state,
to be encapsulated first, except that if it's a straight
encapsulation and the user has provided a value for the
encapsulation option, use the user-provided value. */
if ((u -> options [code] -> format [0] == 'E' && !oc) ||
u -> options [code] -> format [0] == 'e') {
if (u -> options [code] &&
((u -> options [code] -> format [0] == 'E' && !oc) ||
u -> options [code] -> format [0] == 'e')) {
int uix;
static char *s, *t;
struct option_cache *tmp;

View File

@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: print.c,v 1.53.2.4 2001/08/08 14:49:20 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: print.c,v 1.53.2.5 2002/02/09 03:23:19 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -1197,6 +1197,14 @@ void print_dns_status (int status, ns_updque *uq)
}
predicate = "and";
}
if (u -> r_dname) {
if (s + 1 < end)
*s++ = ' ';
if (s + strlen (u -> r_dname) < end) {
strcpy (s, u -> r_dname);
s += strlen (s);
}
}
if (ttlp) {
if (s + 1 < end)
*s++ = ' ';
@ -1253,14 +1261,6 @@ void print_dns_status (int status, ns_updque *uq)
strcpy (s, en);
s += strlen (en);
}
if (u -> r_dname) {
if (s + 1 < end)
*s++ = ' ';
if (s + strlen (u -> r_dname) < end) {
strcpy (s, u -> r_dname);
s += strlen (s);
}
}
if (u -> r_data) {
if (s + 1 < end)
*s++ = ' ';

View File

@ -118,6 +118,7 @@ if [ "$sysname" = "" ]; then
case $hw in
arm32) sysname=netbsd-nocast;;
alpha) sysname=netbsd-nocast;;
sparc) sysname=netbsd-nocast;;
*) sysname=netbsd;;
esac;;
OpenBSD)

View File

@ -272,8 +272,7 @@ typedef enum {
FTS_ABANDONED = 5,
FTS_RESET = 6,
FTS_BACKUP = 7,
FTS_RESERVED = 8,
FTS_BOOTP = 9
FTS_LAST = 8
} binding_state_t;
/* A dhcp lease declaration structure. */
@ -304,16 +303,19 @@ struct lease {
u_int8_t flags;
# define STATIC_LEASE 1
# define BOOTP_LEASE 2
# define PERSISTENT_FLAGS (ON_ACK_QUEUE | ON_UPDATE_QUEUE)
# define MS_NULL_TERMINATION 8
# define ON_UPDATE_QUEUE 16
# define ON_ACK_QUEUE 32
# define UNICAST_BROADCAST_HACK 64
# define ON_DEFERRED_QUEUE 128
# define EPHEMERAL_FLAGS (MS_NULL_TERMINATION | \
UNICAST_BROADCAST_HACK)
binding_state_t __attribute__ ((mode (__byte__))) binding_state;
binding_state_t __attribute__ ((mode (__byte__))) next_binding_state;
binding_state_t __attribute__ ((mode (__byte__))) desired_binding_state;
struct lease_state *state;
@ -415,6 +417,7 @@ struct lease_state {
#define SV_PING_CHECKS 42
#define SV_UPDATE_STATIC_LEASES 43
#define SV_LOG_FACILITY 44
#define SV_DO_FORWARD_UPDATES 45
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
# define DEFAULT_DEFAULT_LEASE_TIME 43200
@ -717,6 +720,9 @@ struct client_config {
int omapi_port; /* port on which to accept OMAPI
connections, or -1 for no
listener. */
int do_forward_update; /* If nonzero, and if we have the
information we need, update the
A record for the address we get. */
};
/* Per-interface state used in the dhcp client... */
@ -737,6 +743,7 @@ struct client_state {
u_int16_t secs; /* secs value from DHCPDISCOVER. */
TIME first_sending; /* When was first copy sent? */
TIME interval; /* What's the current resend interval? */
int dns_update_timeout; /* Last timeout set for DNS update. */
struct string_list *medium; /* Last media type tried. */
struct dhcp_packet packet; /* Outgoing DHCP packet. */
unsigned packet_length; /* Actual length of generated packet. */
@ -1891,7 +1898,8 @@ void do_release PROTO ((struct client_state *));
int dhclient_interface_shutdown_hook (struct interface_info *);
int dhclient_interface_discovery_hook (struct interface_info *);
isc_result_t dhclient_interface_startup_hook (struct interface_info *);
void client_dns_update (struct client_state *client, int);
void client_dns_update_timeout (void *cp);
isc_result_t client_dns_update (struct client_state *client, int, int);
/* db.c */
int write_lease PROTO ((struct lease *));
@ -1904,6 +1912,7 @@ int db_printable_len PROTO ((const unsigned char *, unsigned));
void write_named_billing_class (const char *, unsigned, struct class *);
void write_billing_classes (void);
int write_billing_class PROTO ((struct class *));
void commit_leases_timeout PROTO ((void *));
int commit_leases PROTO ((void));
void db_startup PROTO ((int));
int new_lease_file PROTO ((void));

View File

@ -3,7 +3,7 @@
Tokens for config file lexer and parser. */
/*
* Copyright (c) 1996-1999 Internet Software Consortium.
* Copyright (c) 1996-2002 Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -315,10 +315,11 @@ enum dhcp_token {
CONNECT = 610,
REMOVE = 611,
REFRESH = 612,
DOMAIN_NAME = 613
DOMAIN_NAME = 613,
DO_FORWARD_UPDATE = 614
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
(x) != STRING && \
(x) != NUMBER && \
(x) != EOF)
(x) != END_OF_FILE)

View File

@ -18,6 +18,8 @@
#include "cdefs.h"
#include "osdep.h"
#define _ns_flagdata MR_ns_flagdata
#include "minires/resolv.h"
#include "minires/res_update.h"
#include "isc-dhcp/result.h"
@ -151,7 +153,7 @@ isc_result_t res_nmkquery (res_state, int, const char *, ns_class, ns_type,
const unsigned char *, unsigned,
const unsigned char *, double *,
unsigned, unsigned *);
int ns_initparse (const unsigned char *, unsigned, ns_msg *);
isc_result_t ns_initparse (const unsigned char *, unsigned, ns_msg *);
isc_result_t res_nquery(res_state, const char *,
ns_class, ns_type, double *, unsigned, unsigned *);
isc_result_t res_nsearch(res_state, const char *,
@ -161,7 +163,8 @@ isc_result_t res_nquerydomain(res_state, const char *, const char *,
ns_class class, ns_type type,
double *, unsigned, unsigned *);
int ns_skiprr(const unsigned char *, const unsigned char *, ns_sect, int);
isc_result_t ns_skiprr(const unsigned char *,
const unsigned char *, ns_sect, int, int *);
int dn_skipname (const unsigned char *, const unsigned char *);
u_int32_t getULong (const unsigned char *);
int32_t getLong (const unsigned char *);

View File

@ -86,6 +86,11 @@
/* #define DEBUG_FAILOVER_TIMING */
/* Define this if you want all leases written to the lease file, even if
they are free leases that have never been used. */
#define DEBUG_DUMP_ALL_LEASES
/* Define this if you want DHCP failover protocol support in the DHCP
server. */

View File

@ -1,3 +1,3 @@
/* Current version of ISC DHCP Distribution. */
#define DHCP_VERSION "V3.0.1rc6"
#define DHCP_VERSION "V3.0.1rc8"

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_parse.c,v 1.2 2001/01/16 22:33:08 mellon Exp $";
static const char rcsid[] = "$Id: ns_parse.c,v 1.2.2.1 2002/02/19 19:16:52 mellon Exp $";
#endif
/* Import. */
@ -38,8 +38,6 @@ static void setsection(ns_msg *msg, ns_sect sect);
/* Macros. */
#define RETERR(err) do { errno = (err); return (-1); } while (0)
/* Public. */
/* These need to be in the same order as the nres.h:ns_flag enum. */
@ -62,8 +60,9 @@ struct _ns_flagdata _ns_flagdata[16] = {
{ 0x0000, 0 }, /* expansion (6/6). */
};
int
ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
isc_result_t
ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count,
int *rc) {
const u_char *optr = ptr;
for ((void)NULL; count > 0; count--) {
@ -71,11 +70,11 @@ ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
b = dn_skipname(ptr, eom);
if (b < 0)
RETERR(EMSGSIZE);
return ISC_R_INCOMPLETE;
ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/;
if (section != ns_s_qd) {
if (ptr + NS_INT32SZ + NS_INT16SZ > eom)
RETERR(EMSGSIZE);
return ISC_R_INCOMPLETE;
ptr += NS_INT32SZ/*TTL*/;
rdlength = getUShort(ptr);
ptr += 2;
@ -83,11 +82,13 @@ ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
}
}
if (ptr > eom)
RETERR(EMSGSIZE);
return (ptr - optr);
return ISC_R_INCOMPLETE;
if (rc)
*rc = ptr - optr;
return ISC_R_SUCCESS;
}
int
isc_result_t
ns_initparse(const u_char *msg, unsigned msglen, ns_msg *handle) {
const u_char *eom = msg + msglen;
int i;
@ -96,16 +97,16 @@ ns_initparse(const u_char *msg, unsigned msglen, ns_msg *handle) {
handle->_msg = msg;
handle->_eom = eom;
if (msg + NS_INT16SZ > eom)
RETERR(EMSGSIZE);
return ISC_R_INCOMPLETE;
handle->_id = getUShort (msg);
msg += 2;
if (msg + NS_INT16SZ > eom)
RETERR(EMSGSIZE);
return ISC_R_INCOMPLETE;
handle->_flags = getUShort (msg);
msg += 2;
for (i = 0; i < ns_s_max; i++) {
if (msg + NS_INT16SZ > eom)
RETERR(EMSGSIZE);
return ISC_R_INCOMPLETE;
handle->_counts[i] = getUShort (msg);
msg += 2;
}
@ -113,23 +114,26 @@ ns_initparse(const u_char *msg, unsigned msglen, ns_msg *handle) {
if (handle->_counts[i] == 0)
handle->_sections[i] = NULL;
else {
int b = ns_skiprr(msg, eom, (ns_sect)i,
handle->_counts[i]);
int b;
isc_result_t status =
ns_skiprr(msg, eom, (ns_sect)i,
handle->_counts[i], &b);
if (b < 0)
return (-1);
if (status != ISC_R_SUCCESS)
return STATUS;
handle->_sections[i] = msg;
msg += b;
}
if (msg != eom)
RETERR(EMSGSIZE);
return ISC_R_INCOMPLETE;
setsection(handle, ns_s_max);
return (0);
return ISC_R_SUCCESS;
}
isc_result_t
ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
int b;
isc_result_t status;
/* Make section right. */
if (section < 0 || section >= ns_s_max)
@ -141,15 +145,15 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
if (rrnum == -1)
rrnum = handle->_rrnum;
if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
RETERR(ENODEV);
return ISC_R_UNKNOWNATTRIBUTE;
if (rrnum < handle->_rrnum)
setsection(handle, section);
if (rrnum > handle->_rrnum) {
b = ns_skiprr(handle->_ptr, handle->_eom, section,
rrnum - handle->_rrnum);
status = ns_skiprr(handle->_ptr, handle->_eom, section,
rrnum - handle->_rrnum, &b);
if (b < 0)
return (-1);
if (status != ISC_R_SUCCESS)
return status;
handle->_ptr += b;
handle->_rrnum = rrnum;
}
@ -158,10 +162,10 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
b = dn_expand(handle->_msg, handle->_eom,
handle->_ptr, rr->name, NS_MAXDNAME);
if (b < 0)
return (-1);
return ISC_R_FORMERR;
handle->_ptr += b;
if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
return ISC_R_NOSPACE;
return ISC_R_INCOMPLETE;
rr->type = getUShort (handle->_ptr);
handle -> _ptr += 2;
rr->rr_class = getUShort (handle->_ptr);
@ -172,13 +176,13 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
rr->rdata = NULL;
} else {
if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
return ISC_R_NOSPACE;
return ISC_R_INCOMPLETE;
rr->ttl = getULong (handle->_ptr);
handle -> _ptr += 4;
rr->rdlength = getUShort (handle->_ptr);
handle -> _ptr += 2;
if (handle->_ptr + rr->rdlength > handle->_eom)
return ISC_R_NOSPACE;
return ISC_R_INCOMPLETE;
rr->rdata = handle->_ptr;
handle->_ptr += rr->rdlength;
}

View File

@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_verify.c,v 1.5.2.1 2001/05/17 20:47:34 mellon Exp $";
static const char rcsid[] = "$Id: ns_verify.c,v 1.5.2.2 2002/02/19 19:23:31 mellon Exp $";
#endif
#define time(x) trace_mr_time (x)
@ -60,6 +60,7 @@ ns_find_tsig(u_char *msg, u_char *eom) {
HEADER *hp = (HEADER *)msg;
int n, type;
u_char *cp = msg, *start;
isc_result_t status;
if (msg == NULL || eom == NULL || msg > eom)
return (NULL);
@ -72,23 +73,23 @@ ns_find_tsig(u_char *msg, u_char *eom) {
cp += HFIXEDSZ;
n = ns_skiprr(cp, eom, ns_s_qd, ntohs(hp->qdcount));
if (n < 0)
status = ns_skiprr(cp, eom, ns_s_qd, ntohs(hp->qdcount), &n);
if (status != ISC_R_SUCCESS)
return (NULL);
cp += n;
n = ns_skiprr(cp, eom, ns_s_an, ntohs(hp->ancount));
if (n < 0)
status = ns_skiprr(cp, eom, ns_s_an, ntohs(hp->ancount), &n);
if (status != ISC_R_SUCCESS)
return (NULL);
cp += n;
n = ns_skiprr(cp, eom, ns_s_ns, ntohs(hp->nscount));
if (n < 0)
status = ns_skiprr(cp, eom, ns_s_ns, ntohs(hp->nscount), &n);
if (status != ISC_R_SUCCESS)
return (NULL);
cp += n;
n = ns_skiprr(cp, eom, ns_s_ar, ntohs(hp->arcount) - 1);
if (n < 0)
status = ns_skiprr(cp, eom, ns_s_ar, ntohs(hp->arcount) - 1, &n);
if (status != ISC_R_SUCCESS)
return (NULL);
cp += n;