changeset 2355:e2e5dde95027

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Jul 2017 09:10:02 +0200
parents 415450f11cc7 (current diff) 2421c137c304 (diff)
children 7b3b82d426ed
files
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Wed Jul 19 09:09:53 2017 +0200
+++ b/OrthancServer/main.cpp	Wed Jul 19 09:10:02 2017 +0200
@@ -152,10 +152,13 @@
 {
 private:
   ServerContext& context_;
+  bool           alwaysAllowStore_;
 
 public:
-  OrthancApplicationEntityFilter(ServerContext& context) : context_(context)
+  OrthancApplicationEntityFilter(ServerContext& context) :
+    context_(context)
   {
+    alwaysAllowStore_ = Configuration::GetGlobalBoolParameter("DicomAlwaysAllowStore", true);
   }
 
   virtual bool IsAllowedConnection(const std::string& remoteIp,
@@ -164,8 +167,9 @@
   {
     LOG(INFO) << "Incoming connection from AET " << remoteAet
               << " on IP " << remoteIp << ", calling AET " << calledAet;
-    
-    return true;
+
+    return (alwaysAllowStore_ ||
+            Configuration::IsKnownAETitle(remoteAet, remoteIp));
   }
 
   virtual bool IsAllowedRequest(const std::string& remoteIp,
@@ -177,13 +181,12 @@
               << remoteAet << " on IP " << remoteIp << ", calling AET " << calledAet;
     
     if (type == DicomRequestType_Store &&
-        Configuration::GetGlobalBoolParameter("DicomAlwaysAllowStore", true))
+        alwaysAllowStore_)
     {
       // Incoming store requests are always accepted, even from unknown AET
       return true;
     }
-
-    if (!Configuration::IsKnownAETitle(remoteAet, remoteIp))
+    else if (!Configuration::IsKnownAETitle(remoteAet, remoteIp))
     {
       return false;
     }