Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/dist/bind/lib/irs Pull up revision 1.2 (requested by it...
details: https://anonhg.NetBSD.org/src/rev/c1c5e2a4f9c4
branches: netbsd-1-6
changeset: 528208:c1c5e2a4f9c4
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Jun 28 11:48:55 2002 +0000
description:
Pull up revision 1.2 (requested by itojun in ticket #387):
Update to BIND 8.3.3. Fixes buffer overrun in resolver code.
diffstat:
dist/bind/lib/irs/getnetent_r.c | 44 ++++++++++++++++++++++++++++++++++---
dist/bind/lib/irs/getnetgrent.c | 8 +++---
dist/bind/lib/irs/getnetgrent_r.c | 45 ++++++++++++++++++++++++++++++--------
dist/bind/lib/irs/getprotoent.c | 5 ++-
dist/bind/lib/irs/getprotoent_r.c | 39 ++++++++++++++++++++++++++++++---
dist/bind/lib/irs/getpwent_r.c | 42 +++++++++++++++++++++++++++--------
dist/bind/lib/irs/getservent.c | 5 ++-
dist/bind/lib/irs/getservent_r.c | 39 ++++++++++++++++++++++++++++++---
8 files changed, 187 insertions(+), 40 deletions(-)
diffs (truncated from 642 to 300 lines):
diff -r df646df31d72 -r c1c5e2a4f9c4 dist/bind/lib/irs/getnetent_r.c
--- a/dist/bind/lib/irs/getnetent_r.c Fri Jun 28 11:48:47 2002 +0000
+++ b/dist/bind/lib/irs/getnetent_r.c Fri Jun 28 11:48:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getnetent_r.c,v 1.1.1.1 1999/11/20 18:54:09 veego Exp $ */
+/* $NetBSD: getnetent_r.c,v 1.1.1.1.10.1 2002/06/28 11:48:55 lukem Exp $ */
/*
* Copyright (c) 1998-1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "Id: getnetent_r.c,v 8.4 1999/01/18 07:46:52 vixie Exp";
+static const char rcsid[] = "Id: getnetent_r.c,v 8.6 2001/11/01 08:02:11 marka Exp";
#endif /* LIBC_SCCS and not lint */
#include <port_before.h>
@@ -28,6 +28,7 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
+#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/param.h>
@@ -41,11 +42,22 @@
NET_R_RETURN
getnetbyname_r(const char *name, struct netent *nptr, NET_R_ARGS) {
struct netent *ne = getnetbyname(name);
+#ifdef NET_R_SETANSWER
+ int n = 0;
+ if (ne == NULL || (n = copy_netent(ne, nptr, NET_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = ne;
+ if (ne == NULL)
+ *h_errnop = h_errno;
+ return (n);
+#else
if (ne == NULL)
return (NET_R_BAD);
return (copy_netent(ne, nptr, NET_R_COPY));
+#endif
}
#ifndef GETNETBYADDR_ADDR_T
@@ -54,11 +66,23 @@
NET_R_RETURN
getnetbyaddr_r(GETNETBYADDR_ADDR_T addr, int type, struct netent *nptr, NET_R_ARGS) {
struct netent *ne = getnetbyaddr(addr, type);
+#ifdef NET_R_SETANSWER
+ int n = 0;
+
+ if (ne == NULL || (n = copy_netent(ne, nptr, NET_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = ne;
+ if (ne == NULL)
+ *h_errnop = h_errno;
+ return (n);
+#else
if (ne == NULL)
return (NET_R_BAD);
return (copy_netent(ne, nptr, NET_R_COPY));
+#endif
}
/*
@@ -70,11 +94,23 @@
NET_R_RETURN
getnetent_r(struct netent *nptr, NET_R_ARGS) {
struct netent *ne = getnetent();
+#ifdef NET_R_SETANSWER
+ int n = 0;
+
+ if (ne == NULL || (n = copy_netent(ne, nptr, NET_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = ne;
+ if (ne == NULL)
+ *h_errnop = h_errno;
+ return (n);
+#else
if (ne == NULL)
return (NET_R_BAD);
return (copy_netent(ne, nptr, NET_R_COPY));
+#endif
}
NET_R_SET_RETURN
@@ -119,7 +155,7 @@
len += strlen(ne->n_name) + 1;
len += numptr * sizeof(char*);
- if (len > buflen) {
+ if (len > (int)buflen) {
errno = ERANGE;
return (NET_R_BAD);
}
@@ -188,6 +224,6 @@
}
#endif /* !NETENT_DATA */
#else /* NET_R_RETURN */
- static int getnetent_r_unknown_systemm = 0;
+ static int getnetent_r_unknown_system = 0;
#endif /* NET_R_RETURN */
#endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */
diff -r df646df31d72 -r c1c5e2a4f9c4 dist/bind/lib/irs/getnetgrent.c
--- a/dist/bind/lib/irs/getnetgrent.c Fri Jun 28 11:48:47 2002 +0000
+++ b/dist/bind/lib/irs/getnetgrent.c Fri Jun 28 11:48:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getnetgrent.c,v 1.1.1.1 1999/11/20 18:54:09 veego Exp $ */
+/* $NetBSD: getnetgrent.c,v 1.1.1.1.10.1 2002/06/28 11:49:04 lukem Exp $ */
/*
* Copyright (c) 1996,1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "Id: getnetgrent.c,v 1.14 1999/10/07 20:44:03 vixie Exp";
+static const char rcsid[] = "Id: getnetgrent.c,v 1.15 2001/05/29 05:48:49 marka Exp";
#endif /* LIBC_SCCS and not lint */
/* Imports */
@@ -72,7 +72,7 @@
}
int
-getnetgrent(char **host, char **user, char **domain) {
+getnetgrent(const char **host, const char **user, const char **domain) {
struct net_data *net_data = init();
return (getnetgrent_p(host, user, domain, net_data));
@@ -111,7 +111,7 @@
}
int
-getnetgrent_p(char **host, char **user, char **domain,
+getnetgrent_p(const char **host, const char **user, const char **domain,
struct net_data *net_data ) {
struct irs_ng *ng;
diff -r df646df31d72 -r c1c5e2a4f9c4 dist/bind/lib/irs/getnetgrent_r.c
--- a/dist/bind/lib/irs/getnetgrent_r.c Fri Jun 28 11:48:47 2002 +0000
+++ b/dist/bind/lib/irs/getnetgrent_r.c Fri Jun 28 11:48:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getnetgrent_r.c,v 1.1.1.1 1999/11/20 18:54:09 veego Exp $ */
+/* $NetBSD: getnetgrent_r.c,v 1.1.1.1.10.1 2002/06/28 11:49:12 lukem Exp $ */
/*
* Copyright (c) 1998-1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "Id: getnetgrent_r.c,v 8.4 1999/01/18 07:46:52 vixie Exp";
+static const char rcsid[] = "Id: getnetgrent_r.c,v 8.6 2001/11/01 08:02:12 marka Exp";
#endif /* LIBC_SCCS and not lint */
#include <port_before.h>
@@ -28,15 +28,18 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
+#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
+#include <netgroup.h>
+#include <stdlib.h>
#include <port_after.h>
#ifdef NGR_R_RETURN
static NGR_R_RETURN
-copy_protoent(char **, char **, char **, char *, char *, char *,
- NGR_R_COPY_ARGS);
+copy_protoent(char **, char **, char **, const char *, const char *,
+ const char *, NGR_R_COPY_ARGS);
NGR_R_RETURN
innetgr_r(const char *netgroup, const char *host, const char *user,
@@ -53,7 +56,7 @@
NGR_R_RETURN
getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS) {
- char *mp, *up, *dp;
+ const char *mp, *up, *dp;
int res = getnetgrent(&mp, &up, &dp);
if (res != 1)
@@ -71,14 +74,27 @@
#endif
{
setnetgrent(netgroup);
+#ifdef NGR_R_PRIVATE
+ *buf = NULL;
+#endif
#ifdef NGR_R_SET_RESULT
return (NGR_R_SET_RESULT);
#endif
}
NGR_R_END_RETURN
-endnetgrent_r(NGR_R_ENT_ARGS) {
+#ifdef NGR_R_ENT_ARGS
+endnetgrent_r(NGR_R_ENT_ARGS)
+#else
+endnetgrent_r(void)
+#endif
+{
endnetgrent();
+#ifdef NGR_R_PRIVATE
+ if (*buf != NULL)
+ free(*buf);
+ *buf = NULL;
+#endif
NGR_R_END_RESULT(NGR_R_OK);
}
@@ -86,9 +102,10 @@
static int
copy_protoent(char **machinep, char **userp, char **domainp,
- char *mp, char *up, char *dp, NGR_R_COPY_ARGS) {
+ const char *mp, const char *up, const char *dp,
+ NGR_R_COPY_ARGS) {
char *cp;
- int i, n;
+ int n;
int len;
/* Find out the amount of space required to store the answer. */
@@ -97,12 +114,20 @@
if (up != NULL) len += strlen(up) + 1;
if (dp != NULL) len += strlen(dp) + 1;
- if (len > buflen) {
+#ifdef NGR_R_PRIVATE
+ free(*buf);
+ *buf = malloc(len);
+ if (*buf == NULL)
+ return(NGR_R_BAD);
+ cp = *buf;
+#else
+ if (len > (int)buflen) {
errno = ERANGE;
return (NGR_R_BAD);
}
+ cp = buf;
+#endif
- cp = buf;
if (mp != NULL) {
n = strlen(mp) + 1;
diff -r df646df31d72 -r c1c5e2a4f9c4 dist/bind/lib/irs/getprotoent.c
--- a/dist/bind/lib/irs/getprotoent.c Fri Jun 28 11:48:47 2002 +0000
+++ b/dist/bind/lib/irs/getprotoent.c Fri Jun 28 11:48:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getprotoent.c,v 1.1.1.1 1999/11/20 18:54:09 veego Exp $ */
+/* $NetBSD: getprotoent.c,v 1.1.1.1.10.1 2002/06/28 11:49:21 lukem Exp $ */
/*
* Copyright (c) 1996,1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "Id: getprotoent.c,v 1.15 1999/10/13 16:39:31 vixie Exp";
+static const char rcsid[] = "Id: getprotoent.c,v 1.16 2001/11/01 07:34:33 marka Exp";
#endif
/* Imports */
@@ -35,6 +35,7 @@
#include <errno.h>
#include <resolv.h>
#include <stdio.h>
+#include <string.h>
#include <irs.h>
diff -r df646df31d72 -r c1c5e2a4f9c4 dist/bind/lib/irs/getprotoent_r.c
--- a/dist/bind/lib/irs/getprotoent_r.c Fri Jun 28 11:48:47 2002 +0000
+++ b/dist/bind/lib/irs/getprotoent_r.c Fri Jun 28 11:48:55 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getprotoent_r.c,v 1.1.1.1 1999/11/20 18:54:09 veego Exp $ */
+/* $NetBSD: getprotoent_r.c,v 1.1.1.1.10.1 2002/06/28 11:49:29 lukem Exp $ */
/*
* Copyright (c) 1998-1999 by Internet Software Consortium.
@@ -18,7 +18,7 @@
*/
Home |
Main Index |
Thread Index |
Old Index