diff OrthancServer/main.cpp @ 2352:3ab96768d144

Fix issue #52 (DICOM level security association problems)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Jul 2017 17:33:26 +0200
parents 03982a0db696
children 2421c137c304
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Tue Jul 18 08:41:09 2017 +0200
+++ b/OrthancServer/main.cpp	Tue Jul 18 17:33:26 2017 +0200
@@ -158,27 +158,33 @@
   {
   }
 
-  virtual bool IsAllowedConnection(const std::string& /*remoteIp*/,
-                                   const std::string& /*remoteAet*/,
-                                   const std::string& /*calledAet*/)
+  virtual bool IsAllowedConnection(const std::string& remoteIp,
+                                   const std::string& remoteAet,
+                                   const std::string& calledAet)
   {
+    LOG(INFO) << "Incoming connection from AET " << remoteAet
+              << " on IP " << remoteIp << ", calling AET " << calledAet;
+    
     return true;
   }
 
-  virtual bool IsAllowedRequest(const std::string& /*remoteIp*/,
+  virtual bool IsAllowedRequest(const std::string& remoteIp,
                                 const std::string& remoteAet,
-                                const std::string& /*calledAet*/,
+                                const std::string& calledAet,
                                 DicomRequestType type)
   {
-    if (type == DicomRequestType_Store)
+    LOG(INFO) << "Incoming " << Orthanc::EnumerationToString(type) << " request from AET "
+              << remoteAet << " on IP " << remoteIp << ", calling AET " << calledAet;
+    
+    if (type == DicomRequestType_Store &&
+        Configuration::GetGlobalBoolParameter("DicomAlwaysAllowStore", true))
     {
       // Incoming store requests are always accepted, even from unknown AET
       return true;
     }
 
-    if (!Configuration::IsKnownAETitle(remoteAet))
+    if (!Configuration::IsKnownAETitle(remoteAet, remoteIp))
     {
-      LOG(ERROR) << "Unknown remote DICOM modality AET: \"" << remoteAet << "\"";
       return false;
     }
     else