]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Return HTTP status 404 for non-existing classes and printers (Issue #423)
authorMichael R Sweet <msweet@msweet.org>
Sun, 11 Feb 2024 14:21:43 +0000 (09:21 -0500)
committerMichael R Sweet <msweet@msweet.org>
Sun, 11 Feb 2024 14:21:43 +0000 (09:21 -0500)
CHANGES.md
scheduler/client.c

index 21f362a4bc15e8c827754377478389a601df33c7..64a6edef0d5a960f841aefa098aac7b71c4241bd 100644 (file)
@@ -25,6 +25,8 @@ Changes in CUPS v2.5b1 (TBA)
   handling (fixes CVE-2023-34241)
 - Fixed hanging of `lpstat` on Solaris (Issue #156)
 - Fixed Digest authentication support (Issue #260)
+- Fixed the web interface not showing an error for a non-existent printer
+  (Issue #423)
 - Fixed extensive looping in scheduler (Issue #604)
 - Fixed printing multiple files on specific printers (Issue #643)
 - Fixed printing of jobs with job name longer than 255 chars on older printers (Issue #644)
index 534b60eef37909689e34fb160afd81491c9b04d7..7d44744d72d9b8f1b8a1f051ad0c9e4a15bdd179 100644 (file)
@@ -1106,8 +1106,19 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
              }
              else if (!strncmp(con->uri, "/classes", 8))
              {
+               if (strlen(con->uri) > 9 && !cupsdFindClass(con->uri + 9))
+               {
+                 if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
+                 {
+                   cupsdCloseClient(con);
+                   return;
+                 }
+
+                 break;
+               }
+
                cupsdSetStringf(&con->command, "%s/cgi-bin/classes.cgi", ServerBin);
-                if (con->uri[8] && con->uri[9])
+               if (con->uri[8] && con->uri[9])
                  cupsdSetString(&con->options, con->uri + 8);
                else
                  cupsdSetString(&con->options, NULL);
@@ -1122,6 +1133,17 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
              }
               else if (!strncmp(con->uri, "/printers", 9))
              {
+               if (strlen(con->uri) > 10 && !cupsdFindPrinter(con->uri + 10))
+               {
+                 if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
+                 {
+                   cupsdCloseClient(con);
+                   return;
+                 }
+
+                 break;
+               }
+
                cupsdSetStringf(&con->command, "%s/cgi-bin/printers.cgi", ServerBin);
                 if (con->uri[9] && con->uri[10])
                  cupsdSetString(&con->options, con->uri + 9);