From: Michael R Sweet Date: Mon, 2 Dec 2019 21:47:22 +0000 (-0500) Subject: Also authenticate web IF. X-Git-Tag: v2.3.1~9 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=commitdiff_plain;h=81d8eb3af3fb301c1d77cafe1f523c64fd72293d Also authenticate web IF. --- diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c index 930331e0f..a1c08790e 100644 --- a/tools/ippeveprinter.c +++ b/tools/ippeveprinter.c @@ -5734,8 +5734,7 @@ process_http(ippeve_client_t *client) /* I - Client connection */ * Handle HTTP Upgrade... */ - if (!strcasecmp(httpGetField(client->http, HTTP_FIELD_CONNECTION), - "Upgrade")) + if (!strcasecmp(httpGetField(client->http, HTTP_FIELD_CONNECTION), "Upgrade")) { #ifdef HAVE_SSL if (strstr(httpGetField(client->http, HTTP_FIELD_UPGRADE), "TLS/") != NULL && !httpIsEncrypted(client->http)) @@ -5854,32 +5853,44 @@ process_http(ippeve_client_t *client) /* I - Client connection */ httpFlushWrite(client->http); } } - else if (!strcmp(client->uri, "/")) + else { /* - * Show web status page... + * Authenticate if needed... */ - return (show_status(client)); - } - else if (!strcmp(client->uri, "/media")) - { - /* - * Show web media page... - */ + if ((http_status = authenticate_request(client)) != HTTP_STATUS_CONTINUE) + { + return (respond_http(client, http_status, NULL, NULL, 0)); + } - return (show_media(client)); - } - else if (!strcmp(client->uri, "/supplies")) - { - /* - * Show web supplies page... - */ + if (!strcmp(client->uri, "/")) + { + /* + * Show web status page... + */ + + return (show_status(client)); + } + else if (!strcmp(client->uri, "/media")) + { + /* + * Show web media page... + */ - return (show_supplies(client)); + return (show_media(client)); + } + else if (!strcmp(client->uri, "/supplies")) + { + /* + * Show web supplies page... + */ + + return (show_supplies(client)); + } + else + return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0)); } - else - return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0)); break; case HTTP_STATE_POST :