From db58f80d5f1aca238458d2e9d05a2bb75d06abd4 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Fri, 14 Feb 2014 18:15:39 +0200 Subject: [PATCH] http: fix endless loop with failed Basic auth After we have tried Basic authentication once for a HTTP request and we receive a 401 Unauthorized response then we need to abort the request in order to prevent an endless loop. --- src/core/sipe-http-request.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/core/sipe-http-request.c b/src/core/sipe-http-request.c index 8777f57e..d522592e 100644 --- a/src/core/sipe-http-request.c +++ b/src/core/sipe-http-request.c @@ -286,6 +286,21 @@ static gboolean sipe_http_request_response_unauthorized(struct sipe_core_private return(failed); } + if (conn_public->cached_authorization) { + /* + * The "Basic" scheme doesn't have any state. + * + * If we enter here then we have already tried "Basic" + * authentication once for this request and it was + * rejected by the server. As all future requests will + * also be rejected, we need to abort here in order to + * prevent an endless request/401/request/... loop. + */ + SIPE_DEBUG_INFO("sipe_http_request_response_unauthorized: Basic authentication has failed for host '%s', please check user name and password!", + conn_public->host); + return(failed); + } + } else { #if defined(HAVE_GSSAPI_GSSAPI_H) || defined(HAVE_SSPI) #define DEBUG_STRING ", NTLM and Negotiate" -- 2.11.4.GIT