Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 2375:3ec85ff48374
New security-related options: "DicomAlwaysAllowEcho"
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Aug 2017 16:45:08 +0200 |
parents | 2421c137c304 |
children | b8969010b534 |
comparison
equal
deleted
inserted
replaced
2374:7087141c74b9 | 2375:3ec85ff48374 |
---|---|
150 | 150 |
151 class OrthancApplicationEntityFilter : public IApplicationEntityFilter | 151 class OrthancApplicationEntityFilter : public IApplicationEntityFilter |
152 { | 152 { |
153 private: | 153 private: |
154 ServerContext& context_; | 154 ServerContext& context_; |
155 bool alwaysAllowEcho_; | |
155 bool alwaysAllowStore_; | 156 bool alwaysAllowStore_; |
156 | 157 |
157 public: | 158 public: |
158 OrthancApplicationEntityFilter(ServerContext& context) : | 159 OrthancApplicationEntityFilter(ServerContext& context) : |
159 context_(context) | 160 context_(context) |
160 { | 161 { |
162 alwaysAllowEcho_ = Configuration::GetGlobalBoolParameter("DicomAlwaysAllowEcho", true); | |
161 alwaysAllowStore_ = Configuration::GetGlobalBoolParameter("DicomAlwaysAllowStore", true); | 163 alwaysAllowStore_ = Configuration::GetGlobalBoolParameter("DicomAlwaysAllowStore", true); |
162 } | 164 } |
163 | 165 |
164 virtual bool IsAllowedConnection(const std::string& remoteIp, | 166 virtual bool IsAllowedConnection(const std::string& remoteIp, |
165 const std::string& remoteAet, | 167 const std::string& remoteAet, |
166 const std::string& calledAet) | 168 const std::string& calledAet) |
167 { | 169 { |
168 LOG(INFO) << "Incoming connection from AET " << remoteAet | 170 LOG(INFO) << "Incoming connection from AET " << remoteAet |
169 << " on IP " << remoteIp << ", calling AET " << calledAet; | 171 << " on IP " << remoteIp << ", calling AET " << calledAet; |
170 | 172 |
171 return (alwaysAllowStore_ || | 173 return (alwaysAllowEcho_ || |
174 alwaysAllowStore_ || | |
172 Configuration::IsKnownAETitle(remoteAet, remoteIp)); | 175 Configuration::IsKnownAETitle(remoteAet, remoteIp)); |
173 } | 176 } |
174 | 177 |
175 virtual bool IsAllowedRequest(const std::string& remoteIp, | 178 virtual bool IsAllowedRequest(const std::string& remoteIp, |
176 const std::string& remoteAet, | 179 const std::string& remoteAet, |
178 DicomRequestType type) | 181 DicomRequestType type) |
179 { | 182 { |
180 LOG(INFO) << "Incoming " << Orthanc::EnumerationToString(type) << " request from AET " | 183 LOG(INFO) << "Incoming " << Orthanc::EnumerationToString(type) << " request from AET " |
181 << remoteAet << " on IP " << remoteIp << ", calling AET " << calledAet; | 184 << remoteAet << " on IP " << remoteIp << ", calling AET " << calledAet; |
182 | 185 |
183 if (type == DicomRequestType_Store && | 186 if (type == DicomRequestType_Echo && |
184 alwaysAllowStore_) | 187 alwaysAllowEcho_) |
185 { | 188 { |
186 // Incoming store requests are always accepted, even from unknown AET | 189 // Incoming C-Echo requests are always accepted, even from unknown AET |
190 return true; | |
191 } | |
192 else if (type == DicomRequestType_Store && | |
193 alwaysAllowStore_) | |
194 { | |
195 // Incoming C-Store requests are always accepted, even from unknown AET | |
187 return true; | 196 return true; |
188 } | 197 } |
189 else if (!Configuration::IsKnownAETitle(remoteAet, remoteIp)) | 198 else if (!Configuration::IsKnownAETitle(remoteAet, remoteIp)) |
190 { | 199 { |
191 return false; | 200 return false; |