]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
sync multiple changes from BIND 8.
authorMark Andrews <marka@isc.org>
Mon, 28 May 2001 08:38:32 +0000 (08:38 +0000)
committerMark Andrews <marka@isc.org>
Mon, 28 May 2001 08:38:32 +0000 (08:38 +0000)
lib/bind/include/isc/logging.h
lib/bind/include/isc/memcluster.h
lib/bind/include/resolv.h
lib/bind/inet/nsap_addr.c
lib/bind/irs/getgrent_r.c
lib/bind/irs/getpwent_r.c
lib/bind/isc/logging.c
lib/bind/isc/memcluster.c
lib/bind/nameser/ns_print.c
lib/bind/resolv/res_init.c

index 3d3d3132a09eb353d8658ebf0200adede8e30ee6..b3435ff7b2cfb24f8289b686c36798b107f55f64 100644 (file)
@@ -72,6 +72,7 @@ typedef struct log_channel *log_channel;
 #define log_dec_references     __log_dec_references
 #define log_get_channel_type   __log_get_channel_type
 #define log_free_channel       __log_free_channel
+#define log_close_debug_channels       __log_close_debug_channels
 
 FILE *                 log_open_stream(log_channel);
 int                    log_close_stream(log_channel);
@@ -98,5 +99,6 @@ int                   log_inc_references(log_channel);
 int                    log_dec_references(log_channel);
 log_channel_type       log_get_channel_type(log_channel);
 int                    log_free_channel(log_channel);
+void                   log_close_debug_channels(log_context);
 
 #endif /* !LOGGING_H */
index b6f4191fd5caf6b3f72b090098b3c70ffd20a776..bcf69b25b667ac9ba9db19be4d49d0f74749f9c4 100644 (file)
@@ -34,6 +34,7 @@
 #endif /*MEMCLUSTER_RECORD*/
 #endif /*MEMCLUSTER_DEBUG*/
 #define memstats       __memstats
+#define memactive      __memactive
 
 int    meminit(size_t, size_t);
 void * __memget(size_t);
@@ -43,5 +44,6 @@ void  __memput_debug(void *, size_t, const char *, int);
 void * __memget_record(size_t, const char *, int);
 void   __memput_record(void *, size_t, const char *, int);
 void   memstats(FILE *);
+int    memactive(void);
 
 #endif /* MEMCLUSTER_H */
index 4605bf8a0f417a45fe8ce9128ea32bf03f28f500..a297dad2ce3b9cd05aada19949ad7c61277805d6 100644 (file)
@@ -50,7 +50,7 @@
 
 /*
  *     @(#)resolv.h    8.1 (Berkeley) 6/2/93
- *     $Id: resolv.h,v 1.4 2001/05/22 22:51:31 marka Exp $
+ *     $Id: resolv.h,v 1.5 2001/05/28 08:38:20 marka Exp $
  */
 
 #ifndef _RESOLV_H_
@@ -98,7 +98,9 @@
 
 #define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
 struct __res_state; /* forward */
+__BEGIN_DECLS
 void __h_errno_set(struct __res_state *res, int err);
+__END_DECLS
 
 /*
  * Resolver configuration file.
@@ -250,7 +252,9 @@ typedef struct __res_state *res_state;
 
 /* Things involving an internal (static) resolver context. */
 #ifdef _REENTRANT
+__BEGIN_DECLS
 extern struct __res_state *__res_state(void);
+__END_DECLS
 #define _res (*__res_state())
 #else
 #ifndef __BIND_NOSTATIC
index f6a6d67eb2853d7b1912e95233760d1fa5f611d9..a39d6595b0a5b26cdbf8b0adcd0b054c989e2f44 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: nsap_addr.c,v 1.1 2001/03/29 06:31:41 marka Exp $";
+static const char rcsid[] = "$Id: nsap_addr.c,v 1.2 2001/05/28 08:38:24 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -44,6 +44,10 @@ inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
        u_char c, nib;
        u_int len = 0;
 
+       if (ascii[0] != '0' || (ascii[1] != 'x' && ascii[1] != 'X'))
+               return (0);
+       ascii += 2;
+
        while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
                if (c == '.' || c == '+' || c == '/')
                        continue;
@@ -75,7 +79,7 @@ char *
 inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
        int nib;
        int i;
-       static char tmpbuf[255*3];
+       static char tmpbuf[2+255*3];
        char *start;
 
        if (ascii)
@@ -85,6 +89,9 @@ inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
                start = tmpbuf;
        }
 
+       *ascii++ = '0';
+       *ascii++ = 'x';
+
        if (binlen > 255)
                binlen = 255;
 
index 73bbffb5a810637d6d9c7899181c44eaf58eb4e4..2949b18864cd398dec1987134040c1f0c6c50503 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: getgrent_r.c,v 1.3 2001/04/05 06:19:32 marka Exp $";
+static const char rcsid[] = "$Id: getgrent_r.c,v 1.4 2001/05/28 08:38:25 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include <port_before.h>
@@ -59,7 +59,7 @@ getgrnam_r(const char *name,  struct group *gptr,
 
        if (ge == NULL) {
                *result = NULL;
-               return (-1);
+               return (0);
        }
 
        res = copy_group(ge, gptr, buf, buflen);
@@ -96,7 +96,7 @@ getgrgid_r(gid_t gid, struct group *gptr,
 
        if (ge == NULL) {
                *result = NULL;
-               return (-1);
+               return (0);
        }
 
        res = copy_group(ge, gptr, buf, buflen);
@@ -190,7 +190,7 @@ copy_group(struct group *ge, struct group *gptr, char *buf, int buflen) {
        
        if (len > buflen) {
                errno = ERANGE;
-               return (-1);
+               return (ERANGE);
        }
 
        /* copy group id */
index 80bb81a6d742e81f818da94bd0e5f57949a903ab..bfafe92d60384c860a0efd81c3d0dd8994e01c44 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: getpwent_r.c,v 1.2 2001/04/09 04:53:22 marka Exp $";
+static const char rcsid[] = "$Id: getpwent_r.c,v 1.3 2001/05/28 08:38:26 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include <port_before.h>
@@ -58,7 +58,7 @@ getpwnam_r(const char *login,  struct passwd *pwptr,
 
        if (pw == NULL) {
                *result = NULL;
-               return (-1);
+               return (0);
        }
 
        res = copy_passwd(pw, pwptr, buf, buflen);
@@ -95,7 +95,7 @@ getpwuid_r(uid_t uid, struct passwd *pwptr,
 
        if (pw == NULL) {
                *result = NULL;
-               return (-1);
+               return (0);
        }
 
        res = copy_passwd(pw, pwptr, buf, buflen);
@@ -210,7 +210,7 @@ copy_passwd(struct passwd *pw, struct passwd *pwptr, char *buf, int buflen) {
        
        if (len > buflen) {
                errno = ERANGE;
-               return (-1);
+               return (ERANGE);
        }
 
        /* copy fixed atomic values*/
index 468bb58d2fc087636977f4bb20c96b62ead8589f..a08c413b6f2ece54fd3854558b69340ed99a7d94 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: logging.c,v 1.1 2001/03/29 06:31:55 marka Exp $";
+static const char rcsid[] = "$Id: logging.c,v 1.2 2001/05/28 08:38:28 marka Exp $";
 #endif /* not lint */
 
 #include "port_before.h"
@@ -178,6 +178,19 @@ log_close_stream(log_channel chan) {
        return (0);
 }
 
+void
+log_close_debug_channels(log_context lc) {
+       log_channel_list lcl;
+       int i;
+
+       for (i = 0; i < lc->num_categories; i++)
+               for (lcl = lc->categories[i]; lcl != NULL; lcl = lcl->next)
+                       if (lcl->channel->type == log_file &&
+                           lcl->channel->out.file.stream != NULL &&
+                           lcl->channel->flags & LOG_REQUIRE_DEBUG)
+                               (void)log_close_stream(lcl->channel);
+}
+
 FILE *
 log_get_stream(log_channel chan) {
        if (chan == NULL || chan->type != log_file) {
index 323a384bd07f86cda385596e920bcda46ee614f9..cd2c0523a4a1d7b7bdfaa92ec111393d3c940cd0 100644 (file)
@@ -24,7 +24,7 @@
 
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: memcluster.c,v 1.1 2001/03/29 06:31:55 marka Exp $";
+static const char rcsid[] = "$Id: memcluster.c,v 1.2 2001/05/28 08:38:29 marka Exp $";
 #endif /* not lint */
 
 #include "port_before.h"
@@ -339,8 +339,9 @@ __memput_record(void *mem, size_t size, const char *file, int line) {
        size_t new_size = quantize(size);
 #if defined (DEBUGGING_MEMCLUSTER)
        memcluster_element *e;
+       memcluster_element *el;
 #ifdef MEMCLUSTER_RECORD
-       memcluster_element *prev, *el;
+       memcluster_element *prev;
 #endif
        int fp;
        char *p;
@@ -493,6 +494,18 @@ memstats(FILE *out) {
 #endif
 }
 
+int
+memactive(void) {
+       size_t i;
+
+       if (stats == NULL)
+               return (0);
+       for (i = 1; i <= max_size; i++)
+               if (stats[i].gets != 0)
+                       return (1);
+       return (0);
+}
+
 /* Private. */
 
 /* 
index c78bf5c5ae2dc783aacfe1cb66720bfdb306327d..03efb0cba0e15dda086ecf1011bb7bcb418e92f0 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #ifndef lint
-static const char rcsid[] = "$Id: ns_print.c,v 1.1 2001/03/29 06:31:57 marka Exp $";
+static const char rcsid[] = "$Id: ns_print.c,v 1.2 2001/05/28 08:38:30 marka Exp $";
 #endif
 
 /* Import. */
@@ -317,7 +317,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
                break;
 
        case ns_t_nsap: {
-               char t[255*3];
+               char t[2+255*3];
 
                (void) inet_nsap_ntoa(rdlen, rdata, t);
                T(addstr(t, strlen(t), &buf, &buflen));
index 1b49d8bcea6991ec8e1d9c6f89a7b2d9fc151da9..aa380913ae177d74810d35f2a39e601ecf65acd2 100644 (file)
@@ -70,7 +70,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_init.c   8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.5 2001/05/28 06:36:15 marka Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 1.6 2001/05/28 08:38:32 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "port_before.h"
@@ -382,7 +382,8 @@ __res_vinit(res_state statp, int preinit) {
                    continue;
                }
            }
-           if (nserv > 1) 
+
+           if (nserv > 1)
                statp->nscount = nserv;
 #ifdef RESOLVSORT
            statp->nsort = nsort;