changeset 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 97089aa85b5f
children e85e668d2147 6babe0c7aa27
files Core/HttpServer/MongooseServer.cpp NEWS
diffstat 2 files changed, 5 insertions(+), 14 deletions(-) [+]
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;
--- a/NEWS	Thu Oct 23 13:14:58 2014 +0200
+++ b/NEWS	Mon Oct 27 13:45:36 2014 +0100
@@ -5,6 +5,7 @@
 * Sample plugin framework to serve static resources
 * Fix issue 21 (Microsoft Visual Studio precompiled headers)
 * Fix issue 22 (Error decoding multi-frame instances)
+* Fix crash when bad HTTP credentials are provided
 
 
 Version 0.8.4 (2014/09/19)