2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 23:55:27 +00:00

sync multiple changes from BIND 8.

This commit is contained in:
Mark Andrews
2001-05-28 08:38:32 +00:00
parent 7ca2d9c6ed
commit b96a1d9fa3
10 changed files with 60 additions and 18 deletions

View File

@@ -72,6 +72,7 @@ typedef struct log_channel *log_channel;
#define log_dec_references __log_dec_references #define log_dec_references __log_dec_references
#define log_get_channel_type __log_get_channel_type #define log_get_channel_type __log_get_channel_type
#define log_free_channel __log_free_channel #define log_free_channel __log_free_channel
#define log_close_debug_channels __log_close_debug_channels
FILE * log_open_stream(log_channel); FILE * log_open_stream(log_channel);
int log_close_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); int log_dec_references(log_channel);
log_channel_type log_get_channel_type(log_channel); log_channel_type log_get_channel_type(log_channel);
int log_free_channel(log_channel); int log_free_channel(log_channel);
void log_close_debug_channels(log_context);
#endif /* !LOGGING_H */ #endif /* !LOGGING_H */

View File

@@ -34,6 +34,7 @@
#endif /*MEMCLUSTER_RECORD*/ #endif /*MEMCLUSTER_RECORD*/
#endif /*MEMCLUSTER_DEBUG*/ #endif /*MEMCLUSTER_DEBUG*/
#define memstats __memstats #define memstats __memstats
#define memactive __memactive
int meminit(size_t, size_t); int meminit(size_t, size_t);
void * __memget(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 * __memget_record(size_t, const char *, int);
void __memput_record(void *, size_t, const char *, int); void __memput_record(void *, size_t, const char *, int);
void memstats(FILE *); void memstats(FILE *);
int memactive(void);
#endif /* MEMCLUSTER_H */ #endif /* MEMCLUSTER_H */

View File

@@ -50,7 +50,7 @@
/* /*
* @(#)resolv.h 8.1 (Berkeley) 6/2/93 * @(#)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_ #ifndef _RESOLV_H_
@@ -98,7 +98,9 @@
#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) #define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
struct __res_state; /* forward */ struct __res_state; /* forward */
__BEGIN_DECLS
void __h_errno_set(struct __res_state *res, int err); void __h_errno_set(struct __res_state *res, int err);
__END_DECLS
/* /*
* Resolver configuration file. * Resolver configuration file.
@@ -250,7 +252,9 @@ typedef struct __res_state *res_state;
/* Things involving an internal (static) resolver context. */ /* Things involving an internal (static) resolver context. */
#ifdef _REENTRANT #ifdef _REENTRANT
__BEGIN_DECLS
extern struct __res_state *__res_state(void); extern struct __res_state *__res_state(void);
__END_DECLS
#define _res (*__res_state()) #define _res (*__res_state())
#else #else
#ifndef __BIND_NOSTATIC #ifndef __BIND_NOSTATIC

View File

@@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* LIBC_SCCS and not lint */
#include "port_before.h" #include "port_before.h"
@@ -44,6 +44,10 @@ inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
u_char c, nib; u_char c, nib;
u_int len = 0; 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) { while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
if (c == '.' || c == '+' || c == '/') if (c == '.' || c == '+' || c == '/')
continue; continue;
@@ -75,7 +79,7 @@ char *
inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) { inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
int nib; int nib;
int i; int i;
static char tmpbuf[255*3]; static char tmpbuf[2+255*3];
char *start; char *start;
if (ascii) if (ascii)
@@ -85,6 +89,9 @@ inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
start = tmpbuf; start = tmpbuf;
} }
*ascii++ = '0';
*ascii++ = 'x';
if (binlen > 255) if (binlen > 255)
binlen = 255; binlen = 255;

View File

@@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* LIBC_SCCS and not lint */
#include <port_before.h> #include <port_before.h>
@@ -59,7 +59,7 @@ getgrnam_r(const char *name, struct group *gptr,
if (ge == NULL) { if (ge == NULL) {
*result = NULL; *result = NULL;
return (-1); return (0);
} }
res = copy_group(ge, gptr, buf, buflen); res = copy_group(ge, gptr, buf, buflen);
@@ -96,7 +96,7 @@ getgrgid_r(gid_t gid, struct group *gptr,
if (ge == NULL) { if (ge == NULL) {
*result = NULL; *result = NULL;
return (-1); return (0);
} }
res = copy_group(ge, gptr, buf, buflen); 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) { if (len > buflen) {
errno = ERANGE; errno = ERANGE;
return (-1); return (ERANGE);
} }
/* copy group id */ /* copy group id */

View File

@@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #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 */ #endif /* LIBC_SCCS and not lint */
#include <port_before.h> #include <port_before.h>
@@ -58,7 +58,7 @@ getpwnam_r(const char *login, struct passwd *pwptr,
if (pw == NULL) { if (pw == NULL) {
*result = NULL; *result = NULL;
return (-1); return (0);
} }
res = copy_passwd(pw, pwptr, buf, buflen); res = copy_passwd(pw, pwptr, buf, buflen);
@@ -95,7 +95,7 @@ getpwuid_r(uid_t uid, struct passwd *pwptr,
if (pw == NULL) { if (pw == NULL) {
*result = NULL; *result = NULL;
return (-1); return (0);
} }
res = copy_passwd(pw, pwptr, buf, buflen); 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) { if (len > buflen) {
errno = ERANGE; errno = ERANGE;
return (-1); return (ERANGE);
} }
/* copy fixed atomic values*/ /* copy fixed atomic values*/

View File

@@ -16,7 +16,7 @@
*/ */
#if !defined(LINT) && !defined(CODECENTER) #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 */ #endif /* not lint */
#include "port_before.h" #include "port_before.h"
@@ -178,6 +178,19 @@ log_close_stream(log_channel chan) {
return (0); 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 * FILE *
log_get_stream(log_channel chan) { log_get_stream(log_channel chan) {
if (chan == NULL || chan->type != log_file) { if (chan == NULL || chan->type != log_file) {

View File

@@ -24,7 +24,7 @@
#if !defined(LINT) && !defined(CODECENTER) #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 */ #endif /* not lint */
#include "port_before.h" #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); size_t new_size = quantize(size);
#if defined (DEBUGGING_MEMCLUSTER) #if defined (DEBUGGING_MEMCLUSTER)
memcluster_element *e; memcluster_element *e;
memcluster_element *el;
#ifdef MEMCLUSTER_RECORD #ifdef MEMCLUSTER_RECORD
memcluster_element *prev, *el; memcluster_element *prev;
#endif #endif
int fp; int fp;
char *p; char *p;
@@ -493,6 +494,18 @@ memstats(FILE *out) {
#endif #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. */ /* Private. */
/* /*

View File

@@ -16,7 +16,7 @@
*/ */
#ifndef lint #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 #endif
/* Import. */ /* Import. */
@@ -317,7 +317,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
break; break;
case ns_t_nsap: { case ns_t_nsap: {
char t[255*3]; char t[2+255*3];
(void) inet_nsap_ntoa(rdlen, rdata, t); (void) inet_nsap_ntoa(rdlen, rdata, t);
T(addstr(t, strlen(t), &buf, &buflen)); T(addstr(t, strlen(t), &buf, &buflen));

View File

@@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; 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 */ #endif /* LIBC_SCCS and not lint */
#include "port_before.h" #include "port_before.h"
@@ -382,7 +382,8 @@ __res_vinit(res_state statp, int preinit) {
continue; continue;
} }
} }
if (nserv > 1)
if (nserv > 1)
statp->nscount = nserv; statp->nscount = nserv;
#ifdef RESOLVSORT #ifdef RESOLVSORT
statp->nsort = nsort; statp->nsort = nsort;