diff --git a/cups-fix-device-uri-in-webui.patch b/cups-fix-device-uri-in-webui.patch new file mode 100644 index 0000000..d702f88 --- /dev/null +++ b/cups-fix-device-uri-in-webui.patch @@ -0,0 +1,44 @@ +diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c +index e0f1136..02ff51d 100644 +--- a/cgi-bin/admin.c ++++ b/cgi-bin/admin.c +@@ -636,7 +636,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + }; + + +- ptr = cgiGetTextfield("DEVICE_URI"); ++ ptr = cgiGetVariable("DEVICE_URI"); + fprintf(stderr, "DEBUG: do_am_printer: DEVICE_URI=\"%s\"\n", + ptr ? ptr : "(null)"); + +@@ -697,7 +697,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + } + } + +- if ((var = cgiGetTextfield("DEVICE_URI")) != NULL) ++ if ((var = cgiGetVariable("DEVICE_URI")) != NULL) + { + if ((uriptr = strrchr(var, '|')) != NULL) + { +@@ -1130,7 +1130,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ + ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", + NULL, cgiGetTextfield("PRINTER_INFO")); + +- strlcpy(uri, cgiGetTextfield("DEVICE_URI"), sizeof(uri)); ++ strlcpy(uri, cgiGetVariable("DEVICE_URI"), sizeof(uri)); + + /* + * Strip make and model from URI... +diff --git a/cgi-bin/var.c b/cgi-bin/var.c +index 6ad945d..a4993ff 100644 +--- a/cgi-bin/var.c ++++ b/cgi-bin/var.c +@@ -288,7 +288,7 @@ cgiGetTextfield(const char *name) /* I - Name of form field */ + value = NULL; + } + +- return (value); ++ return (value ? strdup(value) : NULL); + } + + diff --git a/cups.spec b/cups.spec index 1b8a27e..3e3e2db 100644 --- a/cups.spec +++ b/cups.spec @@ -83,6 +83,8 @@ Patch100: cups-lspp.patch #### UPSTREAM PATCHES (starts with 1000) #### # RHEL-49449 Fix checkbox support in web ui Patch1000: 0001-cgi-Fix-checkbox-support-fixes-1008.patch +# RHEL-49447 Fix garbage uri when adding discovered print in web ui +Patch1001: cups-fix-device-uri-in-webui.patch ##### Patches removed because IMHO they aren't no longer needed @@ -310,16 +312,17 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in # Added IEEE 1284 Device ID for a Dymo device (bug #747866). %patch -P 12 -p1 -b .dymo-deviceid -# UPSTREAM PATCHES -# RHEL-49449 Fix checkbox support in web ui -%patch -P 1000 -p1 -b .cgi-checkbox - - %if %{lspp} # LSPP support. %patch -P 100 -p1 -b .lspp %endif +# UPSTREAM PATCHES +# RHEL-49449 Fix checkbox support in web ui +%patch -P 1000 -p1 -b .cgi-checkbox +# RHEL-49447 Fix garbage uri when adding discovered print in web ui +%patch -P 1001 -p1 -b .device-uri-webui + # Log to the system journal by default (bug #1078781, bug #1519331). sed -i -e 's,^ErrorLog .*$,ErrorLog syslog,' conf/cups-files.conf.in @@ -789,6 +792,7 @@ rm -f %{cups_serverbin}/backend/smb %changelog * Wed Aug 14 2024 Zdenek Dohnal - 1:2.4.10-4 - RHEL-54297 cups source rpm doesn't actually build lspp support +- RHEL-49447 Fix garbage uri when adding discovered print in web ui * Tue Jul 23 2024 Zdenek Dohnal - 1:2.4.10-3 - RHEL-49449 Fix checkbox support in web ui