Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.sbin/dhcp Pull up revision 1.1.1.2 (requested by me...



details:   https://anonhg.NetBSD.org/src/rev/b5a27641a219
branches:  netbsd-1-5
changeset: 491109:b5a27641a219
user:      he <he%NetBSD.org@localhost>
date:      Wed Apr 04 20:56:32 2001 +0000

description:
Pull up revision 1.1.1.2 (requested by mellon):
  Update DHCP software to ISC version 3, Beta 2, Patchlevel 23.

diffstat:

 usr.sbin/dhcp/includes/isc/types.h          |   1 -
 usr.sbin/dhcp/includes/minires/res_update.h |   5 +-
 usr.sbin/dhcp/includes/omapip/alloc.h       |   4 +-
 usr.sbin/dhcp/minires/ns_parse.c            |  14 ++--
 usr.sbin/dhcp/minires/ns_samedomain.c       |  17 +++--
 usr.sbin/dhcp/minires/ns_sign.c             |  58 ++++++++++--------
 usr.sbin/dhcp/minires/ns_verify.c           |  88 +++++++++++++++-------------
 usr.sbin/dhcp/minires/res_init.c            |   9 ++-
 8 files changed, 110 insertions(+), 86 deletions(-)

diffs (truncated from 670 to 300 lines):

diff -r dcfe64cb2b94 -r b5a27641a219 usr.sbin/dhcp/includes/isc/types.h
--- a/usr.sbin/dhcp/includes/isc/types.h        Wed Apr 04 20:56:30 2001 +0000
+++ b/usr.sbin/dhcp/includes/isc/types.h        Wed Apr 04 20:56:32 2001 +0000
@@ -26,7 +26,6 @@
  *** Core Types.
  ***/
 
-typedef unsigned int                   isc_result_t;
 typedef struct isc_mem                 isc_mem_t;
 typedef struct isc_mempool             isc_mempool_t;
 typedef struct isc_msgcat              isc_msgcat_t;
diff -r dcfe64cb2b94 -r b5a27641a219 usr.sbin/dhcp/includes/minires/res_update.h
--- a/usr.sbin/dhcp/includes/minires/res_update.h       Wed Apr 04 20:56:30 2001 +0000
+++ b/usr.sbin/dhcp/includes/minires/res_update.h       Wed Apr 04 20:56:32 2001 +0000
@@ -16,7 +16,7 @@
  */
 
 /*
- *     $Id: res_update.h,v 1.1.1.1 2000/04/22 07:11:51 mellon Exp $
+ *     $Id: res_update.h,v 1.1.1.1.4.1 2001/04/04 20:56:32 he Exp $
  */
 
 #ifndef __RES_UPDATE_H
@@ -36,7 +36,8 @@
        ns_class r_class;               /* class number */
        ns_type r_type;                 /* type number */
        u_int32_t r_ttl;                /* time to live */
-       unsigned char*  r_data;         /* rdata fields as text string */
+       const unsigned char *r_data;    /* rdata fields as text string */
+       unsigned char *r_data_ephem;    /* pointer to freeable r_data */
        unsigned int r_size;            /* size of r_data field */
        int r_opcode;                   /* type of operation */
                /* following fields for private use by the resolver/server
diff -r dcfe64cb2b94 -r b5a27641a219 usr.sbin/dhcp/includes/omapip/alloc.h
--- a/usr.sbin/dhcp/includes/omapip/alloc.h     Wed Apr 04 20:56:30 2001 +0000
+++ b/usr.sbin/dhcp/includes/omapip/alloc.h     Wed Apr 04 20:56:32 2001 +0000
@@ -85,7 +85,8 @@
        rc_history [rc_history_index].addr = (y); \
        rc_history [rc_history_index].refcnt = (z); \
        if (++rc_history_index == RC_HISTORY_MAX) \
-               rc_history_index = 0;\
+               rc_history_index = 0; \
+       ++rc_history_count; \
        } while (0)
 #define rc_register_mdl(r, y, z) \
        rc_register (__FILE__, __LINE__, r, y, z)
@@ -105,4 +106,5 @@
 #if defined (DEBUG_RC_HISTORY)
 extern struct rc_history_entry rc_history [RC_HISTORY_MAX];
 extern int rc_history_index;
+extern int rc_history_count;
 #endif
diff -r dcfe64cb2b94 -r b5a27641a219 usr.sbin/dhcp/minires/ns_parse.c
--- a/usr.sbin/dhcp/minires/ns_parse.c  Wed Apr 04 20:56:30 2001 +0000
+++ b/usr.sbin/dhcp/minires/ns_parse.c  Wed Apr 04 20:56:32 2001 +0000
@@ -16,7 +16,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ns_parse.c,v 1.1.1.1 2000/04/22 07:11:54 mellon Exp $";
+static const char rcsid[] = "$Id: ns_parse.c,v 1.1.1.1.4.1 2001/04/04 20:56:33 he Exp $";
 #endif
 
 /* Import. */
@@ -127,13 +127,13 @@
        return (0);
 }
 
-int
+isc_result_t
 ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
        int b;
 
        /* Make section right. */
        if (section < 0 || section >= ns_s_max)
-               RETERR(ENODEV);
+               return ISC_R_NOTIMPLEMENTED;
        if (section != handle->_sect)
                setsection(handle, section);
 
@@ -161,7 +161,7 @@
                return (-1);
        handle->_ptr += b;
        if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
-               RETERR(EMSGSIZE);
+               return ISC_R_NOSPACE;
        rr->type = getUShort (handle->_ptr);
        handle -> _ptr += 2;
        rr->rr_class = getUShort (handle->_ptr);
@@ -172,13 +172,13 @@
                rr->rdata = NULL;
        } else {
                if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
-                       RETERR(EMSGSIZE);
+                       return ISC_R_NOSPACE;
                rr->ttl = getULong (handle->_ptr);
                handle -> _ptr += 4;
                rr->rdlength = getUShort (handle->_ptr);
                handle -> _ptr += 2;
                if (handle->_ptr + rr->rdlength > handle->_eom)
-                       RETERR(EMSGSIZE);
+                       return ISC_R_NOSPACE;
                rr->rdata = handle->_ptr;
                handle->_ptr += rr->rdlength;
        }
@@ -186,7 +186,7 @@
                setsection(handle, (ns_sect)((int)section + 1));
 
        /* All done. */
-       return (0);
+       return ISC_R_SUCCESS;
 }
 
 /* Private. */
diff -r dcfe64cb2b94 -r b5a27641a219 usr.sbin/dhcp/minires/ns_samedomain.c
--- a/usr.sbin/dhcp/minires/ns_samedomain.c     Wed Apr 04 20:56:30 2001 +0000
+++ b/usr.sbin/dhcp/minires/ns_samedomain.c     Wed Apr 04 20:56:32 2001 +0000
@@ -16,7 +16,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.1.1 2000/04/22 07:11:54 mellon Exp $";
+static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.1.1.4.1 2001/04/04 20:56:33 he Exp $";
 #endif
 
 #include <sys/types.h>
@@ -163,13 +163,12 @@
  *     foo\\. -> foo\\.
  */
 
-int
+isc_result_t
 ns_makecanon(const char *src, char *dst, size_t dstsize) {
        size_t n = strlen(src);
 
        if (n + sizeof "." > dstsize) {
-               errno = EMSGSIZE;
-               return (-1);
+               ISC_R_NOSPACE;
        }
        strcpy(dst, src);
        while (n > 0 && dst[n - 1] == '.')              /* Ends in "." */
@@ -180,7 +179,7 @@
                        dst[--n] = '\0';
        dst[n++] = '.';
        dst[n] = '\0';
-       return (0);
+       return ISC_R_SUCCESS;
 }
 
 /*
@@ -196,9 +195,13 @@
 int
 ns_samename(const char *a, const char *b) {
        char ta[NS_MAXDNAME], tb[NS_MAXDNAME];
+       isc_result_t status;
 
-       if (ns_makecanon(a, ta, sizeof ta) < 0 ||
-           ns_makecanon(b, tb, sizeof tb) < 0)
+       status = ns_makecanon(a, ta, sizeof ta);
+       if (status != ISC_R_SUCCESS)
+               return status;
+       status = ns_makecanon(b, tb, sizeof tb);
+       if (status != ISC_R_SUCCESS)
                return (-1);
        if (strcasecmp(ta, tb) == 0)
                return (1);
diff -r dcfe64cb2b94 -r b5a27641a219 usr.sbin/dhcp/minires/ns_sign.c
--- a/usr.sbin/dhcp/minires/ns_sign.c   Wed Apr 04 20:56:30 2001 +0000
+++ b/usr.sbin/dhcp/minires/ns_sign.c   Wed Apr 04 20:56:32 2001 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999 by Internet Software Consortium, Inc.
+ * Copyright (c) 1999-2001 by Internet Software Consortium, Inc.
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -16,7 +16,12 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ns_sign.c,v 1.1.1.1 2000/04/22 07:11:54 mellon Exp $";
+static const char rcsid[] = "$Id: ns_sign.c,v 1.1.1.1.4.1 2001/04/04 20:56:33 he Exp $";
+#endif
+
+#if defined (TRACING)
+#define time(x)                trace_mr_time (x)
+time_t trace_mr_time (time_t *);
 #endif
 
 /* Import. */
@@ -44,8 +49,7 @@
 #define BOUNDS_CHECK(ptr, count) \
        do { \
                if ((ptr) + (count) > eob) { \
-                       errno = EMSGSIZE; \
-                       return(NS_TSIG_ERROR_NO_SPACE); \
+                       return ISC_R_NOSPACE; \
                } \
        } while (0)
 
@@ -68,7 +72,7 @@
  *     - bad key / sign failed (-BADKEY)
  *     - not enough space (NS_TSIG_ERROR_NO_SPACE)
  */
-int
+isc_result_t
 ns_sign(u_char *msg, unsigned *msglen, unsigned msgsize, int error, void *k,
        const u_char *querysig, unsigned querysiglen, u_char *sig,
        unsigned *siglen, time_t in_timesigned)
@@ -83,7 +87,7 @@
 
        dst_init();
        if (msg == NULL || msglen == NULL || sig == NULL || siglen == NULL)
-               return (-1);
+               ISC_R_INVALIDARG;
 
        /* Name. */
        if (key != NULL && error != ns_r_badsig && error != ns_r_badkey)
@@ -92,7 +96,7 @@
        else
                n = dn_comp("", cp, (unsigned)(eob - cp), NULL, NULL);
        if (n < 0)
-               return (NS_TSIG_ERROR_NO_SPACE);
+               return ISC_R_NOSPACE;
        name = cp;
        cp += n;
 
@@ -107,14 +111,14 @@
        /* Alg. */
        if (key != NULL && error != ns_r_badsig && error != ns_r_badkey) {
                if (key->dk_alg != KEY_HMAC_MD5)
-                       return (-ns_r_badkey);
+                       return ISC_R_BADKEY;
                n = dn_comp(NS_TSIG_ALG_HMAC_MD5,
                            cp, (unsigned)(eob - cp), NULL, NULL);
        }
        else
                n = dn_comp("", cp, (unsigned)(eob - cp), NULL, NULL);
        if (n < 0)
-               return (NS_TSIG_ERROR_NO_SPACE);
+               ISC_R_NOSPACE;
        alg = cp;
        cp += n;
        
@@ -186,7 +190,7 @@
                n = dst_sign_data(SIG_MODE_FINAL, key, &ctx, NULL, 0,
                                  sig, *siglen);
                if (n < 0)
-                       return (-ns_r_badkey);
+                       ISC_R_BADKEY;
                *siglen = n;
        } else
                *siglen = 0;
@@ -218,28 +222,29 @@
 
        hp->arcount = htons(ntohs(hp->arcount) + 1);
        *msglen = (cp - msg);
-       return (0);
+       return ISC_R_SUCCESS;
 }
 
-int
+#if 0
+isc_result_t
 ns_sign_tcp_init(void *k, const u_char *querysig, unsigned querysiglen,
                 ns_tcp_tsig_state *state)
 {
        dst_init();
        if (state == NULL || k == NULL || querysig == NULL || querysiglen < 0)
-               return (-1);
+               return ISC_R_INVALIDARG;
        state->counter = -1;
        state->key = k;
        if (state->key->dk_alg != KEY_HMAC_MD5)
-               return (-ns_r_badkey);
+               return ISC_R_BADKEY;
        if (querysiglen > sizeof(state->sig))
-               return (-1);
+               return ISC_R_NOSPACE;
        memcpy(state->sig, querysig, querysiglen);
        state->siglen = querysiglen;
-       return (0);
+       return ISC_R_SUCCESS;
 }
 
-int
+isc_result_t
 ns_sign_tcp(u_char *msg, unsigned *msglen, unsigned msgsize, int error,
            ns_tcp_tsig_state *state, int done)
 {
@@ -250,13 +255,13 @@
        int n;
 
        if (msg == NULL || msglen == NULL || state == NULL)
-               return (-1);
+               return ISC_R_INVALIDARG;
 
        state->counter++;
        if (state->counter == 0)



Home | Main Index | Thread Index | Old Index