Mercurial > hg > orthanc
diff Core/HttpServer/MongooseServer.cpp @ 1202:476a17cfdf42
Fix crash when bad HTTP credentials are provided
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 27 Oct 2014 13:45:36 +0100 |
parents | 1d60316c3618 |
children | 787059de6b9a |
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp Thu Oct 23 13:14:58 2014 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Mon Oct 27 13:45:36 2014 +0100 @@ -409,9 +409,8 @@ } - static bool Authorize(const MongooseServer& that, - const HttpHandler::Arguments& headers, - HttpOutput& output) + static bool IsAccessGranted(const MongooseServer& that, + const HttpHandler::Arguments& headers) { bool granted = false; @@ -426,15 +425,7 @@ } } - if (!granted) - { - output.SendUnauthorized(ORTHANC_REALM); - return false; - } - else - { - return true; - } + return granted; } @@ -591,8 +582,7 @@ // Authenticate this connection - if (that->IsAuthenticationEnabled() && - !Authorize(*that, headers, output)) + if (that->IsAuthenticationEnabled() && !IsAccessGranted(*that, headers)) { output.SendUnauthorized(ORTHANC_REALM); return;