From 2c5bb0e1c2b0af8f00259c9ab3c327d2cd3a5a04 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 21 Nov 2001 03:19:13 +0000 Subject: [PATCH] Prevent segv in ap_note_basic_auth_failure() when no AuthName is configured PR: Obtained from: Submitted by: John Sterling Reviewed by: dougm git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92072 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 2 ++ server/protocol.c | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 0d53809615..0527f520dc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ Changes with Apache 2.0.29-dev + *) Prevent segv in ap_note_basic_auth_failure() when no AuthName is + configured [John Sterling ] *) Fix apxs to use sbindir. [Henri Gomez ] diff --git a/server/protocol.c b/server/protocol.c index 37437b03ca..ab79ec1b0e 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -756,15 +756,25 @@ AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r) AP_DECLARE(void) ap_note_auth_failure(request_rec *r) { - if (!strcasecmp(ap_auth_type(r), "Basic")) - ap_note_basic_auth_failure(r); - else if (!strcasecmp(ap_auth_type(r), "Digest")) - ap_note_digest_auth_failure(r); + const char *type = ap_auth_type(r); + if (type) { + if (!strcasecmp(type, "Basic")) + ap_note_basic_auth_failure(r); + else if (!strcasecmp(type, "Digest")) + ap_note_digest_auth_failure(r); + } + /* XXX: else there is no AuthType configured + * should we log an error or something ? + */ } AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r) { - if (strcasecmp(ap_auth_type(r), "Basic")) + const char *type = ap_auth_type(r); + /* if there is no AuthType configure or it is something other than + * Basic, let ap_note_auth_failure() deal with it + */ + if (!type || strcasecmp(type, "Basic")) ap_note_auth_failure(r); else apr_table_setn(r->err_headers_out, -- 2.50.1