From 81d8eb3af3fb301c1d77cafe1f523c64fd72293d Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 2 Dec 2019 16:47:22 -0500 Subject: [PATCH] Also authenticate web IF. --- tools/ippeveprinter.c | 53 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) 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 : -- 2.39.2