Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 10421
Collapse All | Expand All

(-)glibc-2.2.5.orig/resolv/gethnamaddr.c (-8 / +26 lines)
Lines 115-124 Link Here
115
extern void addrsort __P((char **, int));
115
extern void addrsort __P((char **, int));
116
#endif
116
#endif
117
117
118
#if PACKETSZ > 1024
118
#if PACKETSZ > 65536
119
#define	MAXPACKET	PACKETSZ
119
#define	MAXPACKET	PACKETSZ
120
#else
120
#else
121
#define	MAXPACKET	1024
121
#define	MAXPACKET	65536
122
#endif
122
#endif
123
123
124
/* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length.  */
124
/* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length.  */
Lines 510-519 Link Here
510
	const char *name;
510
	const char *name;
511
	int af;
511
	int af;
512
{
512
{
513
	querybuf buf;
513
	querybuf *buf;
514
	register const char *cp;
514
	register const char *cp;
515
	char *bp;
515
	char *bp;
516
	int n, size, type, len;
516
	int n, size, type, len;
517
	struct hostent *ret;
517
	extern struct hostent *_gethtbyname2();
518
	extern struct hostent *_gethtbyname2();
518
519
519
	if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) == -1) {
520
	if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) == -1) {
Lines 615-627 Link Here
615
				break;
616
				break;
616
		}
617
		}
617
618
618
	if ((n = res_nsearch(&_res, name, C_IN, type, buf.buf, sizeof(buf.buf))) < 0) {
619
	buf = (querybuf *) malloc (sizeof (*buf));
620
	if (buf == NULL) {
621
		__set_h_errno (NETDB_INTERNAL);
622
		return NULL;
623
	}
624
625
	if ((n = res_nsearch(&_res, name, C_IN, type, buf->buf, sizeof(buf->buf))) < 0) {
626
		free (buf);
619
		dprintf("res_nsearch failed (%d)\n", n);
627
		dprintf("res_nsearch failed (%d)\n", n);
620
		if (errno == ECONNREFUSED)
628
		if (errno == ECONNREFUSED)
621
			return (_gethtbyname2(name, af));
629
			return (_gethtbyname2(name, af));
622
		return (NULL);
630
		return (NULL);
623
	}
631
	}
624
	return (getanswer(&buf, n, name, type));
632
	ret = getanswer(buf, n, name, type);
633
	free (buf);
634
	return ret;
625
}
635
}
626
636
627
struct hostent *
637
struct hostent *
Lines 634-640 Link Here
634
	static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
644
	static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
635
	static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
645
	static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
636
	int n, size;
646
	int n, size;
637
	querybuf buf;
647
	querybuf *buf;
638
	register struct hostent *hp;
648
	register struct hostent *hp;
639
	char qbuf[MAXDNAME+1], *qp;
649
	char qbuf[MAXDNAME+1], *qp;
640
#ifdef SUNSECURITY
650
#ifdef SUNSECURITY
Lines 695-708 Link Here
695
	default:
705
	default:
696
		abort();
706
		abort();
697
	}
707
	}
698
	n = res_nquery(&_res, qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
708
	buf = (querybuf *) malloc (sizeof (*buf));
709
	if (buf == NULL) {
710
		__set_h_errno (NETDB_INTERNAL);
711
		return NULL;
712
	}
713
	n = res_nquery(&_res, qbuf, C_IN, T_PTR, buf->buf, sizeof buf->buf);
699
	if (n < 0) {
714
	if (n < 0) {
715
		free (buf);
700
		dprintf("res_nquery failed (%d)\n", n);
716
		dprintf("res_nquery failed (%d)\n", n);
701
		if (errno == ECONNREFUSED)
717
		if (errno == ECONNREFUSED)
702
			return (_gethtbyaddr(addr, len, af));
718
			return (_gethtbyaddr(addr, len, af));
703
		return (NULL);
719
		return (NULL);
704
	}
720
	}
705
	if (!(hp = getanswer(&buf, n, qbuf, T_PTR)))
721
	hp = getanswer(buf, n, qbuf, T_PTR);
722
	free (buf);
723
	if (!hp)
706
		return (NULL);	/* h_errno was set by getanswer() */
724
		return (NULL);	/* h_errno was set by getanswer() */
707
#ifdef SUNSECURITY
725
#ifdef SUNSECURITY
708
	if (af == AF_INET) {
726
	if (af == AF_INET) {
(-)glibc-2.2.5.orig/resolv/nss_dns/dns-host.c (-14 / +36 lines)
Lines 92-101 Link Here
92
#define MAX_NR_ALIASES	48
92
#define MAX_NR_ALIASES	48
93
#define MAX_NR_ADDRS	48
93
#define MAX_NR_ADDRS	48
94
94
95
#if PACKETSZ > 1024
95
#if PACKETSZ > 65536
96
# define MAXPACKET	PACKETSZ
96
# define MAXPACKET	PACKETSZ
97
#else
97
#else
98
# define MAXPACKET	1024
98
# define MAXPACKET	65536
99
#endif
99
#endif
100
/* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length.  */
100
/* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length.  */
101
#ifdef MAXHOSTNAMELEN
101
#ifdef MAXHOSTNAMELEN
Lines 132-142 Link Here
132
			   char *buffer, size_t buflen, int *errnop,
132
			   char *buffer, size_t buflen, int *errnop,
133
			   int *h_errnop)
133
			   int *h_errnop)
134
{
134
{
135
  querybuf host_buffer;
135
  querybuf *host_buffer;
136
  char tmp[NS_MAXDNAME];
136
  char tmp[NS_MAXDNAME];
137
  int size, type, n;
137
  int size, type, n;
138
  const char *cp;
138
  const char *cp;
139
  int map = 0;
139
  int map = 0;
140
  enum nss_status status;
140
141
141
  if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
142
  if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
142
    return NSS_STATUS_UNAVAIL;
143
    return NSS_STATUS_UNAVAIL;
Lines 168-175 Link Here
168
      && (cp = res_hostalias (&_res, name, tmp, sizeof (tmp))) != NULL)
169
      && (cp = res_hostalias (&_res, name, tmp, sizeof (tmp))) != NULL)
169
    name = cp;
170
    name = cp;
170
171
171
  n = res_nsearch (&_res, name, C_IN, type, host_buffer.buf,
172
  host_buffer = (querybuf *) malloc (sizeof (querybuf));
172
		   sizeof (host_buffer.buf));
173
  if (host_buffer == NULL)
174
    {
175
      *errnop = ENOMEM;
176
      return NSS_STATUS_UNAVAIL;
177
    }
178
179
  n = res_nsearch (&_res, name, C_IN, type, host_buffer->buf,
180
		   sizeof (host_buffer->buf));
173
  if (n < 0)
181
  if (n < 0)
174
    {
182
    {
175
      enum nss_status status = (errno == ECONNREFUSED
183
      enum nss_status status = (errno == ECONNREFUSED
Lines 181-191 Link Here
181
	 by having the RES_USE_INET6 bit in _res.options set, we try
189
	 by having the RES_USE_INET6 bit in _res.options set, we try
182
	 another lookup.  */
190
	 another lookup.  */
183
      if (af == AF_INET6 && (_res.options & RES_USE_INET6))
191
      if (af == AF_INET6 && (_res.options & RES_USE_INET6))
184
	n = res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf,
192
	n = res_nsearch (&_res, name, C_IN, T_A, host_buffer->buf,
185
			 sizeof (host_buffer.buf));
193
			 sizeof (host_buffer->buf));
186
194
187
      if (n < 0)
195
      if (n < 0)
188
	return status;
196
	{
197
	  free (host_buffer);
198
	  return status;
199
	}
189
200
190
      map = 1;
201
      map = 1;
191
202
Lines 193-200 Link Here
193
      result->h_length = INADDRSZ;;
204
      result->h_length = INADDRSZ;;
194
    }
205
    }
195
206
196
  return getanswer_r (&host_buffer, n, name, type, result, buffer, buflen,
207
  status = getanswer_r (host_buffer, n, name, type, result, buffer, buflen,
197
		      errnop, h_errnop, map);
208
			errnop, h_errnop, map);
209
  free (host_buffer);
210
  return status;
198
}
211
}
199
212
200
213
Lines 232-238 Link Here
232
    char *h_addr_ptrs[MAX_NR_ADDRS + 1];
245
    char *h_addr_ptrs[MAX_NR_ADDRS + 1];
233
    char linebuffer[0];
246
    char linebuffer[0];
234
  } *host_data = (struct host_data *) buffer;
247
  } *host_data = (struct host_data *) buffer;
235
  querybuf host_buffer;
248
  querybuf *host_buffer;
236
  char qbuf[MAXDNAME+1], *qp;
249
  char qbuf[MAXDNAME+1], *qp;
237
  size_t size;
250
  size_t size;
238
  int n, status;
251
  int n, status;
Lines 289-305 Link Here
289
      break;
302
      break;
290
    }
303
    }
291
304
292
  n = res_nquery (&_res, qbuf, C_IN, T_PTR, (u_char *)host_buffer.buf,
305
  host_buffer = (querybuf *) malloc (sizeof (querybuf));
293
		  sizeof host_buffer);
306
  if (host_buffer == NULL)
307
    {
308
      *errnop = ENOMEM;
309
      return NSS_STATUS_UNAVAIL;
310
    }
311
312
  n = res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer->buf,
313
		  sizeof (host_buffer->buf));
294
  if (n < 0)
314
  if (n < 0)
295
    {
315
    {
296
      *h_errnop = h_errno;
316
      *h_errnop = h_errno;
297
      *errnop = errno;
317
      *errnop = errno;
318
      free (host_buffer);
298
      return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
319
      return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
299
    }
320
    }
300
321
301
  status = getanswer_r (&host_buffer, n, qbuf, T_PTR, result, buffer, buflen,
322
  status = getanswer_r (host_buffer, n, qbuf, T_PTR, result, buffer, buflen,
302
			errnop, h_errnop, 0 /* XXX */);
323
			errnop, h_errnop, 0 /* XXX */);
324
  free (host_buffer);
303
  if (status != NSS_STATUS_SUCCESS)
325
  if (status != NSS_STATUS_SUCCESS)
304
    {
326
    {
305
      *h_errnop = h_errno;
327
      *h_errnop = h_errno;
(-)glibc-2.2.5.orig/resolv/nss_dns/dns-network.c (-10 / +31 lines)
Lines 70-79 Link Here
70
#define MAX_NR_ALIASES	48
70
#define MAX_NR_ALIASES	48
71
71
72
72
73
#if PACKETSZ > 1024
73
#if PACKETSZ > 65536
74
#define MAXPACKET       PACKETSZ
74
#define MAXPACKET       PACKETSZ
75
#else
75
#else
76
#define MAXPACKET       1024
76
#define MAXPACKET       65536
77
#endif
77
#endif
78
78
79
79
Lines 110-136 Link Here
110
			 int *herrnop)
110
			 int *herrnop)
111
{
111
{
112
  /* Return entry for network with NAME.  */
112
  /* Return entry for network with NAME.  */
113
  querybuf net_buffer;
113
  querybuf *net_buffer;
114
  int anslen;
114
  int anslen;
115
  char *qbuf;
115
  char *qbuf;
116
  enum nss_status status;
116
117
117
  if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
118
  if ((_res.options & RES_INIT) == 0 && __res_ninit (&_res) == -1)
118
    return NSS_STATUS_UNAVAIL;
119
    return NSS_STATUS_UNAVAIL;
119
120
120
  qbuf = strdupa (name);
121
  qbuf = strdupa (name);
121
  anslen = res_nsearch (&_res, qbuf, C_IN, T_PTR, (u_char *) &net_buffer,
122
122
			sizeof (querybuf));
123
  net_buffer = (querybuf *) malloc (sizeof (querybuf));
124
  if (net_buffer == NULL)
125
    {
126
      *errnop = ENOMEM;
127
      return NSS_STATUS_UNAVAIL;
128
    }
129
130
  anslen = res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer->buf,
131
			sizeof (net_buffer->buf));
123
  if (anslen < 0)
132
  if (anslen < 0)
124
    {
133
    {
125
      /* Nothing found.  */
134
      /* Nothing found.  */
126
      *errnop = errno;
135
      *errnop = errno;
136
      free (net_buffer);
127
      return (errno == ECONNREFUSED
137
      return (errno == ECONNREFUSED
128
	      || errno == EPFNOSUPPORT
138
	      || errno == EPFNOSUPPORT
129
	      || errno == EAFNOSUPPORT)
139
	      || errno == EAFNOSUPPORT)
130
	? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
140
	? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
131
    }
141
    }
132
142
133
  return getanswer_r (&net_buffer, anslen, result, buffer, buflen, BYNAME);
143
  status = getanswer_r (net_buffer, anslen, result, buffer, buflen, BYNAME);
144
  free (net_buffer);
145
  return status;
134
}
146
}
135
147
136
148
Lines 141-147 Link Here
141
{
153
{
142
  /* Return entry for network with NAME.  */
154
  /* Return entry for network with NAME.  */
143
  enum nss_status status;
155
  enum nss_status status;
144
  querybuf net_buffer;
156
  querybuf *net_buffer;
145
  unsigned int net_bytes[4];
157
  unsigned int net_bytes[4];
146
  char qbuf[MAXDNAME];
158
  char qbuf[MAXDNAME];
147
  int cnt, anslen;
159
  int cnt, anslen;
Lines 180-198 Link Here
180
      break;
192
      break;
181
    }
193
    }
182
194
183
  anslen = res_nquery (&_res, qbuf, C_IN, T_PTR, (u_char *) &net_buffer,
195
  net_buffer = (querybuf *) malloc (sizeof (querybuf));
184
		       sizeof (querybuf));
196
  if (net_buffer == NULL)
197
    {
198
      *errnop = ENOMEM;
199
      return NSS_STATUS_UNAVAIL;
200
    }
201
202
  anslen = res_nquery (&_res, qbuf, C_IN, T_PTR, net_buffer->buf,
203
		       sizeof (net_buffer->buf));
185
  if (anslen < 0)
204
  if (anslen < 0)
186
    {
205
    {
187
      /* Nothing found.  */
206
      /* Nothing found.  */
188
      *errnop = errno;
207
      *errnop = errno;
208
      free (net_buffer);
189
      return (errno == ECONNREFUSED
209
      return (errno == ECONNREFUSED
190
	      || errno == EPFNOSUPPORT
210
	      || errno == EPFNOSUPPORT
191
	      || errno == EAFNOSUPPORT)
211
	      || errno == EAFNOSUPPORT)
192
	? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
212
	? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
193
    }
213
    }
194
214
195
  status = getanswer_r (&net_buffer, anslen, result, buffer, buflen, BYADDR);
215
  status = getanswer_r (net_buffer, anslen, result, buffer, buflen, BYADDR);
216
  free (net_buffer);
196
  if (status == NSS_STATUS_SUCCESS)
217
  if (status == NSS_STATUS_SUCCESS)
197
    {
218
    {
198
      /* Strip trailing zeros.  */
219
      /* Strip trailing zeros.  */
(-)glibc-2.2.5.orig/resolv/res_query.c (-4 / +12 lines)
Lines 85-94 Link Here
85
/* Options.  Leave them on. */
85
/* Options.  Leave them on. */
86
/* #undef DEBUG */
86
/* #undef DEBUG */
87
87
88
#if PACKETSZ > 1024
88
#if PACKETSZ > 65536
89
#define MAXPACKET	PACKETSZ
89
#define MAXPACKET	PACKETSZ
90
#else
90
#else
91
#define MAXPACKET	1024
91
#define MAXPACKET	65536
92
#endif
92
#endif
93
93
94
/*
94
/*
Lines 108-135 Link Here
108
	   u_char *answer,	/* buffer to put answer */
108
	   u_char *answer,	/* buffer to put answer */
109
	   int anslen)		/* size of answer buffer */
109
	   int anslen)		/* size of answer buffer */
110
{
110
{
111
	u_char buf[MAXPACKET];
111
	u_char *buf;
112
	HEADER *hp = (HEADER *) answer;
112
	HEADER *hp = (HEADER *) answer;
113
	int n;
113
	int n;
114
114
115
	hp->rcode = NOERROR;	/* default */
115
	hp->rcode = NOERROR;	/* default */
116
116
117
	buf = malloc (MAXPACKET);
118
	if (buf == NULL) {
119
		__set_h_errno (NETDB_INTERNAL);
120
		return -1;
121
	}
122
117
#ifdef DEBUG
123
#ifdef DEBUG
118
	if (statp->options & RES_DEBUG)
124
	if (statp->options & RES_DEBUG)
119
		printf(";; res_query(%s, %d, %d)\n", name, class, type);
125
		printf(";; res_query(%s, %d, %d)\n", name, class, type);
120
#endif
126
#endif
121
127
122
	n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL,
128
	n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL,
123
			 buf, sizeof(buf));
129
			 buf, MAXPACKET);
124
	if (n <= 0) {
130
	if (n <= 0) {
125
#ifdef DEBUG
131
#ifdef DEBUG
126
		if (statp->options & RES_DEBUG)
132
		if (statp->options & RES_DEBUG)
127
			printf(";; res_query: mkquery failed\n");
133
			printf(";; res_query: mkquery failed\n");
128
#endif
134
#endif
129
		RES_SET_H_ERRNO(statp, NO_RECOVERY);
135
		RES_SET_H_ERRNO(statp, NO_RECOVERY);
136
		free (buf);
130
		return (n);
137
		return (n);
131
	}
138
	}
132
	n = res_nsend(statp, buf, n, answer, anslen);
139
	n = res_nsend(statp, buf, n, answer, anslen);
140
	free (buf);
133
	if (n < 0) {
141
	if (n < 0) {
134
#ifdef DEBUG
142
#ifdef DEBUG
135
		if (statp->options & RES_DEBUG)
143
		if (statp->options & RES_DEBUG)

Return to bug 10421