# HG changeset patch # User Sebastien Jodogne # Date 1459845017 -7200 # Node ID d90f737f2dded39355bedda905019787dd6a7862 # Parent 326fdda31b42700645b219a6ce9c46e9ee474a9d warn about the use of privileged ports diff -r 326fdda31b42 -r d90f737f2dde Core/Enumerations.cpp --- a/Core/Enumerations.cpp Tue Apr 05 10:22:19 2016 +0200 +++ b/Core/Enumerations.cpp Tue Apr 05 10:30:17 2016 +0200 @@ -212,10 +212,10 @@ return "The specified path does not point to a directory"; case ErrorCode_HttpPortInUse: - return "The TCP port of the HTTP server is already in use"; + return "The TCP port of the HTTP server is privileged or already in use"; case ErrorCode_DicomPortInUse: - return "The TCP port of the DICOM server is already in use"; + return "The TCP port of the DICOM server is privileged or already in use"; case ErrorCode_BadHttpStatusInRest: return "This HTTP status is not allowed in a REST API"; diff -r 326fdda31b42 -r d90f737f2dde Core/Enumerations.h --- a/Core/Enumerations.h Tue Apr 05 10:22:19 2016 +0200 +++ b/Core/Enumerations.h Tue Apr 05 10:30:17 2016 +0200 @@ -100,8 +100,8 @@ ErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */, ErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */, ErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */, - ErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is already in use */, - ErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is already in use */, + ErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is privileged or already in use */, + ErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is privileged or already in use */, ErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */, ErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */, ErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */, diff -r 326fdda31b42 -r d90f737f2dde OrthancServer/main.cpp --- a/OrthancServer/main.cpp Tue Apr 05 10:22:19 2016 +0200 +++ b/OrthancServer/main.cpp Tue Apr 05 10:30:17 2016 +0200 @@ -541,8 +541,8 @@ PrintErrorCode(ErrorCode_DirectoryOverFile, "The directory to be created is already occupied by a regular file"); PrintErrorCode(ErrorCode_FileStorageCannotWrite, "Unable to create a subdirectory or a file in the file storage"); PrintErrorCode(ErrorCode_DirectoryExpected, "The specified path does not point to a directory"); - PrintErrorCode(ErrorCode_HttpPortInUse, "The TCP port of the HTTP server is already in use"); - PrintErrorCode(ErrorCode_DicomPortInUse, "The TCP port of the DICOM server is already in use"); + PrintErrorCode(ErrorCode_HttpPortInUse, "The TCP port of the HTTP server is privileged or already in use"); + PrintErrorCode(ErrorCode_DicomPortInUse, "The TCP port of the DICOM server is privileged or already in use"); PrintErrorCode(ErrorCode_BadHttpStatusInRest, "This HTTP status is not allowed in a REST API"); PrintErrorCode(ErrorCode_RegularFileExpected, "The specified path does not point to a regular file"); PrintErrorCode(ErrorCode_PathToExecutable, "Unable to get the path to the executable"); @@ -703,6 +703,13 @@ httpServer.Register(context.GetHttpHandler()); + if (httpServer.GetPortNumber() < 1024) + { + LOG(WARNING) << "The HTTP port is privileged (" + << httpServer.GetPortNumber() << " is below 1024), " + << "make sure you run Orthanc as root/administrator"; + } + httpServer.Start(); LOG(WARNING) << "HTTP server listening on port: " << httpServer.GetPortNumber(); @@ -747,6 +754,13 @@ dicomServer.SetApplicationEntityTitle(Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC")); dicomServer.SetApplicationEntityFilter(dicomFilter); + if (dicomServer.GetPortNumber() < 1024) + { + LOG(WARNING) << "The DICOM port is privileged (" + << dicomServer.GetPortNumber() << " is below 1024), " + << "make sure you run Orthanc as root/administrator"; + } + dicomServer.Start(); LOG(WARNING) << "DICOM server listening with AET " << dicomServer.GetApplicationEntityTitle() << " on port: " << dicomServer.GetPortNumber(); diff -r 326fdda31b42 -r d90f737f2dde Plugins/Include/orthanc/OrthancCPlugin.h --- a/Plugins/Include/orthanc/OrthancCPlugin.h Tue Apr 05 10:22:19 2016 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Tue Apr 05 10:30:17 2016 +0200 @@ -238,8 +238,8 @@ OrthancPluginErrorCode_DirectoryOverFile = 2000 /*!< The directory to be created is already occupied by a regular file */, OrthancPluginErrorCode_FileStorageCannotWrite = 2001 /*!< Unable to create a subdirectory or a file in the file storage */, OrthancPluginErrorCode_DirectoryExpected = 2002 /*!< The specified path does not point to a directory */, - OrthancPluginErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is already in use */, - OrthancPluginErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is already in use */, + OrthancPluginErrorCode_HttpPortInUse = 2003 /*!< The TCP port of the HTTP server is privileged or already in use */, + OrthancPluginErrorCode_DicomPortInUse = 2004 /*!< The TCP port of the DICOM server is privileged or already in use */, OrthancPluginErrorCode_BadHttpStatusInRest = 2005 /*!< This HTTP status is not allowed in a REST API */, OrthancPluginErrorCode_RegularFileExpected = 2006 /*!< The specified path does not point to a regular file */, OrthancPluginErrorCode_PathToExecutable = 2007 /*!< Unable to get the path to the executable */, diff -r 326fdda31b42 -r d90f737f2dde Resources/ErrorCodes.json --- a/Resources/ErrorCodes.json Tue Apr 05 10:22:19 2016 +0200 +++ b/Resources/ErrorCodes.json Tue Apr 05 10:30:17 2016 +0200 @@ -327,12 +327,12 @@ { "Code": 2003, "Name": "HttpPortInUse", - "Description": "The TCP port of the HTTP server is already in use" + "Description": "The TCP port of the HTTP server is privileged or already in use" }, { "Code": 2004, "Name": "DicomPortInUse", - "Description": "The TCP port of the DICOM server is already in use" + "Description": "The TCP port of the DICOM server is privileged or already in use" }, { "Code": 2005,