From f841b4d20323f22de837625ba744a02a31e19037 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Sep 03 2008 14:58:27 +0000 Subject: - cups-polld: reinit the resolver if we haven't yet resolved the hostname (bug #354071). --- diff --git a/cups-res_init.patch b/cups-res_init.patch new file mode 100644 index 0000000..d449e0a --- /dev/null +++ b/cups-res_init.patch @@ -0,0 +1,146 @@ +diff -up cups-1.3.8/config.h.in.res_init cups-1.3.8/config.h.in +--- cups-1.3.8/config.h.in.res_init 2008-09-03 15:34:23.000000000 +0100 ++++ cups-1.3.8/config.h.in 2008-09-03 15:34:52.000000000 +0100 +@@ -365,6 +365,13 @@ + + + /* ++ * Do we have __res_init()? ++ */ ++ ++#undef HAVE_RES_INIT ++ ++ ++/* + * Do we have hstrerror()? + */ + +diff -up cups-1.3.8/config-scripts/cups-network.m4.res_init cups-1.3.8/config-scripts/cups-network.m4 +--- cups-1.3.8/config-scripts/cups-network.m4.res_init 2007-12-19 01:47:57.000000000 +0000 ++++ cups-1.3.8/config-scripts/cups-network.m4 2008-09-03 15:34:14.000000000 +0100 +@@ -18,6 +18,7 @@ AC_SEARCH_LIBS(gethostbyaddr, nsl) + AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS)) + AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR)) + AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF)) ++AC_SEARCH_LIBS(__res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT)) + + # Tru64 5.1b leaks file descriptors with these functions; disable until + # we can come up with a test for this... +diff -up cups-1.3.8/configure.res_init cups-1.3.8/configure +--- cups-1.3.8/configure.res_init 2008-09-03 15:34:14.000000000 +0100 ++++ cups-1.3.8/configure 2008-09-03 15:34:14.000000000 +0100 +@@ -12189,6 +12189,92 @@ _ACEOF + + fi + ++{ echo "$as_me:$LINENO: checking for library containing __res_init" >&5 ++echo $ECHO_N "checking for library containing __res_init... $ECHO_C" >&6; } ++if test "${ac_cv_search___res_init+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_func_search_save_LIBS=$LIBS ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char __res_init (); ++int ++main () ++{ ++return __res_init (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' resolv bind; do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && ++ $as_test_x conftest$ac_exeext; then ++ ac_cv_search___res_init=$ac_res ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ++fi ++ ++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ ++ conftest$ac_exeext ++ if test "${ac_cv_search___res_init+set}" = set; then ++ break ++fi ++done ++if test "${ac_cv_search___res_init+set}" = set; then ++ : ++else ++ ac_cv_search___res_init=no ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ++fi ++{ echo "$as_me:$LINENO: result: $ac_cv_search___res_init" >&5 ++echo "${ECHO_T}$ac_cv_search___res_init" >&6; } ++ac_res=$ac_cv_search___res_init ++if test "$ac_res" != no; then ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ cat >>confdefs.h <<\_ACEOF ++#define HAVE_RES_INIT 1 ++_ACEOF ++ ++fi ++ + + # Tru64 5.1b leaks file descriptors with these functions; disable until + # we can come up with a test for this... +diff -up cups-1.3.8/scheduler/cups-polld.c.res_init cups-1.3.8/scheduler/cups-polld.c +--- cups-1.3.8/scheduler/cups-polld.c.res_init 2008-01-08 00:16:30.000000000 +0000 ++++ cups-1.3.8/scheduler/cups-polld.c 2008-09-03 15:34:14.000000000 +0100 +@@ -155,6 +155,18 @@ main(int argc, /* I - Number of comm + restart_polling = 0; + httpClose(http); + ++#ifdef HAVE_RES_INIT ++ if (!http) ++ { ++ /* ++ * Reinit the resolver so that it doesn't cache a previous ++ * hostname lookup failure. This fixes the situation where a ++ * network interface becomes available after polling starts. ++ */ ++ __res_init (); ++ } ++#endif /* HAVE_RES_INIT */ ++ + if ((http = httpConnectEncrypt(argv[1], atoi(argv[2]), + cupsEncryption())) == NULL) + { diff --git a/cups.spec b/cups.spec index e58e5ec..6397e32 100644 --- a/cups.spec +++ b/cups.spec @@ -49,6 +49,7 @@ Patch21: cups-usb-paperout.patch Patch22: cups-getnameddest.patch Patch23: cups-str2892.patch Patch24: cups-str2101.patch +Patch25: cups-res_init.patch Patch100: cups-lspp.patch Epoch: 1 Url: http://www.cups.org/ @@ -172,6 +173,7 @@ lpd emulation. %patch22 -p1 -b .getnameddest %patch23 -p1 -b .str2892 %patch24 -p1 -b .str2101 +%patch25 -p1 -b .res_init %if %lspp %patch100 -p1 -b .lspp @@ -459,6 +461,10 @@ rm -rf $RPM_BUILD_ROOT %{cups_serverbin}/daemon/cups-lpd %changelog +* Wed Sep 3 2008 Tim Waugh +- cups-polld: reinit the resolver if we haven't yet resolved the + hostname (bug #354071). + * Mon Aug 11 2008 Tim Waugh 1:1.3.8-4 - Better password prompting behaviour (bug #215133, STR #2101).