Mercurial > hg > orthanc
diff OrthancServer/main.cpp @ 2353:2421c137c304
reject connections earlier if DicomAlwaysAllowStore == false
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Jul 2017 09:08:04 +0200 |
parents | 3ab96768d144 |
children | 3ec85ff48374 |
line wrap: on
line diff
--- 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; }