From: downsj Date: Fri, 14 Mar 1997 03:40:30 +0000 (+0000) Subject: Switch to linking with the resolver in libc. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f0376d9d81a0ab76b4a1056045b21ed958190723;p=openbsd Switch to linking with the resolver in libc. Pull a few of our changes into this resolver; don't delete it yet. I'm not entirely sure it should be deleted, simply because of the baseline it provides against our massivelt modified libc resolver. --- diff --git a/usr.sbin/named/Makefile b/usr.sbin/named/Makefile index eafd39ac875..d4be17b6a14 100644 --- a/usr.sbin/named/Makefile +++ b/usr.sbin/named/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.4 1997/03/12 11:30:34 downsj Exp $ +# $OpenBSD: Makefile,v 1.5 1997/03/14 03:40:30 downsj Exp $ # $NetBSD: Makefile,v 1.7 1996/02/02 15:25:33 mrg Exp $ # from $Id: Makefile,v 8.1 1994/12/15 06:23:43 vixie Exp -SUBDIR= libresolv named named-xfer ndc reload restart dig nslookup \ +SUBDIR= named named-xfer ndc reload restart dig nslookup \ host dnsquery addr VER= 4.9.5-P1 diff --git a/usr.sbin/named/Makefile.inc b/usr.sbin/named/Makefile.inc index a8c74a6e67b..bf15380cd37 100644 --- a/usr.sbin/named/Makefile.inc +++ b/usr.sbin/named/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.4 1997/03/13 08:57:57 downsj Exp $ +# $OpenBSD: Makefile.inc,v 1.5 1997/03/14 03:40:31 downsj Exp $ # $NetBSD: Makefile.inc,v 1.1 1996/02/02 15:25:35 mrg Exp $ # from: $Id: Makefile.inc,v 8.3 1995/12/31 23:28:00 vixie Exp @@ -12,11 +12,7 @@ PS= ps IOT= ABRT CONFIG?= -DUSE_OPTIONS_H -INCLUDE?= -I${.CURDIR} -I${BIND_DIR} -I${BIND_DIR}/include +INCLUDE?= -I${.CURDIR} -I${BIND_DIR} -# we need to use our version of libresolv. -.if exists(${BIND_DIR}/libresolv/${__objdir}) -LIBRESOLV= ${BIND_DIR}/libresolv/${__objdir}/libresolv.a -.else -LIBRESOLV= ${BIND_DIR}/libresolv/libresolv.a -.endif +# It's in libc now. +LIBRESOLV= diff --git a/usr.sbin/named/dig/Makefile b/usr.sbin/named/dig/Makefile index a44e6404c8b..a85b88cf6e1 100644 --- a/usr.sbin/named/dig/Makefile +++ b/usr.sbin/named/dig/Makefile @@ -1,13 +1,13 @@ -# $OpenBSD: Makefile,v 1.3 1997/03/12 10:41:48 downsj Exp $ +# $OpenBSD: Makefile,v 1.4 1997/03/14 03:40:32 downsj Exp $ # $NetBSD: Makefile,v 1.2 1996/03/31 13:55:34 mrg Exp $ # from: $Id: Makefile,v 8.1 1994/12/15 06:23:45 vixie Exp .PATH: ${.CURDIR}/../nslookup \ - ${.CURDIR}/../libresolv \ + ${.CURDIR}/../../../lib/libc/net \ ${.CURDIR}/../man PROG= dig -SRCS= dig.c list.c subr.c debug.c send.c base64.c gethnamaddr.c res_comp.c \ +SRCS= dig.c list.c subr.c debug.c send.c base64.c gethostnamadr.c res_comp.c \ res_debug.c res_init.c res_mkquery.c res_query.c res_send.c \ inet_ntop.c inet_pton.c CFLAGS+=${INCLUDE} ${CONFIG} -DDEBUG diff --git a/usr.sbin/named/libresolv/res_init.c b/usr.sbin/named/libresolv/res_init.c index c9893bf0b27..c128e346290 100644 --- a/usr.sbin/named/libresolv/res_init.c +++ b/usr.sbin/named/libresolv/res_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_init.c,v 1.1 1997/03/12 10:42:09 downsj Exp $ */ +/* $OpenBSD: res_init.c,v 1.2 1997/03/14 03:40:33 downsj Exp $ */ /* * ++Copyright++ 1985, 1989, 1993 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: res_init.c,v 1.1 1997/03/12 10:42:09 downsj Exp $"; +static char rcsid[] = "$OpenBSD: res_init.c,v 1.2 1997/03/14 03:40:33 downsj Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -222,8 +222,9 @@ res_init() _res.pfcode = 0; /* Allow user to override the local domain definition */ - if ((cp = getenv("LOCALDOMAIN")) != NULL) { + if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) { (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); + _res.defdname[sizeof(_res.defdname) - 1] = '\0'; haveenv++; /* @@ -279,6 +280,7 @@ res_init() if ((*cp == '\0') || (*cp == '\n')) continue; strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); + _res.defdname[sizeof(_res.defdname) - 1] = '\0'; if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) *cp = '\0'; havesearch = 0; @@ -294,6 +296,7 @@ res_init() if ((*cp == '\0') || (*cp == '\n')) continue; strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); + _res.defdname[sizeof(_res.defdname) - 1] = '\0'; if ((cp = strchr(_res.defdname, '\n')) != NULL) *cp = '\0'; /* @@ -427,12 +430,15 @@ res_init() #endif /* !RFC1535 */ } - if ((cp = getenv("RES_OPTIONS")) != NULL) + if (issetugid()) + _res.options |= RES_NOALIASES; + else if ((cp = getenv("RES_OPTIONS")) != NULL) res_setoptions(cp, "env"); _res.options |= RES_INIT; return (0); } +/* ARGSUSED */ static void res_setoptions(options, source) char *options, *source; diff --git a/usr.sbin/named/libresolv/res_mkquery.c b/usr.sbin/named/libresolv/res_mkquery.c index 6bf04349bd7..5ca9671b94e 100644 --- a/usr.sbin/named/libresolv/res_mkquery.c +++ b/usr.sbin/named/libresolv/res_mkquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_mkquery.c,v 1.1 1997/03/12 10:42:10 downsj Exp $ */ +/* $OpenBSD: res_mkquery.c,v 1.2 1997/03/14 03:40:33 downsj Exp $ */ /* * ++Copyright++ 1985, 1993 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; static char rcsid[] = "$From: res_mkquery.c,v 8.5 1996/08/27 08:33:28 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.1 1997/03/12 10:42:10 downsj Exp $"; +static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.2 1997/03/14 03:40:33 downsj Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -86,6 +86,7 @@ static char rcsid[] = "$OpenBSD: res_mkquery.c,v 1.1 1997/03/12 10:42:10 downsj * Form all types of queries. * Returns the size of the result or -1. */ +/* ARGSUSED */ int res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) int op; /* opcode of query */ diff --git a/usr.sbin/named/libresolv/res_query.c b/usr.sbin/named/libresolv/res_query.c index 39882c90241..852572b1bec 100644 --- a/usr.sbin/named/libresolv/res_query.c +++ b/usr.sbin/named/libresolv/res_query.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_query.c,v 1.1 1997/03/12 10:42:10 downsj Exp $ */ +/* $OpenBSD: res_query.c,v 1.2 1997/03/14 03:40:34 downsj Exp $ */ /* * ++Copyright++ 1988, 1993 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; static char rcsid[] = "$From: res_query.c,v 8.9 1996/09/22 00:13:28 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: res_query.c,v 1.1 1997/03/12 10:42:10 downsj Exp $"; +static char rcsid[] = "$OpenBSD: res_query.c,v 1.2 1997/03/14 03:40:34 downsj Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -387,8 +387,8 @@ hostalias(name) break; for (cp2 = cp1 + 1; *cp2 && !isspace(*cp2); ++cp2) ; - abuf[sizeof(abuf) - 1] = *cp2 = '\0'; strncpy(abuf, cp1, sizeof(abuf) - 1); + abuf[sizeof(abuf) - 1] = *cp2 = '\0'; fclose(fp); return (abuf); }