diff OrthancServer/Sources/OrthancFindRequestHandler.cpp @ 4482:8efeaba1b7f9

new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Jan 2021 15:54:30 +0100
parents c1f36fd13730
children f0038043fb97 7053502fbf97
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Thu Jan 28 14:07:49 2021 +0100
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Thu Jan 28 15:54:30 2021 +0100
@@ -592,6 +592,36 @@
   {
     MetricsRegistry::Timer timer(context_.GetMetricsRegistry(), "orthanc_find_scp_duration_ms");
 
+
+    /**
+     * Deal with global configuration
+     **/
+
+    bool caseSensitivePN;
+
+    {
+      OrthancConfiguration::ReaderLock lock;
+      caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN", false);
+
+      RemoteModalityParameters remote;
+      if (!lock.GetConfiguration().LookupDicomModalityUsingAETitle(remote, remoteAet))
+      {
+        if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFind", false))
+        {
+          CLOG(INFO, DICOM) << "C-FIND: Allowing SCU request from unknown modality with AET: " << remoteAet;
+        }
+        else
+        {
+          // This should never happen, given the test at bottom of
+          // "OrthancApplicationEntityFilter::IsAllowedRequest()"
+          throw OrthancException(ErrorCode_InexistentItem,
+                                 "C-FIND: Rejecting SCU request from unknown modality with AET: " + remoteAet);
+        }
+      }
+    }
+
+
+
     /**
      * Possibly apply the user-supplied Lua filter.
      **/
@@ -668,13 +698,6 @@
 
     DatabaseLookup lookup;
 
-    bool caseSensitivePN;
-
-    {
-      OrthancConfiguration::ReaderLock lock;
-      caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN", false);
-    }
-
     for (size_t i = 0; i < query.GetSize(); i++)
     {
       const DicomElement& element = query.GetElement(i);