Print this page
1926 libresolv evades compiler warnings

*** 1,6 **** --- 1,7 ---- /* + * Copyright 2015 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /*
*** 21,34 **** --- 22,37 ---- #include <netinet/in.h> #include <ctype.h> #include <netdb.h> #include <stdio.h> #include <errno.h> + #include <string.h> #include <arpa/inet.h> #include <arpa/nameser.h> #include <resolv.h> #include <syslog.h> + #include "crossl.h" /* * When the name service switch calls libresolv, it doesn't want fallback * to /etc/hosts, so we provide a method to turn it off. */
*** 101,112 **** bp = hostbuf; buflen = sizeof (hostbuf); cp = answer->buf + sizeof (HEADER); if (qdcount) { if (iquery) { ! if ((n = dn_expand((char *)answer->buf, eom, ! cp, bp, buflen)) < 0) { h_errno = NO_RECOVERY; return ((struct hostent *) NULL); } cp += n + QFIXEDSZ; host.h_name = bp; --- 104,115 ---- bp = hostbuf; buflen = sizeof (hostbuf); cp = answer->buf + sizeof (HEADER); if (qdcount) { if (iquery) { ! if ((n = dn_expand(answer->buf, eom, ! cp, (u_char *)bp, buflen)) < 0) { h_errno = NO_RECOVERY; return ((struct hostent *) NULL); } cp += n + QFIXEDSZ; host.h_name = bp;
*** 130,141 **** #if BSD >= 43 || defined(h_addr) /* new-style hostent structure */ host.h_addr_list = h_addr_ptrs; #endif haveanswer = 0; while (--ancount >= 0 && cp < eom && haveanswer < MAXADDRS) { ! if ((n = dn_expand((char *)answer->buf, eom, ! cp, bp, buflen)) < 0) break; cp += n; type = _getshort(cp); cp += sizeof (u_short); class = _getshort(cp); --- 133,144 ---- #if BSD >= 43 || defined(h_addr) /* new-style hostent structure */ host.h_addr_list = h_addr_ptrs; #endif haveanswer = 0; while (--ancount >= 0 && cp < eom && haveanswer < MAXADDRS) { ! if ((n = dn_expand(answer->buf, eom, ! cp, (u_char *)bp, buflen)) < 0) break; cp += n; type = _getshort(cp); cp += sizeof (u_short); class = _getshort(cp);
*** 151,162 **** bp += n; buflen -= n; continue; } if (iquery && type == T_PTR) { ! if ((n = dn_expand((char *)answer->buf, eom, ! cp, bp, buflen)) < 0) { cp += n; continue; } cp += n; host.h_name = bp; --- 154,165 ---- bp += n; buflen -= n; continue; } if (iquery && type == T_PTR) { ! if ((n = dn_expand(answer->buf, eom, ! cp, (u_char *)bp, buflen)) < 0) { cp += n; continue; } cp += n; host.h_name = bp;
*** 229,239 **** char *name; { querybuf buf; register char *cp; int n; - struct hostent *hp, *gethostdomain(); /* * disallow names consisting only of digits/dots, unless * they end in a dot. */ --- 232,241 ----
*** 279,289 **** (void) sprintf(qbuf, "%d.%d.%d.%d.in-addr.arpa", ((unsigned)addr[3] & 0xff), ((unsigned)addr[2] & 0xff), ((unsigned)addr[1] & 0xff), ((unsigned)addr[0] & 0xff)); ! n = res_query(qbuf, C_IN, T_PTR, (char *)&buf, sizeof (buf)); if (n < 0) { #ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_query failed\n"); #endif --- 281,291 ---- (void) sprintf(qbuf, "%d.%d.%d.%d.in-addr.arpa", ((unsigned)addr[3] & 0xff), ((unsigned)addr[2] & 0xff), ((unsigned)addr[1] & 0xff), ((unsigned)addr[0] & 0xff)); ! n = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof (buf)); if (n < 0) { #ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_query failed\n"); #endif