resolv: Remove RESOLVSORT preprocess conditionals

This commit is contained in:
Florian Weimer 2016-04-28 11:27:49 +02:00
parent 561905e137
commit 74a6983155
4 changed files with 7 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2016-04-28 Florian Weimer <fweimer@redhat.com>
* resolv/gethnamaddr.c (RESOLVSORT): Do not define. Remove
RESOLVSORT preprocessor conditionals.
* resolv/nss_dns/dns-host.c: Likewise.
* resolv/res_init.c: Likewise.
2016-04-28 Florian Weimer <fweimer@redhat.com> 2016-04-28 Florian Weimer <fweimer@redhat.com>
* resolv/res_data.c: Remove code conditional on BIND_UPDATE. It * resolv/res_data.c: Remove code conditional on BIND_UPDATE. It

View File

@ -67,8 +67,6 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#define RESOLVSORT
#ifndef LOG_AUTH #ifndef LOG_AUTH
# define LOG_AUTH 0 # define LOG_AUTH 0
#endif #endif
@ -107,9 +105,7 @@ static int stayopen = 0;
static void map_v4v6_address (const char *src, char *dst) __THROW; static void map_v4v6_address (const char *src, char *dst) __THROW;
static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW; static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW;
#ifdef RESOLVSORT
extern void addrsort (char **, int) __THROW; extern void addrsort (char **, int) __THROW;
#endif
#if PACKETSZ > 65536 #if PACKETSZ > 65536
#define MAXPACKET PACKETSZ #define MAXPACKET PACKETSZ
@ -434,7 +430,6 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype)
if (haveanswer) { if (haveanswer) {
*ap = NULL; *ap = NULL;
*hap = NULL; *hap = NULL;
# if defined(RESOLVSORT)
/* /*
* Note: we sort even if host can take only one address * Note: we sort even if host can take only one address
* in its return structures - should give it the "best" * in its return structures - should give it the "best"
@ -442,7 +437,6 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype)
*/ */
if (_res.nsort && haveanswer > 1 && qtype == T_A) if (_res.nsort && haveanswer > 1 && qtype == T_A)
addrsort(h_addr_ptrs, haveanswer); addrsort(h_addr_ptrs, haveanswer);
# endif /*RESOLVSORT*/
if (!host.h_name) { if (!host.h_name) {
n = strlen(qname) + 1; /* for the \0 */ n = strlen(qname) + 1; /* for the \0 */
if (n > buflen || n >= MAXHOSTNAMELEN) if (n > buflen || n >= MAXHOSTNAMELEN)
@ -929,7 +923,6 @@ map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
} }
} }
#ifdef RESOLVSORT
extern void extern void
addrsort (char **ap, int num) addrsort (char **ap, int num)
{ {
@ -970,7 +963,6 @@ addrsort (char **ap, int num)
needsort++; needsort++;
} }
} }
#endif
#if defined(BSD43_BSD43_NFS) || defined(sun) #if defined(BSD43_BSD43_NFS) || defined(sun)
/* some libc's out there are bound internally to these names (UMIPS) */ /* some libc's out there are bound internally to these names (UMIPS) */

View File

@ -556,7 +556,6 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af,
errnop, h_errnop, NULL); errnop, h_errnop, NULL);
} }
#ifdef RESOLVSORT
static void addrsort (char **ap, int num); static void addrsort (char **ap, int num);
static void static void
@ -600,7 +599,6 @@ addrsort (char **ap, int num)
else else
break; break;
} }
#endif
static enum nss_status static enum nss_status
getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
@ -955,7 +953,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
{ {
*ap = NULL; *ap = NULL;
*hap = NULL; *hap = NULL;
#if defined RESOLVSORT
/* /*
* Note: we sort even if host can take only one address * Note: we sort even if host can take only one address
* in its return structures - should give it the "best" * in its return structures - should give it the "best"
@ -963,7 +960,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
*/ */
if (_res.nsort && haveanswer > 1 && qtype == T_A) if (_res.nsort && haveanswer > 1 && qtype == T_A)
addrsort (host_data->h_addr_ptrs, haveanswer); addrsort (host_data->h_addr_ptrs, haveanswer);
#endif /*RESOLVSORT*/
if (result->h_name == NULL) if (result->h_name == NULL)
{ {

View File

@ -85,18 +85,15 @@
#include <not-cancel.h> #include <not-cancel.h>
/* Options. Should all be left alone. */ /* Options. Should all be left alone. */
#define RESOLVSORT
#define RFC1535 #define RFC1535
/* #undef DEBUG */ /* #undef DEBUG */
static void res_setoptions (res_state, const char *, const char *) static void res_setoptions (res_state, const char *, const char *)
internal_function; internal_function;
#ifdef RESOLVSORT
static const char sort_mask_chars[] = "/&"; static const char sort_mask_chars[] = "/&";
#define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL) #define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL)
static u_int32_t net_mask (struct in_addr) __THROW; static u_int32_t net_mask (struct in_addr) __THROW;
#endif
#if !defined(isascii) /* XXX - could be a function */ #if !defined(isascii) /* XXX - could be a function */
# define isascii(c) (!(c & 0200)) # define isascii(c) (!(c & 0200))
@ -134,10 +131,8 @@ __res_vinit(res_state statp, int preinit) {
int have_serv6 = 0; int have_serv6 = 0;
int haveenv = 0; int haveenv = 0;
int havesearch = 0; int havesearch = 0;
#ifdef RESOLVSORT
int nsort = 0; int nsort = 0;
char *net; char *net;
#endif
#ifndef RFC1535 #ifndef RFC1535
int dots; int dots;
#endif #endif
@ -328,7 +323,6 @@ __res_vinit(res_state statp, int preinit) {
} }
continue; continue;
} }
#ifdef RESOLVSORT
if (MATCH(buf, "sortlist")) { if (MATCH(buf, "sortlist")) {
struct in_addr a; struct in_addr a;
@ -370,7 +364,6 @@ __res_vinit(res_state statp, int preinit) {
} }
continue; continue;
} }
#endif
if (MATCH(buf, "options")) { if (MATCH(buf, "options")) {
res_setoptions(statp, buf + sizeof("options") - 1, "conf"); res_setoptions(statp, buf + sizeof("options") - 1, "conf");
continue; continue;
@ -381,9 +374,7 @@ __res_vinit(res_state statp, int preinit) {
/* We try IPv6 servers again. */ /* We try IPv6 servers again. */
statp->ipv6_unavail = false; statp->ipv6_unavail = false;
} }
#ifdef RESOLVSORT
statp->nsort = nsort; statp->nsort = nsort;
#endif
(void) fclose(fp); (void) fclose(fp);
} }
if (__builtin_expect(statp->nscount == 0, 0)) { if (__builtin_expect(statp->nscount == 0, 0)) {
@ -524,7 +515,6 @@ res_setoptions(res_state statp, const char *options, const char *source) {
} }
} }
#ifdef RESOLVSORT
/* XXX - should really support CIDR which means explicit masks always. */ /* XXX - should really support CIDR which means explicit masks always. */
/* XXX - should really use system's version of this */ /* XXX - should really use system's version of this */
static u_int32_t static u_int32_t
@ -538,7 +528,6 @@ net_mask (struct in_addr in)
return (htonl(IN_CLASSB_NET)); return (htonl(IN_CLASSB_NET));
return (htonl(IN_CLASSC_NET)); return (htonl(IN_CLASSC_NET));
} }
#endif
u_int u_int
res_randomid(void) { res_randomid(void) {