CHANGES IN CUPS V1.3.9
- Documentation updates (STR #2904)
+ - CUPS now reinitializes the DNS resolver on failures
+ (STR #2920)
- The CUPS desktop menu item was broken (STR #2924)
- The PPD parser was too strict about missing keyword
values in "relaxed" mode.
lpd.o: ../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h
lpd.o: ../cups/language.h ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
lpd.o: ../cups/snmp-private.h ../cups/string.h
-mdns.o: backend-private.h ../cups/backend.h ../cups/versioning.h
-mdns.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
-mdns.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
-mdns.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
-mdns.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
-mdns.o: ../config.h ../cups/array.h
+dnssd.o: backend-private.h ../cups/backend.h ../cups/versioning.h
+dnssd.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
+dnssd.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
+dnssd.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
+dnssd.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
+dnssd.o: ../config.h ../cups/array.h
pap.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
pap.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
pap.o: ../cups/language.h ../cups/backend.h ../cups/sidechannel.h
testsupplies.o: ../cups/file.h ../cups/language.h ../cups/debug.h
testsupplies.o: ../cups/i18n.h ../cups/transcode.h ../cups/snmp-private.h
testsupplies.o: ../cups/string.h ../config.h
-usb.o: ../cups/backend.h ../cups/versioning.h ../cups/cups.h ../cups/ipp.h
-usb.o: ../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h
-usb.o: ../cups/language.h ../cups/string.h ../config.h ../cups/i18n.h
-usb.o: ../cups/transcode.h
+usb.o: backend-private.h ../cups/backend.h ../cups/versioning.h
+usb.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
+usb.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
+usb.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
+usb.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
+usb.o: ../config.h
dnl
dnl Networking stuff for the Common UNIX Printing System (CUPS).
dnl
-dnl Copyright 2007 by Apple Inc.
+dnl Copyright 2007-2008 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
+AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H))
AC_SEARCH_LIBS(socket, socket)
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),
+ 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...
#undef HAVE_HSTRERROR
+/*
+ * Do we have res_init()?
+ */
+
+#undef HAVE_RES_INIT
+
+
+/*
+ * Do we have <resolv.h>
+ */
+
+#undef HAVE_RESOLV_H
+
+
/*
* Do we have the <sys/sockio.h> header file?
*/
http.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.o: i18n.h transcode.h debug.h
-http-addr.o: globals.h string.h ../config.h http-private.h http.h
-http-addr.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
+http-addr.o: http-private.h ../config.h http.h versioning.h md5.h
+http-addr.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.o: file.h language.h i18n.h transcode.h debug.h
http-addrlist.o: http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
testadmin.o: file.h language.h string.h ../config.h
testarray.o: ../cups/string.h ../config.h string.h array.h versioning.h dir.h
testarray.o: debug.h
+testconflicts.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
+testconflicts.o: language.h string.h ../config.h
testcups.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testfile.o: string.h ../config.h file.h versioning.h debug.h
testhttp.o: http-private.h ../config.h http.h versioning.h md5.h
http.32.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.32.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.32.o: http.c i18n.h transcode.h debug.h
-http-addr.32.o: http-addr.c globals.h string.h ../config.h http-private.h http.h
-http-addr.32.o: http-addr.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
+http-addr.32.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
+http-addr.32.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.32.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
http-addrlist.32.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.32.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
testadmin.32.o: testadmin.c file.h language.h string.h ../config.h
testarray.32.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
testarray.32.o: testarray.c debug.h
+testconflicts.32.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
+testconflicts.32.o: testconflicts.c language.h string.h ../config.h
testcups.32.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testfile.32.o: testfile.c string.h ../config.h file.h versioning.h debug.h
testhttp.32.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
http.64.o: http.c http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
http.64.o: http.c ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
http.64.o: http.c i18n.h transcode.h debug.h
-http-addr.64.o: http-addr.c globals.h string.h ../config.h http-private.h http.h
-http-addr.64.o: http-addr.c versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
+http-addr.64.o: http-addr.c http-private.h ../config.h http.h versioning.h md5.h
+http-addr.64.o: http-addr.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
http-addr.64.o: http-addr.c file.h language.h i18n.h transcode.h debug.h
http-addrlist.64.o: http-addrlist.c http-private.h ../config.h http.h versioning.h md5.h
http-addrlist.64.o: http-addrlist.c ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
testadmin.64.o: testadmin.c file.h language.h string.h ../config.h
testarray.64.o: testarray.c ../cups/string.h ../config.h string.h array.h versioning.h dir.h
testarray.64.o: testarray.c debug.h
+testconflicts.64.o: testconflicts.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h
+testconflicts.64.o: testconflicts.c language.h string.h ../config.h
testcups.64.o: testcups.c cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
testfile.64.o: testfile.c string.h ../config.h file.h versioning.h debug.h
testhttp.64.o: testhttp.c http-private.h ../config.h http.h versioning.h md5.h
# ifdef HAVE_GETADDRINFO
char hostname[1024]; /* Hostname */
# endif /* HAVE_GETADDRINFO */
+ int need_res_init; /* Need to reinitialize resolver? */
/* ipp.c */
ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */
* Include necessary headers...
*/
+#include "http-private.h"
#include "globals.h"
#include "debug.h"
#include <stdlib.h>
#include <stddef.h>
+#ifdef HAVE_RESOLV_H
+# include <resolv.h>
+#endif /* HAVE_RESOLV_H */
/*
char *name, /* I - Host name buffer */
int namelen) /* I - Size of name buffer */
{
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Global data */
+
+
DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)\n",
addr, name, namelen));
#ifdef AF_LOCAL
if (addr->addr.sa_family == AF_LOCAL)
+ {
strlcpy(name, addr->un.sun_path, namelen);
- else
+ return (name);
+ }
#endif /* AF_LOCAL */
+
+#ifdef HAVE_RES_INIT
+ /*
+ * STR #2920: Initialize resolver after failure in cups-polld
+ *
+ * If the previous lookup failed, re-initialize the resolver to prevent
+ * temporary network errors from persisting. This *should* be handled by
+ * the resolver libraries, but apparently the glibc folks do not agree.
+ *
+ * We set a flag at the end of this function if we encounter an error that
+ * requires reinitialization of the resolver functions. We then call
+ * res_init() if the flag is set on the next call here or in httpAddrLookup().
+ */
+
+ if (cg->need_res_init)
+ {
+ res_init();
+
+ cg->need_res_init = 0;
+ }
+#endif /* HAVE_RES_INIT */
+
#ifdef HAVE_GETNAMEINFO
{
/*
* do...
*/
- if (getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
- NULL, 0, 0))
+ int error = getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
+ NULL, 0, 0);
+
+ if (error)
+ {
+ if (error == EAI_FAIL)
+ cg->need_res_init = 1;
+
return (httpAddrString(addr, name, namelen));
+ }
}
#else
{
* No hostname, so return the raw address...
*/
- httpAddrString(addr, name, namelen);
- return (NULL);
+ if (h_errno == NO_RECOVERY)
+ cg->need_res_init = 1;
+
+ return (httpAddrString(addr, name, namelen));
}
strlcpy(name, host->h_name, namelen);
#include "debug.h"
#include <stdlib.h>
#include <errno.h>
+#ifdef HAVE_RESOLV_H
+# include <resolv.h>
+#endif /* HAVE_RESOLV_H */
/*
http_addrlist_t *first, /* First address in list */
*addr, /* Current address in list */
*temp; /* New address */
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Global data */
#ifdef DEBUG
family == AF_INET ? "INET" : "???", service);
#endif /* DEBUG */
+#ifdef HAVE_RES_INIT
+ /*
+ * STR #2920: Initialize resolver after failure in cups-polld
+ *
+ * If the previous lookup failed, re-initialize the resolver to prevent
+ * temporary network errors from persisting. This *should* be handled by
+ * the resolver libraries, but apparently the glibc folks do not agree.
+ *
+ * We set a flag at the end of this function if we encounter an error that
+ * requires reinitialization of the resolver functions. We then call
+ * res_init() if the flag is set on the next call here or in httpAddrLookup().
+ */
+
+ if (cg->need_res_init)
+ {
+ res_init();
+
+ cg->need_res_init = 0;
+ }
+#endif /* HAVE_RES_INIT */
+
+
/*
* Lookup the address the best way we can...
*/
char ipv6[1024], /* IPv6 address */
*ipv6zone; /* Pointer to zone separator */
int ipv6len; /* Length of IPv6 address */
+ int error; /* getaddrinfo() error */
+
/*
* Lookup the address as needed...
}
}
- if (!getaddrinfo(hostname, service, &hints, &results))
+ if ((error = getaddrinfo(hostname, service, &hints, &results)) == 0)
{
/*
* Copy the results to our own address list structure...
freeaddrinfo(results);
}
+ else if (error == EAI_FAIL)
+ cg->need_res_init = 1;
+
#else
if (hostname)
{
addr = temp;
}
}
+ else if (h_errno == NO_RECOVERY)
+ cg->need_res_init = 1;
}
#endif /* HAVE_GETADDRINFO */
}
# DO NOT DELETE THIS LINE -- make depend depends on it.
+dbus.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h
+dbus.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
+dbus.o: ../cups/string.h ../config.h
mailto.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h
mailto.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
mailto.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h