# HG changeset patch # User Sebastien Jodogne # Date 1500448084 -7200 # Node ID 2421c137c3049f884f52e0c02718b276d12b3de7 # Parent 3ab96768d1445679d17e3fe0174ff35ebe761983 reject connections earlier if DicomAlwaysAllowStore == false diff -r 3ab96768d144 -r 2421c137c304 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Tue Jul 18 17:33:26 2017 +0200 +++ b/OrthancServer/main.cpp Wed Jul 19 09:08:04 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; }