version 1.133, 2004/04/08 14:54:43
|
version 1.137, 2004/06/29 16:43:36
|
|
|
#include <Pegasus/Config/ConfigManager.h> | #include <Pegasus/Config/ConfigManager.h> |
#include <Pegasus/Client/CIMClient.h> | #include <Pegasus/Client/CIMClient.h> |
#include <Pegasus/Server/ShutdownService.h> | #include <Pegasus/Server/ShutdownService.h> |
#include <Pegasus/Common/Destroyer.h> |
|
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
int cimserver_run( int argc, char** argv, Boolean shutdownOption ); | int cimserver_run( int argc, char** argv, Boolean shutdownOption ); |
| |
|
Uint32 parentPid = 0; |
|
|
#if defined(PEGASUS_OS_TYPE_WINDOWS) | #if defined(PEGASUS_OS_TYPE_WINDOWS) |
# include "cimserver_windows.cpp" | # include "cimserver_windows.cpp" |
#elif defined(PEGASUS_OS_TYPE_UNIX) | #elif defined(PEGASUS_OS_TYPE_UNIX) |
|
|
pegasusHome = OS400_DEFAULT_PEGASUS_HOME; | pegasusHome = OS400_DEFAULT_PEGASUS_HOME; |
#endif | #endif |
| |
|
|
#ifndef PEGASUS_OS_TYPE_WINDOWS | #ifndef PEGASUS_OS_TYPE_WINDOWS |
// | // |
// Get environment variables: | // Get environment variables: |
|
|
pegasusHome = home; | pegasusHome = home; |
} | } |
#else | #else |
|
#if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS) |
|
pegasusHome = AIX_RELEASE_PEGASUS_HOME; |
|
#else |
const char* tmp = getenv("PEGASUS_HOME"); | const char* tmp = getenv("PEGASUS_HOME"); |
| |
if (tmp) | if (tmp) |
|
|
pegasusHome = tmp; | pegasusHome = tmp; |
} | } |
#endif | #endif |
|
#endif |
| |
FileSystem::translateSlashes(pegasusHome); | FileSystem::translateSlashes(pegasusHome); |
#else | #else |
|
|
// Get an instance of the Config Manager. | // Get an instance of the Config Manager. |
// | // |
configManager = ConfigManager::getInstance(); | configManager = ConfigManager::getInstance(); |
|
configManager->useConfigFiles = true; |
| |
#ifdef PEGASUS_OS_OS400 | #ifdef PEGASUS_OS_OS400 |
// In a special startup case for IBM OS400, when the server is | // In a special startup case for IBM OS400, when the server is |
|
|
// one of the variables is true. | // one of the variables is true. |
Boolean enableHttpConnection = false; | Boolean enableHttpConnection = false; |
Boolean enableHttpsConnection = false; | Boolean enableHttpsConnection = false; |
|
Boolean enableSSLExportClientVerification = false; |
| |
if (os400StartupOption == false) | if (os400StartupOption == false) |
{ | { |
|
|
configManager->getCurrentValue("enableHttpConnection"), "true"); | configManager->getCurrentValue("enableHttpConnection"), "true"); |
enableHttpsConnection = String::equal( | enableHttpsConnection = String::equal( |
configManager->getCurrentValue("enableHttpsConnection"), "true"); | configManager->getCurrentValue("enableHttpsConnection"), "true"); |
|
enableSSLExportClientVerification = String::equal( |
|
configManager->getCurrentValue("enableSSLExportClientVerification"), "true"); |
} | } |
#else | #else |
Boolean enableHttpConnection = String::equal( | Boolean enableHttpConnection = String::equal( |
configManager->getCurrentValue("enableHttpConnection"), "true"); | configManager->getCurrentValue("enableHttpConnection"), "true"); |
Boolean enableHttpsConnection = String::equal( | Boolean enableHttpsConnection = String::equal( |
configManager->getCurrentValue("enableHttpsConnection"), "true"); | configManager->getCurrentValue("enableHttpsConnection"), "true"); |
|
Boolean enableSSLExportClientVerification = String::equal( |
|
configManager->getCurrentValue("enableSSLExportClientVerification"), "true"); |
#endif | #endif |
| |
// Make sure at least one connection is enabled | // Make sure at least one connection is enabled |
|
|
| |
Uint32 portNumberHttps; | Uint32 portNumberHttps; |
Uint32 portNumberHttp; | Uint32 portNumberHttp; |
|
Uint32 portNumberExportHttps; |
| |
if (enableHttpsConnection) | if (enableHttpsConnection) |
{ | { |
|
|
portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, port); | portNumberHttp = System::lookupPort(WBEM_HTTP_SERVICE_NAME, port); |
} | } |
| |
|
if (enableSSLExportClientVerification) |
|
{ |
|
// |
|
// No config property is looked up to get the default port number. |
|
// Lookup the port defined in /etc/services for the service name |
|
// wbem-exp-https and bind to that port. If the service is not defined |
|
// then log a warning message and do not start the cimserver. |
|
// |
|
Uint32 port = 0; |
|
|
|
portNumberExportHttps = System::lookupPort(WBEM_EXPORT_HTTPS_SERVICE_NAME, port); |
|
|
|
if (portNumberExportHttps == 0) |
|
{ |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
|
"src.Server.cimserver.EXPORT_HTTPS_PORT_NOT_DEFINED", |
|
"Port not defined for the service wbem-exp-https. CIMServer will not be started."); |
|
|
|
MessageLoaderParms parms("src.Server.cimserver.EXPORT_HTTPS_PORT_NOT_DEFINED", |
|
"Port not defined for the service wbem-exp-https. CIMServer will not be started."); |
|
|
|
cerr << MessageLoader::getMessage(parms) << endl; |
|
|
|
return(1); |
|
} |
|
} |
// Put out startup up message. | // Put out startup up message. |
#if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \ | #if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \ |
!defined(PEGASUS_OS_OS400) | !defined(PEGASUS_OS_OS400) |
|
|
MessageLoader::_useProcessLocale = false; | MessageLoader::_useProcessLocale = false; |
//l10n | //l10n |
| |
|
// Get the parent's PID before forking |
|
parentPid = System::getPID(); |
|
|
// do we need to run as a daemon ? | // do we need to run as a daemon ? |
if (daemonOption) | if (daemonOption) |
{ | { |
|
|
| |
if (enableHttpConnection) | if (enableHttpConnection) |
{ | { |
server.addAcceptor(false, portNumberHttp, false); |
server.addAcceptor(false, portNumberHttp, false, false); |
//l10n | //l10n |
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, | //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
//"Listening on HTTP port $0.", portNumberHttp); | //"Listening on HTTP port $0.", portNumberHttp); |
|
|
} | } |
if (enableHttpsConnection) | if (enableHttpsConnection) |
{ | { |
server.addAcceptor(false, portNumberHttps, true); |
server.addAcceptor(false, portNumberHttps, true, false); |
//l10n | //l10n |
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, | //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
//"Listening on HTTPS port $0.", portNumberHttps); | //"Listening on HTTPS port $0.", portNumberHttps); |
|
|
"src.Server.cimserver.LISTENING_ON_HTTPS_PORT", | "src.Server.cimserver.LISTENING_ON_HTTPS_PORT", |
"Listening on HTTPS port $0.", portNumberHttps); | "Listening on HTTPS port $0.", portNumberHttps); |
} | } |
|
if (enableSSLExportClientVerification) |
|
{ |
|
server.addAcceptor(false, portNumberExportHttps, true, true); |
|
|
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
|
"src.Server.cimserver.LISTENING_ON_EXPORT_HTTPS_PORT", |
|
"Listening on Export HTTPS port $0.", portNumberExportHttps); |
|
} |
|
|
#ifdef PEGASUS_LOCAL_DOMAIN_SOCKET | #ifdef PEGASUS_LOCAL_DOMAIN_SOCKET |
server.addAcceptor(true, 0, false); |
server.addAcceptor(true, 0, false, false); |
//l10n | //l10n |
//Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, | //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
//"Listening on local connection socket."); | //"Listening on local connection socket."); |
|
|
"Listening on HTTPS port $0.", portNumberHttps); | "Listening on HTTPS port $0.", portNumberHttps); |
cout << MessageLoader::getMessage(parms) << endl; | cout << MessageLoader::getMessage(parms) << endl; |
} | } |
|
if (enableSSLExportClientVerification) |
|
{ |
|
MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_EXPORT_HTTPS_PORT", |
|
"Listening on Export HTTPS port $0.", portNumberExportHttps); |
|
|
|
cout << MessageLoader::getMessage(parms) << endl; |
|
} |
|
|
# ifdef PEGASUS_LOCAL_DOMAIN_SOCKET | # ifdef PEGASUS_LOCAL_DOMAIN_SOCKET |
//l10n | //l10n |
//cout << "Listening on local connection socket" << endl; | //cout << "Listening on local connection socket" << endl; |