[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r4642 - in glibc-package/trunk/debian: . patches patches/any



Author: aurel32
Date: 2011-05-08 18:47:05 +0000 (Sun, 08 May 2011)
New Revision: 4642

Added:
   glibc-package/trunk/debian/patches/any/cvs-resolv-tld.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
  * Add patches/any/cvs-resolv-tld.diff from upstream to fix resolution
    of unqualified domain names.



Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2011-05-08 18:46:56 UTC (rev 4641)
+++ glibc-package/trunk/debian/changelog	2011-05-08 18:47:05 UTC (rev 4642)
@@ -2,6 +2,8 @@
 
   * patches/any/local-no-pagesize.diff: use __sysconf() instead of 
     sysconf().
+  * Add patches/any/cvs-resolv-tld.diff from upstream to fix resolution
+    of unqualified domain names.
 
  -- Aurelien Jarno <aurel32@debian.org>  Wed, 04 May 2011 19:53:33 +0200
 

Added: glibc-package/trunk/debian/patches/any/cvs-resolv-tld.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/cvs-resolv-tld.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/any/cvs-resolv-tld.diff	2011-05-08 18:47:05 UTC (rev 4642)
@@ -0,0 +1,132 @@
+2011-05-07  Ulrich Drepper  <drepper@gmail.com>
+
+	[BZ #12734]
+	* resolv/resolv.h: Define RES_NOTLDQUERY.
+	* resolv/res_init.c (res_setoptions): Recognize no_tld_query and
+	no-tld-query and set RES_NOTLDQUERY.
+	* resolv/res_debug.c (p_option): Handle RES_NOTLDQUERY.
+	* resolv/res_query.c (__libc_res_nsearch): Backport changes from
+	modern BIND to search name as TLD unless forbidden.
+ 
+diff --git a/resolv/res_debug.c b/resolv/res_debug.c
+index f7996a7..3daa44e 100644
+--- a/resolv/res_debug.c
++++ b/resolv/res_debug.c
+@@ -189,7 +189,7 @@ do_section(const res_state statp,
+ 						buf = malloc(buflen += 1024);
+ 					if (buf == NULL) {
+ 						fprintf(file,
+-				              ";; memory allocation failure\n");
++					      ";; memory allocation failure\n");
+ 					      return;
+ 					}
+ 					continue;
+@@ -356,7 +356,7 @@ const struct res_sym __p_class_syms[] = {
+ 	{C_HS,		"HESIOD"},
+ 	{C_ANY,		"ANY"},
+ 	{C_NONE,	"NONE"},
+-	{C_IN, 		(char *)0}
++	{C_IN,		(char *)0}
+ };
+ libresolv_hidden_data_def (__p_class_syms)
+ 
+@@ -588,6 +588,7 @@ p_option(u_long option) {
+ 	case RES_USEBSTRING:	return "ip6-bytstring";
+ 	case RES_USE_EDNS0:	return "edns0";
+ 	case RES_USE_DNSSEC:	return "dnssec";
++	case RES_NOTLDQUERY:	return "no-tld-query";
+ 				/* XXX nonreentrant */
+ 	default:		sprintf(nbuf, "?0x%lx?", (u_long)option);
+ 				return (nbuf);
+diff --git a/resolv/res_init.c b/resolv/res_init.c
+index 74715f3..7588432 100644
+--- a/resolv/res_init.c
++++ b/resolv/res_init.c
+@@ -545,6 +545,11 @@ res_setoptions(res_state statp, const char *options, const char *source) {
+ 		} else if (!strncmp(cp, "single-request",
+ 				    sizeof("single-request") - 1)) {
+ 			statp->options |= RES_SNGLKUP;
++		} else if (!strncmp(cp, "no_tld_query",
++				    sizeof("no_tld_query") - 1) ||
++			   !strncmp(cp, "no-tld-query",
++				    sizeof("no-tld-query") - 1)) {
++			statp->options |= RES_NOTLDQUERY;
+ 		} else {
+ 			/* XXX - print a warning here? */
+ 		}
+diff --git a/resolv/res_query.c b/resolv/res_query.c
+index 5ff352e..26daf0d 100644
+--- a/resolv/res_query.c
++++ b/resolv/res_query.c
+@@ -123,7 +123,7 @@ __libc_res_nquery(res_state statp,
+ {
+ 	HEADER *hp = (HEADER *) answer;
+ 	int n, use_malloc = 0;
+-        u_int oflags = statp->_flags;
++	u_int oflags = statp->_flags;
+ 
+ 	size_t bufsize = (type == T_UNSPEC ? 2 : 1) * QUERYSIZE;
+ 	u_char *buf = alloca (bufsize);
+@@ -210,7 +210,7 @@ __libc_res_nquery(res_state statp,
+ 			if (statp->options & RES_DEBUG)
+ 				printf(";; res_nquery: retry without EDNS0\n");
+ #endif
+-                        goto again;
++			goto again;
+ 		}
+ #ifdef DEBUG
+ 		if (statp->options & RES_DEBUG)
+@@ -344,6 +344,7 @@ __libc_res_nsearch(res_state statp,
+ 	int trailing_dot, ret, saved_herrno;
+ 	int got_nodata = 0, got_servfail = 0, root_on_list = 0;
+ 	int tried_as_is = 0;
++	int searched = 0;
+ 
+ 	__set_errno (0);
+ 	RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);  /* True if we never query. */
+@@ -406,6 +407,7 @@ __libc_res_nsearch(res_state statp,
+ 		for (domain = (const char * const *)statp->dnsrch;
+ 		     *domain && !done;
+ 		     domain++) {
++			searched = 1;
+ 
+ 			if (domain[0][0] == '\0' ||
+ 			    (domain[0][0] == '.' && domain[0][1] == '\0'))
+@@ -477,11 +479,11 @@ __libc_res_nsearch(res_state statp,
+ 	}
+ 
+ 	/*
+-	 * If the name has any dots at all, and no earlier 'as-is' query
+-	 * for the name, and "." is not on the search list, then try an as-is
+-	 * query now.
++	 * f the query has not already been tried as is then try it
++	 * unless RES_NOTLDQUERY is set and there were no dots.
+ 	 */
+-	if (dots && !(tried_as_is || root_on_list)) {
++	if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0)
++	    && !(tried_as_is || root_on_list)) {
+ 		ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
+ 					      answer, anslen, answerp,
+ 					      answerp2, nanswerp2, resplen2);
+diff --git a/resolv/resolv.h b/resolv/resolv.h
+index e49c29d..ed15a70 100644
+--- a/resolv/resolv.h
++++ b/resolv/resolv.h
+@@ -102,7 +102,7 @@ typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *__ns,
+ # define RES_MAXTIME		65535	/* Infinity, in milliseconds. */
+ 
+ struct __res_state {
+-	int	retrans;	 	/* retransmition time interval */
++	int	retrans;		/* retransmition time interval */
+ 	int	retry;			/* number of times to retransmit */
+ 	u_long	options;		/* option flags - see below. */
+ 	int	nscount;		/* number of name servers */
+@@ -219,6 +219,8 @@ struct res_sym {
+ #define RES_SNGLKUPREOP	0x00400000	/* -"-, but open new socket for each
+ 					   request */
+ #define RES_USE_DNSSEC	0x00800000	/* use DNSSEC using OK bit in OPT */
++#define RES_NOTLDQUERY	0x01000000	/* Do not look up unqualified name
++					   as a TLD.  */
+ 
+ #define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+ 

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2011-05-08 18:46:56 UTC (rev 4641)
+++ glibc-package/trunk/debian/patches/series	2011-05-08 18:47:05 UTC (rev 4642)
@@ -248,3 +248,4 @@
 any/cvs-fopen.diff
 any/submitted-fwrite-wur.diff
 any/local-dl-deps.diff
+any/cvs-resolv-tld.diff


Reply to: