diff --git a/0001-httpAddrConnect2-Check-for-error-if-POLLHUP-is-in-va.patch b/0001-httpAddrConnect2-Check-for-error-if-POLLHUP-is-in-va.patch new file mode 100644 index 0000000..a280b4f --- /dev/null +++ b/0001-httpAddrConnect2-Check-for-error-if-POLLHUP-is-in-va.patch @@ -0,0 +1,43 @@ +diff -up cups-2.2.6/cups/http-addrlist.c.cupsgetjobs-pollhup cups-2.2.6/cups/http-addrlist.c +--- cups-2.2.6/cups/http-addrlist.c.cupsgetjobs-pollhup 2023-12-19 18:25:15.484637450 +0100 ++++ cups-2.2.6/cups/http-addrlist.c 2023-12-19 18:28:57.129163387 +0100 +@@ -313,6 +313,39 @@ httpAddrConnect2( + { + # ifdef HAVE_POLL + DEBUG_printf(("pfds[%d].revents=%x\n", i, pfds[i].revents)); ++ ++# ifdef _WIN32 ++ if (((WSAGetLastError() == WSAEINPROGRESS) && (pfds[i].revents & POLLIN) && (pfds[i].revents & POLLOUT)) || ++ ((pfds[i].revents & POLLHUP) && (pfds[i].revents & (POLLIN|POLLOUT)))) ++# else ++ if (((errno == EINPROGRESS) && (pfds[i].revents & POLLIN) && (pfds[i].revents & POLLOUT)) || ++ ((pfds[i].revents & POLLHUP) && (pfds[i].revents & (POLLIN|POLLOUT)))) ++# endif /* _WIN32 */ ++ { ++ // Some systems generate POLLIN or POLLOUT together with POLLHUP when doing ++ // asynchronous connections. The solution seems to be to use getsockopt to ++ // check the SO_ERROR value and ignore the POLLHUP if there is no error or ++ // the error is EINPROGRESS. ++ ++ int sres, /* Return value from getsockopt() - 0, or -1 if error */ ++ serr; /* Option SO_ERROR value */ ++ socklen_t slen = sizeof(serr); /* Option value size */ ++ ++ sres = getsockopt(fds[i], SOL_SOCKET, SO_ERROR, &serr, &slen); ++ ++ if (sres || serr) ++ { ++ pfds[i].revents |= POLLERR; ++# ifdef DEBUG ++ DEBUG_printf(("1httpAddrConnect2: getsockopt returned: %d with error: %s", sres, strerror(serr))); ++# endif ++ } ++ else if (pfds[i].revents && (pfds[i].revents & POLLHUP) && (pfds[i].revents & (POLLIN | POLLOUT))) ++ { ++ pfds[i].revents &= ~POLLHUP; ++ } ++ } ++ + if (pfds[i].revents && !(pfds[i].revents & (POLLERR | POLLHUP))) + # else + if (FD_ISSET(fds[i], &input_set) && !FD_ISSET(fds[i], &error_set)) diff --git a/cups.spec b/cups.spec index da044fc..4336057 100644 --- a/cups.spec +++ b/cups.spec @@ -22,7 +22,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.2.6 -Release: 55%{?dist} +Release: 56%{?dist} License: GPLv2+ and LGPLv2 with exceptions and AML Url: http://www.cups.org/ Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz @@ -168,6 +168,8 @@ Patch85: 0001-Require-authentication-for-CUPS-Get-Document.patch Patch86: cups-preservejob-leak.patch # RHEL-15309 cupsd fails to open cups-files.conf and the resulting error message is lost Patch87: 0001-scheduler-conf.c-Print-to-stderr-if-we-don-t-open-cu.patch +# RHEL-10702 cupsGetJobs fails to connect if poll() gets POLLOUT|POLLHUP in revents +Patch88: 0001-httpAddrConnect2-Check-for-error-if-POLLHUP-is-in-va.patch Patch1000: cups-lspp.patch @@ -473,6 +475,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results. %patch86 -p1 -b .preservejob-leak # RHEL-15309 cupsd fails to open cups-files.conf and the resulting error message is lost %patch87 -p1 -b .message-stderr +# RHEL-10702 cupsGetJobs fails to connect if poll() gets POLLOUT|POLLHUP in revents +%patch88 -p1 -b .cupsgetjobs-pollhup sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in @@ -899,6 +903,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Wed Dec 20 2023 Zdenek Dohnal - 1:2.2.6-56 +- RHEL-10702 cupsGetJobs fails to connect if poll() gets POLLOUT|POLLHUP in revents + * Fri Nov 03 2023 Zdenek Dohnal - 1:2.2.6-55 - RHEL-14933 cupsd memory leak in cupsdDeleteJob() with "PreserveJobHistory Off" - RHEL-15309 cupsd fails to open cups-files.conf and the resulting error message is lost