comparison OrthancServer/Sources/main.cpp @ 4182:1c9c2c41c015

When checking DICOM allowed methods, if there are multiple modalities with the same AET, differentiate them from the calling IP
author Alain Mazy <alain@mazy.be>
date Wed, 09 Sep 2020 14:46:59 +0200
parents 1ec3e1e18f50
children 9ce5c89328f5
comparison
equal deleted inserted replaced
4178:3576616904d3 4182:1c9c2c41c015
321 } 321 }
322 else 322 else
323 { 323 {
324 OrthancConfiguration::ReaderLock lock; 324 OrthancConfiguration::ReaderLock lock;
325 325
326 RemoteModalityParameters modality; 326 std::list<RemoteModalityParameters> modalities;
327 if (lock.GetConfiguration().LookupDicomModalityUsingAETitle(modality, remoteAet)) 327 if (lock.GetConfiguration().LookupDicomModalitiesUsingAETitle(modalities, remoteAet))
328 { 328 {
329 return modality.IsRequestAllowed(type); 329 if (modalities.size() == 1) // don't check the IP if there's only one modality with this AET
330 {
331 return modalities.front().IsRequestAllowed(type);
332 }
333 else // if there are multiple modalities with the same AET, check the one matching this IP
334 {
335 for (std::list<RemoteModalityParameters>::const_iterator it = modalities.begin(); it != modalities.end(); ++it)
336 {
337 if (it->GetHost() == remoteIp)
338 {
339 return it->IsRequestAllowed(type);
340 }
341 }
342
343 LOG(WARNING) << "Unable to check DICOM authorization for AET " << remoteAet
344 << " on IP " << remoteIp << ", " << modalities.size()
345 << " modalites found with this AET but none of them matching the IP";
346 }
347 return false;
330 } 348 }
331 else 349 else
332 { 350 {
333 return false; 351 return false;
334 } 352 }