Mercurial > hg > orthanc
comparison OrthancServer/Sources/main.cpp @ 4954:e1495a34cd39 more-tags
integration mainline->more-tags
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Mar 2022 19:11:56 +0100 |
parents | b7ce2bb6b881 47d734fa30f6 |
children | e95fadefeb72 |
comparison
equal
deleted
inserted
replaced
4950:3778a0433dd3 | 4954:e1495a34cd39 |
---|---|
428 return false; | 428 return false; |
429 } | 429 } |
430 } | 430 } |
431 else | 431 else |
432 { | 432 { |
433 // If there are multiple modalities with the same AET, consider the one matching this IP | 433 // If there are multiple modalities with the same AET, consider the one matching this IP |
434 // or check if the operation is allowed for all modalities | |
435 bool allowedForAllModalities = true; | |
436 | |
434 for (std::list<RemoteModalityParameters>::const_iterator | 437 for (std::list<RemoteModalityParameters>::const_iterator |
435 it = modalities.begin(); it != modalities.end(); ++it) | 438 it = modalities.begin(); it != modalities.end(); ++it) |
436 { | 439 { |
437 if (it->GetHost() == remoteIp) | 440 if (it->IsRequestAllowed(type)) |
438 { | 441 { |
439 if (it->IsRequestAllowed(type)) | 442 if (checkIp && |
443 it->GetHost() == remoteIp) | |
440 { | 444 { |
441 return true; | 445 return true; |
442 } | 446 } |
443 else | 447 } |
444 { | 448 else |
445 ReportDisallowedCommand(remoteIp, remoteAet, type); | 449 { |
446 return false; | 450 allowedForAllModalities = false; |
447 } | |
448 } | 451 } |
449 } | 452 } |
450 | 453 |
451 LOG(WARNING) << "DICOM authorization rejected for AET " << remoteAet | 454 if (allowedForAllModalities) |
452 << " on IP " << remoteIp << ": " << modalities.size() | 455 { |
453 << " modalites found with this AET in configuration option " | 456 return true; |
454 << "\"DicomModalities\", but none of them matches the IP"; | 457 } |
455 return false; | 458 else |
459 { | |
460 ReportDisallowedCommand(remoteIp, remoteAet, type); | |
461 | |
462 if (checkIp) | |
463 { | |
464 LOG(WARNING) << "DICOM authorization rejected for AET " << remoteAet | |
465 << " on IP " << remoteIp << ": " << modalities.size() | |
466 << " modalites found with this AET in configuration option " | |
467 << "\"DicomModalities\", but the operation is allowed for none " | |
468 << "of them matching the IP"; | |
469 } | |
470 else | |
471 { | |
472 LOG(WARNING) << "DICOM authorization rejected for AET " << remoteAet | |
473 << " on IP " << remoteIp << ": " << modalities.size() | |
474 << " modalites found with this AET in configuration option " | |
475 << "\"DicomModalities\", but the operation is not allowed for" | |
476 << "all of them"; | |
477 } | |
478 return false; | |
479 } | |
456 } | 480 } |
457 } | 481 } |
458 } | 482 } |
459 | 483 |
460 | 484 |
1155 root.push_back("webdav"); | 1179 root.push_back("webdav"); |
1156 httpServer.Register(root, new OrthancWebDav(context, allowDelete, allowUpload)); | 1180 httpServer.Register(root, new OrthancWebDav(context, allowDelete, allowUpload)); |
1157 } | 1181 } |
1158 } | 1182 } |
1159 | 1183 |
1184 #if ORTHANC_ENABLE_PLUGINS == 1 | |
1185 if (plugins != NULL) | |
1186 { | |
1187 plugins->RegisterWebDavCollections(httpServer); | |
1188 } | |
1189 #endif | |
1190 | |
1160 MyHttpExceptionFormatter exceptionFormatter(httpDescribeErrors, plugins); | 1191 MyHttpExceptionFormatter exceptionFormatter(httpDescribeErrors, plugins); |
1161 | 1192 |
1162 httpServer.SetIncomingHttpRequestFilter(httpFilter); | 1193 httpServer.SetIncomingHttpRequestFilter(httpFilter); |
1163 httpServer.SetHttpExceptionFormatter(exceptionFormatter); | 1194 httpServer.SetHttpExceptionFormatter(exceptionFormatter); |
1164 httpServer.Register(context.GetHttpHandler()); | 1195 httpServer.Register(context.GetHttpHandler()); |