rpms/bind/devel bind-9.5-libidn2.patch, NONE, 1.1 bind.spec, 1.235, 1.236 named.init, 1.62, 1.63

Adam Tkac (atkac) fedora-extras-commits at redhat.com
Tue Dec 11 12:24:12 UTC 2007


Author: atkac

Update of /cvs/pkgs/rpms/bind/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30313

Modified Files:
	bind.spec named.init 
Added Files:
	bind-9.5-libidn2.patch 
Log Message:
- fixed shutdown with initscript when rndc doesn't work (#417431)
- fixed IDN patch (#412241)


bind-9.5-libidn2.patch:

--- NEW FILE bind-9.5-libidn2.patch ---
diff -up bind-9.5.0b1/bin/dig/dighost.c.libidn2 bind-9.5.0b1/bin/dig/dighost.c
--- bind-9.5.0b1/bin/dig/dighost.c.libidn2	2007-12-10 13:12:26.000000000 +0100
+++ bind-9.5.0b1/bin/dig/dighost.c	2007-12-10 14:21:09.000000000 +0100
@@ -153,7 +153,7 @@ int  idnoptions	= 0;
 #endif
 
 #ifdef WITH_LIBIDN
-static isc_result_t	libidn_locale_to_utf8 (const char* from, char **to);
+static isc_result_t	libidn_locale_to_utf8 (const char* from, char *to);
 static isc_result_t	libidn_utf8_to_ascii (const char* from, char *to);
 static isc_result_t	output_filter (isc_buffer_t *buffer,
 				       unsigned int used_org,
@@ -1764,17 +1764,13 @@ setup_lookup(dig_lookup_t *lookup) {
 	char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
 #endif
 #ifdef WITH_LIBIDN
-	char *utf8_str = NULL, utf8_name[MXNAME], ascii_name[MXNAME];
+	char utf8_str[MXNAME], utf8_name[MXNAME], ascii_name[MXNAME];
 #endif
 
-#ifdef WITH_IDN
+#if defined (WITH_IDN) || defined (WITH_LIBIDN)
 	result = dns_name_settotextfilter(output_filter);
 	check_result(result, "dns_name_settotextfilter");
 #endif
-#ifdef WITH_LIBIDN
-	result = dns_name_settotextfilter (output_filter);
-	check_result(result, "dns_name_settotextfilter");
-#endif
 	REQUIRE(lookup != NULL);
 	INSIST(!free_now);
 
@@ -1812,15 +1808,13 @@ setup_lookup(dig_lookup_t *lookup) {
 			    utf8_textname, sizeof(utf8_textname));
 	idn_check_result(mr, "convert textname to UTF-8");
 #elif defined (WITH_LIBIDN)
-	result = libidn_locale_to_utf8 (lookup->textname, &utf8_str);
-	check_result (result, "converting textname to UTF-8");
+	result = libidn_locale_to_utf8 (lookup->textname, utf8_str);
+	check_result (result, "convert textname to UTF-8");
 	len = strlen (utf8_str);
-	if (len < MXNAME) {
+	if (len < MXNAME)
 		(void) strcpy (utf8_name, utf8_str);
-	} else {
+	else
 		fatal ("Too long name");
-	}
-	isc_mem_free (mctx, utf8_str);
 #endif
 
 	/*
@@ -1833,24 +1827,11 @@ setup_lookup(dig_lookup_t *lookup) {
 	if (lookup->new_search) {
 #ifdef WITH_IDN
 		if ((count_dots(utf8_textname) >= ndots) || !usesearch) {
-			lookup->origin = NULL; /* Force abs lookup */
-			lookup->done_as_is = ISC_TRUE;
-			lookup->need_search = usesearch;
-		} else if (lookup->origin == NULL && usesearch) {
-			lookup->origin = ISC_LIST_HEAD(search_list);
-			lookup->need_search = ISC_FALSE;
-		}
 #elif defined (WITH_LIBIDN)
 		if ((count_dots(utf8_name) >= ndots) || !usesearch) {
-			lookup->origin = NULL; /* Force abs lookup */
-			lookup->done_as_is = ISC_TRUE;
-			lookup->need_search = usesearch;
-		} else if (lookup->origin == NULL && usesearch) {
-			lookup->origin = ISC_LIST_HEAD(search_list);
-			lookup->need_search = ISC_FALSE;
-		}
 #else
 		if ((count_dots(lookup->textname) >= ndots) || !usesearch) {
+#endif
 			lookup->origin = NULL; /* Force abs lookup */
 			lookup->done_as_is = ISC_TRUE;
 			lookup->need_search = usesearch;
@@ -1858,7 +1839,6 @@ setup_lookup(dig_lookup_t *lookup) {
 			lookup->origin = ISC_LIST_HEAD(search_list);
 			lookup->need_search = ISC_FALSE;
 		}
-#endif
 	}
 
 #ifdef WITH_IDN
@@ -1877,15 +1857,12 @@ setup_lookup(dig_lookup_t *lookup) {
 	idn_check_result(mr, "convert UTF-8 textname to IDN encoding");
 #elif defined (WITH_LIBIDN)
 	if (lookup->origin != NULL) {
-		result = libidn_locale_to_utf8 (lookup->origin->origin, &utf8_str);
+		result = libidn_locale_to_utf8 (lookup->origin->origin, utf8_str);
 		check_result (result, "convert origin to UTF-8");
-		if (len + strlen (utf8_str) + 1 < MXNAME) {
-			utf8_name[len++] = '.';
+		if (len + strlen (utf8_str) < MXNAME)
 			(void) strcpy (utf8_name + len, utf8_str);
-		} else {
+		else
 			fatal ("Too long name + origin");
-		}
-		isc_mem_free (mctx, utf8_str);
 	}
 
 	result = libidn_utf8_to_ascii (utf8_name, ascii_name);
@@ -3600,76 +3577,85 @@ idn_check_result(idn_result_t r, const c
 }
 #endif /* WITH_IDN */
 #ifdef WITH_LIBIDN
-/* If stringprep_locale_to_utf8 fails simple copy string */
 static isc_result_t
-libidn_locale_to_utf8 (const char *from, char **to) {
+libidn_locale_to_utf8 (const char *from, char *to) {
 	char *utf8_str;
 
+	debug ("libidn_locale_to_utf8");
 	utf8_str = stringprep_locale_to_utf8 (from);
-	if (utf8_str == NULL) {
-		*to = isc_mem_allocate (mctx, strlen (from) + 1);
-		if (*to == NULL)
-			return (ISC_R_NOMEMORY);
-		(void) strcpy (*to, from);
-	} else {
-		*to = isc_mem_allocate (mctx, strlen (utf8_str) + 1);
-		if (*to == NULL)
-			return (ISC_R_NOMEMORY);
-		(void) strcpy (*to, utf8_str);
+	if (utf8_str != NULL) {
+		(void) strcpy (to, utf8_str);
 		free (utf8_str);
+		return ISC_R_SUCCESS;
 	}
-	return (ISC_R_SUCCESS);
+
+	debug ("libidn_locale_to_utf8: failure");
+	return ISC_R_FAILURE;
 }
 static isc_result_t
 libidn_utf8_to_ascii (const char *from, char *to) {
 	char *ascii;
+	int iresult;
 
-	if (idna_to_ascii_8z (from, &ascii, 0) != IDNA_SUCCESS)
-		return (ISC_R_FAILURE);
+	debug ("libidn_utf8_to_ascii");
+	iresult = idna_to_ascii_8z (from, &ascii, 0);
+	if (iresult != IDNA_SUCCESS) {
+		debug ("idna_to_ascii_8z: %s", idna_strerror (iresult));
+		return ISC_R_FAILURE;
+	}
 
 	(void) strcpy (to, ascii);
 	free (ascii);
-	return (ISC_R_SUCCESS);
+	return ISC_R_SUCCESS;
 }
-/* based on idnkit's code*/
+
 static isc_result_t
 output_filter (isc_buffer_t *buffer, unsigned int used_org,
 	       isc_boolean_t absolute) {
+
 	char tmp1[MXNAME], *tmp2;
         size_t fromlen, tolen;
         isc_boolean_t end_with_dot;
+	int iresult;
+
+	debug ("output_filter");
 
-        fromlen = isc_buffer_usedlength(buffer) - used_org;
+        fromlen = isc_buffer_usedlength (buffer) - used_org;
 	if (fromlen >= MXNAME)
-		return (ISC_R_SUCCESS);
-        memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
+		return ISC_R_SUCCESS;
+        memcpy (tmp1, (char *) isc_buffer_base (buffer) + used_org, fromlen);
         end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
         if (absolute && !end_with_dot) {
                 fromlen++;
 		if (fromlen >= MXNAME)
-			return (ISC_R_SUCCESS);
+			return ISC_R_SUCCESS;
                 tmp1[fromlen - 1] = '.';
         }
         tmp1[fromlen] = '\0';
 
-	if (idna_to_unicode_lzlz (tmp1, &tmp2, 0) != IDNA_SUCCESS)
-		return (ISC_R_SUCCESS);
+	iresult = idna_to_unicode_8z8z (tmp1, &tmp2, 0);
+	if (iresult != IDNA_SUCCESS) {
+		debug ("output_filter: %s", idna_strerror (iresult));
+		return ISC_R_SUCCESS;
+	}
 
 	(void) strcpy (tmp1, tmp2);
 	free (tmp2);
 
-        tolen = strlen(tmp1);
+        tolen = strlen (tmp1);
         if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
                 tolen--;
 
-        if (isc_buffer_length(buffer) < used_org + tolen)
-                return (ISC_R_NOSPACE);
+        if (isc_buffer_length (buffer) < used_org + tolen)
+                return ISC_R_NOSPACE;
+
+	debug ("%s", tmp1);
 
-        isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
-        memcpy(isc_buffer_used(buffer), tmp1, tolen);
-        isc_buffer_add(buffer, tolen);
+        isc_buffer_subtract (buffer, isc_buffer_usedlength (buffer) - used_org);
+        memcpy (isc_buffer_used (buffer), tmp1, tolen);
+        isc_buffer_add (buffer, tolen);
 
-        return (ISC_R_SUCCESS);
+        return ISC_R_SUCCESS;
 }
 #endif /* WITH_LIBIDN*/
 


Index: bind.spec
===================================================================
RCS file: /cvs/pkgs/rpms/bind/devel/bind.spec,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -r1.235 -r1.236
--- bind.spec	6 Dec 2007 19:51:15 -0000	1.235
+++ bind.spec	11 Dec 2007 12:23:32 -0000	1.236
@@ -21,7 +21,7 @@
 Name: 		bind
 License: 	ISC
 Version: 	9.5.0
-Release: 	19.%{RELEASEVER}%{?dist}
+Release: 	19.1.%{RELEASEVER}%{?dist}
 Epoch:   	32
 Url: 		http://www.isc.org/products/BIND/
 Buildroot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -80,6 +80,7 @@
 
 # IDN paches
 Patch73:	bind-9.5-libidn.patch
+Patch83:	bind-9.5-libidn2.patch
 
 #
 Requires:	bind-libs = %{epoch}:%{version}-%{release}, glibc  >= 2.2, mktemp
@@ -254,6 +255,7 @@
 %patch72 -p1 -b .64bit
 %endif
 %patch73 -p1 -b .libidn
+%patch83 -p1 -b .libidn2
 :;
 
 
@@ -663,6 +665,10 @@
 %{_sbindir}/bind-chroot-admin
 
 %changelog
+* Mon Dec 10 2007 Adam Tkac <atkac redhat com> 32:9.5.0-19.1.b1
+- fixed shutdown with initscript when rndc doesn't work (#417431)
+- fixed IDN patch (#412241)
+
 * Thu Dec 06 2007 Adam Tkac <atkac redhat com> 32:9.5.0-19.b1
 - 9.5.0b1 (#405281, #392491)
 


Index: named.init
===================================================================
RCS file: /cvs/pkgs/rpms/bind/devel/named.init,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- named.init	19 Nov 2007 14:03:28 -0000	1.62
+++ named.init	11 Dec 2007 12:23:32 -0000	1.63
@@ -142,20 +142,17 @@
   # is it still here?
   if /sbin/pidof -o %PPID "$named" >/dev/null; then
     timeout=0
-    while : ; do
-      if /sbin/pidof -o %PPID "$named" >/dev/null; then
+    killproc "$named" -TERM >/dev/null 2>&1
+    RETVAL=0
+    while [ `/sbin/pidof -o %PPID "$named" >/dev/null` ]; do
         if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then
-          killproc "$named" -TERM >/dev/null 2>&1
-          RETVAL=$?
+	  RETVAL=1
           echo $"no response, killing with -TERM "
           break
         else
           sleep 2 && echo -n "."
           timeout=$((timeout+2))
         fi;
-      else
-        break
-      fi;
     done
   fi;
 




More information about the fedora-extras-commits mailing list