diff --git a/cups-lspp.patch b/cups-lspp.patch index 680bfb8..8d04789 100644 --- a/cups-lspp.patch +++ b/cups-lspp.patch @@ -11,27 +11,11 @@ index 9211338..8a1e0be 100644 CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ CXXLIBS = @CXXLIBS@ DBUS_NOTIFIER = @DBUS_NOTIFIER@ -diff --git a/config.h.in b/config.h.in -index 6940b96..363780a 100644 ---- a/config.h.in -+++ b/config.h.in -@@ -684,6 +684,13 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); } - #endif /* !HAVE_ABS && !abs */ - - -+/* -+ * Are we trying to meet LSPP requirements? -+ */ -+ -+#undef WITH_LSPP -+ -+ - /* - * Building as a snap (snapcraft.io)? - */ -diff -up cups-2.4.8/config-scripts/cups-lspp.m4.lspp cups-2.4.8/config-scripts/cups-lspp.m4 ---- cups-2.4.8/config-scripts/cups-lspp.m4.lspp 2024-05-14 13:15:22.457678901 +0200 -+++ cups-2.4.8/config-scripts/cups-lspp.m4 2024-05-14 13:15:22.457678901 +0200 +diff --git a/config-scripts/cups-lspp.m4 b/config-scripts/cups-lspp.m4 +new file mode 100644 +index 0000000..55bd1bb +--- /dev/null ++++ b/config-scripts/cups-lspp.m4 @@ -0,0 +1,36 @@ +dnl +dnl LSPP code for the Common UNIX Printing System (CUPS). @@ -69,6 +53,24 @@ diff -up cups-2.4.8/config-scripts/cups-lspp.m4.lspp cups-2.4.8/config-scripts/c + ;; + esac +fi +diff --git a/config.h.in b/config.h.in +index 6940b96..363780a 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -684,6 +684,13 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); } + #endif /* !HAVE_ABS && !abs */ + + ++/* ++ * Are we trying to meet LSPP requirements? ++ */ ++ ++#undef WITH_LSPP ++ ++ + /* + * Building as a snap (snapcraft.io)? + */ diff --git a/configure.ac b/configure.ac index 3b5dd73..0e61044 100644 --- a/configure.ac @@ -414,7 +416,7 @@ index 41090c8..87da143 100644 /* diff --git a/scheduler/client.c b/scheduler/client.c -index 779404c..1bc6721 100644 +index 779404c..bfb9210 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -20,12 +20,20 @@ @@ -498,7 +500,19 @@ index 779404c..1bc6721 100644 #ifdef AF_LOCAL if (httpAddrFamily(httpGetAddress(con->http)) == AF_LOCAL) { -@@ -566,6 +627,13 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ +@@ -526,6 +587,11 @@ cupsdCloseClient(cupsd_client_t *con) /* I - Client to close */ + } + #endif /* HAVE_AUTHORIZATION_H */ + ++#ifdef WITH_LSPP ++ if (con->scon) ++ cupsdClearString(&con->scon); ++#endif /* WITH_LSPP */ ++ + /* + * Re-enable new client connections if we are going back under the + * limit... +@@ -566,6 +632,13 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ struct stat filestats; /* File information */ mime_type_t *type; /* MIME type of file */ static unsigned request_id = 0; /* Request ID for temp files */ @@ -512,7 +526,7 @@ index 779404c..1bc6721 100644 status = HTTP_STATUS_CONTINUE; -@@ -1737,7 +1805,73 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ +@@ -1737,7 +1810,73 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ fchmod(con->file, 0640); fchown(con->file, RunUser, Group); fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC); @@ -586,7 +600,7 @@ index 779404c..1bc6721 100644 if (httpGetState(con->http) != HTTP_STATE_POST_SEND) { -@@ -3235,6 +3369,49 @@ is_path_absolute(const char *path) /* I - Input path */ +@@ -3235,6 +3374,49 @@ is_path_absolute(const char *path) /* I - Input path */ return (1); } @@ -833,7 +847,7 @@ index 164df6e..2d66464 100644 #if defined(HAVE_CDSASSL) diff --git a/scheduler/ipp.c b/scheduler/ipp.c -index 6892188..2f30d59 100644 +index 67ee8ed..e7fa758 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -12,6 +12,9 @@ @@ -1091,7 +1105,7 @@ index 6892188..2f30d59 100644 } } else if (strcmp(attr->values[0].string.text, Classification) && -@@ -1819,9 +2004,53 @@ add_job(cupsd_client_t *con, /* I - Client connection */ +@@ -1819,9 +2004,55 @@ add_job(cupsd_client_t *con, /* I - Client connection */ "job-sheets=\"%s\", " "job-originating-user-name=\"%s\"", Classification, job->username); @@ -1133,19 +1147,21 @@ index 6892188..2f30d59 100644 + cupsdClearString(&audit_message); + } } -+ -+ if (userheader) -+ free(userheader); -+ if (userfooter) -+ free(userfooter); +#endif /* WITH_LSPP */ } ++#ifdef WITH_LSPP ++ if (userheader) ++ free(userheader); ++ if (userfooter) ++ free(userfooter); ++#endif /* WITH_LSPP */ ++ + /* * See if we need to add the starting sheet... */ -@@ -3647,6 +3876,128 @@ check_rss_recipient( +@@ -3647,6 +3878,128 @@ check_rss_recipient( } @@ -1274,7 +1290,7 @@ index 6892188..2f30d59 100644 /* * 'check_quotas()' - Check quotas for a printer and user. */ -@@ -4102,6 +4453,15 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ +@@ -4102,6 +4455,15 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ char attrname[255], /* Name of attribute */ *s; /* Pointer into name */ ipp_attribute_t *attr; /* Attribute */ @@ -1290,7 +1306,7 @@ index 6892188..2f30d59 100644 cupsdLogMessage(CUPSD_LOG_DEBUG2, -@@ -4137,6 +4497,85 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ +@@ -4137,6 +4499,85 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ fchmod(cupsFileNumber(out), 0640); fchown(cupsFileNumber(out), RunUser, Group); @@ -1376,7 +1392,7 @@ index 6892188..2f30d59 100644 /* * Try the localized banner file under the subdirectory... -@@ -4231,6 +4670,24 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ +@@ -4231,6 +4672,24 @@ copy_banner(cupsd_client_t *con, /* I - Client connection */ else s = attrname; @@ -1401,7 +1417,7 @@ index 6892188..2f30d59 100644 if (!strcmp(s, "printer-name")) { cupsFilePuts(out, job->dest); -@@ -6681,6 +7138,22 @@ get_job_attrs(cupsd_client_t *con, /* I - Client connection */ +@@ -6681,6 +7140,22 @@ get_job_attrs(cupsd_client_t *con, /* I - Client connection */ exclude = cupsdGetPrivateAttrs(policy, con, printer, job->username); @@ -1424,7 +1440,7 @@ index 6892188..2f30d59 100644 /* * Copy attributes... */ -@@ -7079,6 +7552,11 @@ get_jobs(cupsd_client_t *con, /* I - Client connection */ +@@ -7079,6 +7554,11 @@ get_jobs(cupsd_client_t *con, /* I - Client connection */ if (username[0] && _cups_strcasecmp(username, job->username)) continue; @@ -1436,7 +1452,7 @@ index 6892188..2f30d59 100644 if (count > 0) ippAddSeparator(con->response); -@@ -11810,6 +12288,11 @@ validate_user(cupsd_job_t *job, /* I - Job */ +@@ -11810,6 +12290,11 @@ validate_user(cupsd_job_t *job, /* I - Job */ strlcpy(username, get_username(con), userlen); @@ -1449,7 +1465,7 @@ index 6892188..2f30d59 100644 * Check the username against the owner... */ diff --git a/scheduler/job.c b/scheduler/job.c -index 822a247..1cd7d35 100644 +index 822a247..2f952bc 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -9,6 +9,9 @@ @@ -1558,7 +1574,19 @@ index 822a247..1cd7d35 100644 if (Classification && !banner_page) { if ((attr = ippFindAttribute(job->attrs, "job-sheets", -@@ -1856,6 +1934,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ +@@ -1404,6 +1482,11 @@ cupsdDeleteJob(cupsd_job_t *job, /* I - Job */ + + cupsdClearString(&job->username); + cupsdClearString(&job->dest); ++ ++#ifdef WITH_LSPP ++ cupsdClearString(&job->scon); ++#endif ++ + for (i = 0; + i < (int)(sizeof(job->auth_env) / sizeof(job->auth_env[0])); + i ++) +@@ -1856,6 +1939,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - Job */ ippSetString(job->attrs, &job->reasons, 0, "job-completed-successfully"); } @@ -1581,7 +1609,7 @@ index 822a247..1cd7d35 100644 job->impressions = ippFindAttribute(job->attrs, "job-impressions-completed", IPP_TAG_INTEGER); job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed", IPP_TAG_INTEGER); job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME); -@@ -2268,6 +2362,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - Job */ +@@ -2268,6 +2367,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - Job */ { char filename[1024]; /* Job control filename */ cups_file_t *fp; /* Job file */ @@ -1596,7 +1624,7 @@ index 822a247..1cd7d35 100644 cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p", -@@ -2290,6 +2392,78 @@ cupsdSaveJob(cupsd_job_t *job) /* I - Job */ +@@ -2290,6 +2397,78 @@ cupsdSaveJob(cupsd_job_t *job) /* I - Job */ fchown(cupsFileNumber(fp), RunUser, Group); @@ -1675,7 +1703,7 @@ index 822a247..1cd7d35 100644 job->attrs->state = IPP_IDLE; if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL, -@@ -4020,6 +4194,19 @@ get_options(cupsd_job_t *job, /* I - Job */ +@@ -4020,6 +4199,19 @@ get_options(cupsd_job_t *job, /* I - Job */ banner_page) continue; @@ -1695,7 +1723,7 @@ index 822a247..1cd7d35 100644 /* * Otherwise add them to the list... */ -@@ -4834,6 +5021,18 @@ start_job(cupsd_job_t *job, /* I - Job ID */ +@@ -4834,6 +5026,18 @@ start_job(cupsd_job_t *job, /* I - Job ID */ cupsd_printer_t *printer) /* I - Printer to print job */ { const char *filename; /* Support filename */ @@ -1714,7 +1742,7 @@ index 822a247..1cd7d35 100644 ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs, "job-cancel-after", IPP_TAG_INTEGER); -@@ -5022,6 +5221,113 @@ start_job(cupsd_job_t *job, /* I - Job ID */ +@@ -5022,6 +5226,113 @@ start_job(cupsd_job_t *job, /* I - Job ID */ fcntl(job->side_pipes[1], F_SETFD, fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC); diff --git a/cups.spec b/cups.spec index bf5d07d..173c427 100644 --- a/cups.spec +++ b/cups.spec @@ -22,7 +22,7 @@ Summary: CUPS printing system Name: cups Epoch: 1 Version: 2.4.10 -Release: 4%{?dist} +Release: 5%{?dist} # backend/failover.c - BSD-3-Clause # cups/md5* - Zlib # scheduler/colorman.c - Apache-2.0 WITH LLVM-exception AND BSD-2-Clause @@ -794,6 +794,9 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man7/ippeveps.7.gz %changelog +* Thu Aug 15 2024 Zdenek Dohnal - 1:2.4.10-5 +- RHEL-54297 lspp caused memory leakage + * Thu Aug 15 2024 Zdenek Dohnal - 1:2.4.10-4 - RHEL-54345 Creating IPP Everywhere printer fails due race condition