summaryrefslogtreecommitdiffstats
path: root/contrib/bind/lib/resolv/res_update.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind/lib/resolv/res_update.c')
-rw-r--r--contrib/bind/lib/resolv/res_update.c50
1 files changed, 14 insertions, 36 deletions
diff --git a/contrib/bind/lib/resolv/res_update.c b/contrib/bind/lib/resolv/res_update.c
index 54d3b15..12ee326 100644
--- a/contrib/bind/lib/resolv/res_update.c
+++ b/contrib/bind/lib/resolv/res_update.c
@@ -1,5 +1,5 @@
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_update.c,v 1.31 2001/11/01 05:21:23 marka Exp $";
+static const char rcsid[] = "$Id: res_update.c,v 1.34 2002/04/12 06:28:52 marka Exp $";
#endif /* not lint */
/*
@@ -77,8 +77,6 @@ struct zonegrp {
/* Forward. */
-static int nscopy(union res_sockaddr_union *,
- const union res_sockaddr_union *, int);
static void res_dprintf(const char *, ...);
/* Macros. */
@@ -102,29 +100,21 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
/* Thread all of the updates onto a list of groups. */
INIT_LIST(zgrps);
+ memset(&tgrp, 0, sizeof (tgrp));
for (rrecp = rrecp_in; rrecp;
rrecp = LINKED(rrecp, r_link) ? NEXT(rrecp, r_link) : NULL) {
- struct in_addr nsaddrs[MAXNS];
- int i;
- /* XXX need to rewrite res_findzonecut */
- for (i = 0; i < MAXNS; i++) {
- nsaddrs[i].s_addr = 0;
- if (tgrp.z_nsaddrs[i].sin.sin_family == AF_INET)
- nsaddrs[i] = tgrp.z_nsaddrs[i].sin.sin_addr;
- }
+ int nscnt;
/* Find the origin for it if there is one. */
tgrp.z_class = rrecp->r_class;
- tgrp.z_nscount =
- res_findzonecut(statp, rrecp->r_dname, tgrp.z_class,
- RES_EXHAUSTIVE,
- tgrp.z_origin,
- sizeof tgrp.z_origin,
- nsaddrs, MAXNS);
- if (tgrp.z_nscount <= 0) {
- DPRINTF(("res_findzonecut failed (%d)",
- tgrp.z_nscount));
+ nscnt = res_findzonecut2(statp, rrecp->r_dname, tgrp.z_class,
+ RES_EXHAUSTIVE, tgrp.z_origin,
+ sizeof tgrp.z_origin,
+ tgrp.z_nsaddrs, MAXNS);
+ if (nscnt <= 0) {
+ DPRINTF(("res_findzonecut failed (%d)", nscnt));
goto done;
}
+ tgrp.z_nscount = nscnt;
/* Find the group for it if there is one. */
for (zptr = HEAD(zgrps); zptr != NULL; zptr = NEXT(zptr, z_link))
if (ns_samename(tgrp.z_origin, zptr->z_origin) == 1 &&
@@ -166,9 +156,8 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
goto done;
/* Temporarily replace the resolver's nameserver set. */
- nscount = nscopy(nsaddrs, statp->_u._ext.ext->nsaddrs, statp->nscount);
- statp->nscount = nscopy(statp->_u._ext.ext->nsaddrs,
- zptr->z_nsaddrs, zptr->z_nscount);
+ nscount = res_getservers(statp, nsaddrs, MAXNS);
+ res_setservers(statp, zptr->z_nsaddrs, zptr->z_nscount);
/* Send the update and remember the result. */
if (key != NULL)
@@ -185,7 +174,7 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
nzones++;
/* Restore resolver's nameserver set. */
- statp->nscount = nscopy(statp->_u._ext.ext->nsaddrs, nsaddrs, nscount);
+ res_setservers(statp, nsaddrs, nscount);
nscount = 0;
}
done:
@@ -197,24 +186,13 @@ res_nupdate(res_state statp, ns_updrec *rrecp_in, ns_tsig_key *key) {
free(zptr);
}
if (nscount != 0)
- statp->nscount = nscopy(statp->_u._ext.ext->nsaddrs, nsaddrs, nscount);
+ res_setservers(statp, nsaddrs, nscount);
return (nzones);
}
/* Private. */
-static int
-nscopy(union res_sockaddr_union *dst, const union res_sockaddr_union *src,
- int n)
-{
- int i;
-
- for (i = 0; i < n; i++)
- dst[i] = src[i];
- return (n);
-}
-
static void
res_dprintf(const char *fmt, ...) {
va_list ap;
OpenPOWER on IntegriCloud