diff --git a/SOURCES/cups-1.6.3-resolv_reload.patch b/SOURCES/cups-1.6.3-resolv_reload.patch new file mode 100644 index 0000000..10971c2 --- /dev/null +++ b/SOURCES/cups-1.6.3-resolv_reload.patch @@ -0,0 +1,323 @@ +diff -up cups-1.6.3/cups/auth.c.resolv_reload cups-1.6.3/cups/auth.c +--- cups-1.6.3/cups/auth.c.resolv_reload 2013-06-07 03:12:52.000000000 +0200 ++++ cups-1.6.3/cups/auth.c 2017-04-07 13:34:55.224510840 +0200 +@@ -527,6 +527,18 @@ cups_gss_getname( + DEBUG_printf(("7cups_gss_getname(http=%p, service_name=\"%s\")", http, + service_name)); + ++#ifdef HAVE_RES_INIT ++ /* ++ * Check if /etc/resolv.conf is modified. ++ * If so, reload resolver. ++ */ ++ ++ dns_resolver_reload_rv retval; ++ ++ retval = dnsReloadResolver(); ++ if (retval.status == DNS_RESOLVER_RELOAD_ERROR) ++ DEBUG_printf(("1cups_gss_getname: dnsReloadResolver() failed - %s.", strerror(retval.errnum))); ++#endif /* HAVE_RES_INIT */ + + /* + * Get the hostname... +diff -up cups-1.6.3/cups/http-addr.c.resolv_reload cups-1.6.3/cups/http-addr.c +--- cups-1.6.3/cups/http-addr.c.resolv_reload 2017-04-07 13:34:55.112511816 +0200 ++++ cups-1.6.3/cups/http-addr.c 2017-04-07 13:34:55.224510840 +0200 +@@ -220,6 +220,20 @@ httpAddrLookup( + + #ifdef HAVE_RES_INIT + /* ++ * Check if /etc/resolv.conf is modified. ++ * If so, reload resolver and set need_res_init to 0. ++ */ ++ ++ dns_resolver_reload_rv retval; ++ ++ retval = dnsReloadResolver(); ++ ++ if (retval.status == DNS_RESOLVER_RELOAD_RELOADED && cg->need_res_init == 1) ++ cg->need_res_init = 0; ++ ++ if (retval.status == DNS_RESOLVER_RELOAD_ERROR) ++ DEBUG_printf(("1httpAddrLookup: dnsReloadResolver() failed - %s.", strerror(retval.errnum))); ++ /* + * STR #2920: Initialize resolver after failure in cups-polld + * + * If the previous lookup failed, re-initialize the resolver to prevent +diff -up cups-1.6.3/cups/http-addrlist.c.resolv_reload cups-1.6.3/cups/http-addrlist.c +--- cups-1.6.3/cups/http-addrlist.c.resolv_reload 2017-04-07 13:34:55.112511816 +0200 ++++ cups-1.6.3/cups/http-addrlist.c 2017-04-07 13:34:55.224510840 +0200 +@@ -389,6 +389,20 @@ httpAddrGetList(const char *hostname, /* + + #ifdef HAVE_RES_INIT + /* ++ * Check if /etc/resolv.conf is modified. ++ * If so, reload resolver and set cg->need_res_init to 0 ++ */ ++ ++ dns_resolver_reload_rv retval; ++ ++ retval = dnsReloadResolver(); ++ ++ if (retval.status == DNS_RESOLVER_RELOAD_RELOADED && cg->need_res_init == 1) ++ cg->need_res_init = 0; ++ ++ if (retval.status == DNS_RESOLVER_RELOAD_ERROR) ++ DEBUG_printf(("1httpAddrGetList: dnsReloadResolver() failed - %s.", strerror(retval.errnum))); ++ /* + * STR #2920: Initialize resolver after failure in cups-polld + * + * If the previous lookup failed, re-initialize the resolver to prevent +diff -up cups-1.6.3/cups/http.c.resolv_reload cups-1.6.3/cups/http.c +--- cups-1.6.3/cups/http.c.resolv_reload 2017-04-07 13:34:55.207510988 +0200 ++++ cups-1.6.3/cups/http.c 2017-04-10 21:21:41.528795395 +0200 +@@ -4795,6 +4795,108 @@ _httpTLSSetOptions(int options) + tls_options = options; + } + ++#ifdef HAVE_RES_INIT ++/* ++ * Function to check modification time of resolv.conf. ++ * If time is changed, it reloads resolver. ++ * If /etc/resolv.conf doesn't exist, it tries to reload resolver with local nameserver, if it wasn't reloaded before ++ * If even reloading resolver with local nameserver doesn't work, it ends with error. ++ * Global variable resolv_conf_modtime is set to -1 before the first call of this function - this is for prevention of resolver's reloading when cupsd is just started and resolv.conf exists - cupsd has current configuration in that case. ++ */ ++ ++dns_resolver_reload_rv ++dnsReloadResolver() ++{ ++ dns_resolver_reload_rv retval, lstat_retval, stat_retval, res_init_retval; ++ struct stat resolv_conf_stat, resolv_conf_lstat, resolv_conf_status; ++ retval.status = DNS_RESOLVER_RELOAD_OK; ++ retval.errnum = 0; ++ stat_retval.errnum = 0; ++ lstat_retval.errnum = 0; ++ res_init_retval.errnum = 0; ++ ++ /* Variable to store /etc/resolv.conf modification time - initialized by actual time*/ ++ static time_t resolv_conf_modtime = -1; ++ ++ /* This part of code is to ensure we get modification time of symlink and original file - we will decide which is newer later */ ++ stat_retval.status = stat(DNS_RESOLV_CONF_PATH, &resolv_conf_stat); ++ stat_retval.errnum = errno; ++ lstat_retval.status = lstat(DNS_RESOLV_CONF_PATH, &resolv_conf_lstat); ++ lstat_retval.errnum = errno; ++ ++ /* symlink /etc/resolv.conf or original file couldn't be stated because it doesn't exist, try resolver on localhost ++ * Covers cases: ++ * - resolv.conf and original file existed and it doesn't now - resolv_conf_modtime has different value than 0 - reload resolver with local nameserver ++ * - resolv.conf and original file didn't exist and still doesn't exist - resolv_conf_modtime is set to 0 - do nothing ++ */ ++ if (stat_retval.status == -1 && lstat_retval.status == -1 && stat_retval.errnum == ENOENT && lstat_retval.errnum == ENOENT) ++ { ++ /* if resolv_conf_modtime is set to 0, it means previous reload was for resolver with local nameserver - no need to reload again */ ++ if (resolv_conf_modtime != 0) ++ { ++ res_init_retval.status = res_init(); ++ res_init_retval.errnum = errno; ++ if (res_init_retval.status == 0) ++ { ++ resolv_conf_modtime = 0; ++ retval.status = DNS_RESOLVER_RELOAD_RELOADED; ++ } ++ else ++ retval.status = res_init_retval.status; ++ ++ retval.errnum = res_init_retval.errnum; ++ } ++ else ++ { ++ retval.status = DNS_RESOLVER_RELOAD_OK; ++ retval.errnum = ENOENT; ++ } ++ ++ return (retval); ++ } ++ ++ /* If stat ends with different errno, return status - it should return both statuses and errnos, but for simplification it returns only stat */ ++ if (stat_retval.status == -1 && lstat_retval.status == -1) ++ { ++ retval.errnum = stat_retval.errnum; ++ retval.status = stat_retval.status; ++ return (retval); ++ } ++ ++ /* Here we compare modification times from lstat and stat to decide which is newer - if they are equal, lstat modification time is used. We are checking only stat() errno, because case with errors in both lstat() and stat() functions is checked before */ ++ if (stat_retval.errnum == 0) ++ if (resolv_conf_stat.st_mtime > resolv_conf_lstat.st_mtime) ++ resolv_conf_status = resolv_conf_stat; ++ else ++ resolv_conf_status = resolv_conf_lstat; ++ else ++ resolv_conf_status = resolv_conf_lstat; ++ ++ /* If /etc/resolv.conf exists and modification times are different, reload resolver. ++ * Covers cases: ++ * - resolv.conf or original file exists and it was modified - resolv_conf_modtime has different value than resolv_conf_status.st_mtime - reload resolver with nameserver from /etc/resolv.conf ++ * - resolv.conf or original file didn't exist and it does now - resolv_conf_modtime is set to 0 and resolv_conf_status.st_mtime has value - reload resolver with nameserver form /etc/resolv.conf ++ * - resolv.conf or original file exists and it wasn't modified - resolv_conf_modtime is equal to resolv_conf_status.st_mtime - do nothing ++ */ ++ if (resolv_conf_status.st_mtime != resolv_conf_modtime) ++ { ++ res_init_retval.status = res_init(); ++ res_init_retval.errnum = errno; ++ if (res_init_retval.status == 0) ++ { ++ retval.status = DNS_RESOLVER_RELOAD_RELOADED; ++ } ++ else ++ retval.status = res_init_retval.status; ++ ++ retval.errnum = res_init_retval.errnum; ++ } ++ ++ resolv_conf_modtime = resolv_conf_status.st_mtime; ++ ++ return (retval); ++} ++#endif /* HAVE_RES_INIT */ + + /* + * End of "$Id: http.c 7850 2008-08-20 00:07:25Z mike $". +diff -up cups-1.6.3/cups/http.h.resolv_reload cups-1.6.3/cups/http.h +--- cups-1.6.3/cups/http.h.resolv_reload 2013-06-07 03:12:52.000000000 +0200 ++++ cups-1.6.3/cups/http.h 2017-04-07 13:34:55.225510832 +0200 +@@ -60,6 +60,12 @@ typedef off_t ssize_t; /* @private@ */ + # define SO_PEERCRED LOCAL_PEERCRED + # endif /* LOCAL_PEERCRED && !SO_PEERCRED */ + # endif /* WIN32 */ ++# ifdef HAVE_RES_INIT ++# include ++# include ++# include ++# include ++# endif /* HAVE_RES_INIT */ + + + /* +@@ -102,6 +108,13 @@ extern "C" { + #endif /* AF_INET6 && !s6_addr32 */ + + ++#ifdef HAVE_RES_INIT ++/* ++ * Global variable for storing old modification time of resolv.conf ++ */ ++ extern time_t resolv_conf_modtime; ++#endif /* HAVE_RES_INIT */ ++ + /* + * Limits... + */ +@@ -110,6 +123,9 @@ extern "C" { + # define HTTP_MAX_HOST 256 /* Max length of hostname string */ + # define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */ + # define HTTP_MAX_VALUE 256 /* Max header field value length */ ++# ifdef HAVE_RES_INIT ++# define DNS_RESOLV_CONF_PATH "/etc/resolv.conf" /* Path to resolv.conf */ ++# endif /* HAVE_RES_INIT */ + + + /* +@@ -290,6 +306,15 @@ typedef enum http_version_e /**** HTTP + HTTP_1_1 = 101 /* HTTP/1.1 */ + } http_version_t; + ++#ifdef HAVE_RES_INIT ++typedef enum dns_resolver_reload_e ++{ ++ DNS_RESOLVER_RELOAD_ERROR = -1, ++ DNS_RESOLVER_RELOAD_OK = 0, ++ DNS_RESOLVER_RELOAD_RELOADED = 1 ++} dns_resolver_reload_t; ++#endif /* HAVE_RES_INIT */ ++ + typedef union _http_addr_u /**** Socket address union, which + **** makes using IPv6 and other + **** address types easier and +@@ -328,6 +353,13 @@ typedef struct http_credential_s /**** H + typedef int (*http_timeout_cb_t)(http_t *http, void *user_data); + /**** HTTP timeout callback @since CUPS 1.5/OS X 10.7@ ****/ + ++#ifdef HAVE_RES_INIT ++typedef struct dns_resolver_reload_retval ++{ ++ dns_resolver_reload_t status; ++ int errnum; ++} dns_resolver_reload_rv; ++#endif /* HAVE_RES_INIT */ + + + /* +@@ -472,6 +504,11 @@ extern http_version_t httpGetVersion(htt + extern int httpReconnect2(http_t *http, int msec, int *cancel) + _CUPS_API_1_6; + ++/**** Prototype of function to check modification time of /etc/resolv.conf ****/ ++#ifdef HAVE_RES_INIT ++extern dns_resolver_reload_rv dnsReloadResolver(); ++#endif /* HAVE_RES_INIT */ ++ + + /* + * C++ magic... +diff -up cups-1.6.3/cups/http-support.c.resolv_reload cups-1.6.3/cups/http-support.c +--- cups-1.6.3/cups/http-support.c.resolv_reload 2017-04-07 13:34:55.130511659 +0200 ++++ cups-1.6.3/cups/http-support.c 2017-04-07 13:34:55.225510832 +0200 +@@ -2095,6 +2095,18 @@ http_resolve_cb( + http_addrlist_t *addrlist, /* List of addresses */ + *addr; /* Current address */ + ++#ifdef HAVE_RES_INIT ++ /* ++ * Check if resolv.conf is modified, if so, reload resolver ++ */ ++ ++ dns_resolver_reload_rv retval; ++ ++ retval = dnsReloadResolver(); ++ if (retval.status == DNS_RESOLVER_RELOAD_ERROR) ++ DEBUG_printf(("1http_resolve_cb: dnsReloadResolver() failed - %s.", strerror(retval.errnum))); ++#endif /* HAVE_RES_INIT */ ++ + DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget)); + + snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port)); +diff -up cups-1.6.3/scheduler/conf.c.resolv_reload cups-1.6.3/scheduler/conf.c +--- cups-1.6.3/scheduler/conf.c.resolv_reload 2017-04-07 13:34:55.213510936 +0200 ++++ cups-1.6.3/scheduler/conf.c 2017-04-07 13:34:55.226510823 +0200 +@@ -859,6 +859,15 @@ cupsdReadConfiguration(void) + if (!RemotePort) + BrowseLocalProtocols = 0; /* Disable sharing - no remote access */ + ++#ifdef HAVE_RES_INIT ++ dns_resolver_reload_rv retval; /* Return status of dnsReloadResolver() */ ++ ++ retval = dnsReloadResolver(); ++ ++ if (retval.status == DNS_RESOLVER_RELOAD_ERROR) ++ syslog(LOG_LPR, "1cupsdReadConfiguration: dnsReloadResolver() failed - %s.", strerror(retval.errnum)); ++#endif /* HAVE_RES_INIT */ ++ + /* + * See if the ServerName is an IP address... + */ +diff -up cups-1.6.3/scheduler/main.c.resolv_reload cups-1.6.3/scheduler/main.c +--- cups-1.6.3/scheduler/main.c.resolv_reload 2017-04-07 13:34:55.149511494 +0200 ++++ cups-1.6.3/scheduler/main.c 2017-04-07 13:34:55.226510823 +0200 +@@ -164,6 +164,14 @@ main(int argc, /* I - Number of comm + long tmo_delay; /* Time before it must be called */ + #endif /* HAVE_AVAHI */ + ++#ifdef HAVE_RES_INIT ++ dns_resolver_reload_rv retval; /* Return status from dnsReloadResolver() */ ++ ++ retval = dnsReloadResolver(); ++ if (retval.status == DNS_RESOLVER_RELOAD_ERROR) ++ fprintf(stderr, "cupsd: Cannot reload a resolver - %s , using old configuration now.\n", strerror(retval.errnum)); ++#endif /* HAVE_RES_INIT */ ++ + + #ifdef HAVE_GETEUID + /* diff --git a/SOURCES/cups-state-message.patch b/SOURCES/cups-state-message.patch new file mode 100644 index 0000000..8134b68 --- /dev/null +++ b/SOURCES/cups-state-message.patch @@ -0,0 +1,45 @@ +diff -up cups-1.6.3/scheduler/job.c.state-message cups-1.6.3/scheduler/job.c +--- cups-1.6.3/scheduler/job.c.state-message 2017-01-17 13:00:04.298739909 +0100 ++++ cups-1.6.3/scheduler/job.c 2017-01-18 16:29:00.347457271 +0100 +@@ -3638,6 +3638,13 @@ finalize_job(cupsd_job_t *job, /* I - J + cupsArrayRemove(PrintingJobs, job); + + /* ++ * Clear informational messages... ++ */ ++ ++ if (job->status_level > CUPSD_LOG_ERROR) ++ job->printer->state_message[0] = '\0'; ++ ++ /* + * Apply any PPD updates... + */ + +diff -up cups-1.6.3/xcode/CUPS.xcodeproj/project.pbxproj.state-message cups-1.6.3/xcode/CUPS.xcodeproj/project.pbxproj +--- cups-1.6.3/xcode/CUPS.xcodeproj/project.pbxproj.state-message 2017-01-17 13:00:40.004504156 +0100 ++++ cups-1.6.3/xcode/CUPS.xcodeproj/project.pbxproj 2017-01-18 16:34:02.409677280 +0100 +@@ -2653,7 +2653,7 @@ + 72BF96371333042100B1EAD7 /* Project object */ = { + isa = PBXProject; + attributes = { +- LastUpgradeCheck = 0440; ++ LastUpgradeCheck = 0800; + ORGANIZATIONNAME = "Apple Inc."; + }; + buildConfigurationList = 72BF963A1333042100B1EAD7 /* Build configuration list for PBXProject "CUPS" */; +@@ -3968,6 +3968,7 @@ + 72BF963C1333042100B1EAD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { ++ ASSETCATALOG_COMPRESSION = lossless; + ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; +@@ -3994,6 +3995,7 @@ + 72BF963D1333042100B1EAD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { ++ ASSETCATALOG_COMPRESSION = "respect-asset-catalog"; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/SPECS/cups.spec b/SPECS/cups.spec index 85ed7ab..6b507b6 100644 --- a/SPECS/cups.spec +++ b/SPECS/cups.spec @@ -11,7 +11,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 1.6.3 -Release: 26%{?dist} +Release: 29%{?dist} License: GPLv2 Group: System Environment/Daemons Url: http://www.cups.org/ @@ -92,6 +92,8 @@ Patch61: cups-str4648.patch Patch62: cups-start-service.patch Patch63: cups-163-enotif.patch Patch64: cups-163-fdleak.patch +Patch65: cups-state-message.patch +Patch66: cups-1.6.3-resolv_reload.patch Patch100: cups-lspp.patch @@ -355,6 +357,10 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch63 -p1 -b .enotif # Gnome-settings-daemon leaks file descriptors (bug #1297035) %patch64 -p1 -b .fdleak +# Printer State Message not cleared upon successful print job completion (bug #1353096) +%patch65 -p1 -b .state-message +# CUPS does not recognize changes to /etc/resolv.conf until CUPS restart (bug #1325692) +%patch66 -p1 -b .resolv_reload %if %lspp # LSPP support. @@ -751,6 +757,15 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Thu Apr 06 2017 Zdenek Dohnal - 1:1.6.3-29 +- fixing cups-1.6.3-resolv_reload.patch for rhbz#1325692 + +* Thu Mar 09 2017 Zdenek Dohnal - 1:1.6.3-28 +- 1325692 - CUPS does not recognize changes to /etc/resolv.conf until CUPS restart + +* Wed Jul 20 2016 Zdenek Dohnal - 1:1.6.3-27 +- 1353096 - Printer State Message not cleared upon successful print job completion + * Wed Jun 15 2016 Zdenek Dohnal - 1:1.6.3-26 - 1302055 - Change symlink for smb backend to /usr/libexec/samba/cups_backend_smb