(file) Return to cimserver.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Server

Diff for /pegasus/src/Server/cimserver.cpp between version 1.228 and 1.243

version 1.228, 2008/12/16 18:58:05 version 1.243, 2012/11/29 09:57:30
Line 96 
Line 96 
 #include <Service/ServerRunStatus.h> #include <Service/ServerRunStatus.h>
  
 #if defined(PEGASUS_OS_ZOS) #if defined(PEGASUS_OS_ZOS)
 #include <Pegasus/Common/SetFileDescriptorToEBCDICEncoding.h>  #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>
 #include <Service/ARM_zOS.h> #include <Service/ARM_zOS.h>
   #include <Service/TimeZone_zOS.h>
   #include <Service/WaitForTCPIP_zOS.h>
 # ifdef PEGASUS_ZOS_SECURITY # ifdef PEGASUS_ZOS_SECURITY
 // This include file will not be provided in the OpenGroup CVS for now. // This include file will not be provided in the OpenGroup CVS for now.
 // Do NOT try to include it in your compile // Do NOT try to include it in your compile
Line 130 
Line 132 
  
 //Windows service variables are not defined elsewhere in the product //Windows service variables are not defined elsewhere in the product
 //enable ability to override these //enable ability to override these
   #ifndef PEGASUS_FLAVOR
 #ifndef PEGASUS_SERVICE_NAME #ifndef PEGASUS_SERVICE_NAME
 #define PEGASUS_SERVICE_NAME "Pegasus CIM Object Manager"; #define PEGASUS_SERVICE_NAME "Pegasus CIM Object Manager";
 #endif #endif
 #ifndef PEGASUS_SERVICE_DESCRIPTION #ifndef PEGASUS_SERVICE_DESCRIPTION
 #define PEGASUS_SERVICE_DESCRIPTION "Pegasus CIM Object Manager Service"; #define PEGASUS_SERVICE_DESCRIPTION "Pegasus CIM Object Manager Service";
 #endif #endif
   #else
   #ifndef PEGASUS_SERVICE_NAME
   #define PEGASUS_SERVICE_NAME PEGASUS_FLAVOR " Pegasus CIM Object Manager"
   #endif
   #ifndef PEGASUS_SERVICE_DESCRIPTION
   #define PEGASUS_SERVICE_DESCRIPTION PEGASUS_FLAVOR \
               " Pegasus CIM Object Manager Service";
   #endif
   #endif
  
 #ifdef PEGASUS_OS_PASE #ifdef PEGASUS_OS_PASE
 #include <as400_protos.h> //for _SETCCSID #include <as400_protos.h> //for _SETCCSID
Line 275 
Line 287 
     usage.append(" [ [ options ] | [ configProperty=value, ... ] ]\n");     usage.append(" [ [ options ] | [ configProperty=value, ... ] ]\n");
     usage.append("  options\n");     usage.append("  options\n");
     usage.append("    -v, --version   - displays CIM Server version number\n");     usage.append("    -v, --version   - displays CIM Server version number\n");
       usage.append("    --status        - displays the running status of"
           " the CIM Server\n");
     usage.append("    -h, --help      - prints this help message\n");     usage.append("    -h, --help      - prints this help message\n");
     usage.append("    -s              - shuts down CIM Server\n");     usage.append("    -s              - shuts down CIM Server\n");
 #if !defined(PEGASUS_USE_RELEASE_DIRS) #if !defined(PEGASUS_USE_RELEASE_DIRS)
Line 339 
Line 353 
         Thread::clearLanguages();         Thread::clearLanguages();
         delete dummyInitialThread;         delete dummyInitialThread;
     }     }
       _serverRunStatus.setServerNotRunning();
 } }
  
 // //
Line 425 
Line 440 
  
 #endif /* PEGASUS_ENABLE_PRIVILEGE_SEPARATION */ #endif /* PEGASUS_ENABLE_PRIVILEGE_SEPARATION */
  
   static void _initConfigProperty(const String &propName, Uint32 value)
   {
       char strValue[22];
       Uint32 n;
       const char *startP = Uint32ToString(
           strValue,
           value,
           n);
       ConfigManager::getInstance()->initCurrentValue(propName, String(startP, n));
   }
   static void _restrictListening(
       ConfigManager* configManager,
       const String &listenOn,
       const Uint32 &portNumberHttp,
       const Boolean useSSL)
   {
       static Array<HostAddress> laddr = configManager ->getListenAddress(
                                             listenOn);
       for(Uint32 i = 0, n = laddr.size(); i < n; ++i)
       {
           if(laddr[i].getAddressType() == HostAddress::AT_IPV6)
           {
   #ifdef PEGASUS_ENABLE_IPV6
               _cimServer->addAcceptor(HTTPAcceptor::IPV6_CONNECTION,
                       portNumberHttp, useSSL,
                       &laddr[i]);
   #endif
           }
           else if(laddr[i].getAddressType() == HostAddress::AT_IPV4)
           {
               _cimServer->addAcceptor(HTTPAcceptor::IPV4_CONNECTION,
                       portNumberHttp, useSSL,
                       &laddr[i]);
           }
       }
   }
   
 ///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
 //  MAIN //  MAIN
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Line 451 
Line 503 
     }     }
     // Need to initialize timezone information in the     // Need to initialize timezone information in the
     // initial processing thread (IPT)     // initial processing thread (IPT)
     tzset();      initialize_zOS_timezone();
 #endif #endif
  
 #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES) #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_HAS_MESSAGES)
Line 503 
Line 555 
  
 #endif /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */ #endif /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
  
         // Get help, version, and shutdown options          // Get help, version, status and shutdown options
  
         for (int i = 1; i < argc; )         for (int i = 1; i < argc; )
         {         {
Line 514 
Line 566 
                 Executor::daemonizeExecutor();                 Executor::daemonizeExecutor();
                 exit(0);                 exit(0);
             }             }
               if (strcmp(arg, "--status") == 0)
               {
                   int retValue = 0;
                   if (_serverRunStatus.isServerRunning())
                   {
                       MessageLoaderParms parms(
                           "src.Server.cimserver.CIMSERVER_RUNNING",
                           "The CIM Server is running.");
                       cout << MessageLoader::getMessage(parms) << endl;
                   }
                   else
                   {
                       MessageLoaderParms parms(
                           "src.Server.cimserver.CIMSERVER_NOT_RUNNING",
                           "The CIM Server is not running.");
                       cout << MessageLoader::getMessage(parms) << endl;
                       retValue = 2;
                   }
                   Executor::daemonizeExecutor();
                   exit(retValue);
               }
             else if (strcmp(arg, "--version") == 0)             else if (strcmp(arg, "--version") == 0)
             {             {
                 cout << _cimServerProcess->getCompleteVersion() << endl;                 cout << _cimServerProcess->getCompleteVersion() << endl;
Line 798 
Line 871 
         //         //
         if (shutdownOption)         if (shutdownOption)
         {         {
   #if defined(PEGASUS_OS_ZOS) && defined(PEGASUS_ZOS_SECURITY)
               // This checks whether user is authorized to stop the
               // CIM Server. When unauthorized a message is logged to
               // to the user and program exits.
               shutdownCheckProfileCIMSERVclassWBEM();
               // Depending on the success of the previous check we may not
               // reach this code!!!
   #endif
             String configTimeout =             String configTimeout =
                 configManager->getCurrentValue("shutdownTimeout");                 configManager->getCurrentValue("shutdownTimeout");
             Uint32 timeoutValue =             Uint32 timeoutValue =
Line 832 
Line 913 
         return 1;         return 1;
     }     }
  
 #if defined(PEGASUS_OS_ZOS) && defined(PEGASUS_ZOS_SECURITY)  #if defined(PEGASUS_OS_ZOS)
   #  if defined(PEGASUS_ZOS_SECURITY)
     startupCheckBPXServer(true);     startupCheckBPXServer(true);
     startupCheckProfileCIMSERVclassWBEM();     startupCheckProfileCIMSERVclassWBEM();
     startupEnableMSC();     startupEnableMSC();
 #endif #endif
       startupWaitForTCPIP();
   #endif
  
 #if defined(PEGASUS_DEBUG) #if defined(PEGASUS_DEBUG)
     // Put out startup up message.     // Put out startup up message.
Line 844 
Line 928 
         _cimServerProcess->getCompleteVersion() << endl;         _cimServerProcess->getCompleteVersion() << endl;
 #endif #endif
  
       // Force initialization of hostname and fullyQualifiedHostName through
       // retrieving current value from Configuration Manager
       // - this will run getCurrentValue() in DefaultPropertyOwner.cpp
       configManager->getCurrentValue("hostname");
       configManager->getCurrentValue("fullyQualifiedHostName");
   
     // reset message loading to NON-process locale     // reset message loading to NON-process locale
     MessageLoader::_useProcessLocale = false;     MessageLoader::_useProcessLocale = false;
  
Line 974 
Line 1064 
         }         }
         else         else
         {         {
             MessageLoaderParms parms(              PEG_TRACE_CSTRING(TRC_SERVER,Tracer::LEVEL4,
                 "src.Server.cimserver.IPV6_STACK_NOT_ACTIVE",  
                 "IPv6 stack is not active, using IPv4 socket.");                 "IPv6 stack is not active, using IPv4 socket.");
             Logger::put_l(  
                 Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
                 parms);  
 #if defined(PEGASUS_DEBUG)  
             cout << MessageLoader::getMessage(parms) << endl;  
 #endif  
         }         }
 #endif #endif
         if (!addIP6Acceptor)         if (!addIP6Acceptor)
Line 1004 
Line 1087 
         {         {
             Uint32 portNumberHttp = 0;             Uint32 portNumberHttp = 0;
             String httpPort = configManager->getCurrentValue("httpPort");             String httpPort = configManager->getCurrentValue("httpPort");
             if (httpPort == String::EMPTY)              if (httpPort.size() == 0)
             {             {
                 //                 //
                 // Look up the WBEM-HTTP port number                 // Look up the WBEM-HTTP port number
                 //                 //
                 portNumberHttp = System::lookupPort(                 portNumberHttp = System::lookupPort(
                     WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);                     WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT);
                   _initConfigProperty("httpPort", portNumberHttp);
             }             }
             else             else
             {             {
                 //                  Uint64 longNumber;
                 // user-specified                  // use the current value which has been checked for validity at
                 //                  // load(fct. GetOptions), see DefaultPropertyOwner::isValid()
                 CString portString = httpPort.getCString();                  StringConversion::decimalStringToUint64(
                 char* end = 0;                      httpPort.getCString(),
                 portNumberHttp = strtol(portString, &end, 10);                      longNumber);
                 if (!(end != 0 && *end == '\0'))                  portNumberHttp = longNumber & 0xffff;
                 {  
                     throw InvalidPropertyValue("httpPort", httpPort);  
                 }  
             }             }
  
               String listenOn = configManager->getCurrentValue("listenAddress");
               if(String::equalNoCase(listenOn, "All"))
               {
             if (addIP6Acceptor)             if (addIP6Acceptor)
             {             {
                 _cimServer->addAcceptor(HTTPAcceptor::IPV6_CONNECTION,                 _cimServer->addAcceptor(HTTPAcceptor::IPV6_CONNECTION,
Line 1036 
Line 1120 
                 _cimServer->addAcceptor(HTTPAcceptor::IPV4_CONNECTION,                 _cimServer->addAcceptor(HTTPAcceptor::IPV4_CONNECTION,
                     portNumberHttp, false);                     portNumberHttp, false);
             }             }
               }
               else // Restricted listening
               {
                   _restrictListening(
                       configManager, listenOn, portNumberHttp, false);
               }
   
             // The port number is converted to a string to avoid the             // The port number is converted to a string to avoid the
             //  addition of localized characters (e.g., "5,988").             //  addition of localized characters (e.g., "5,988").
             char scratchBuffer[22];             char scratchBuffer[22];
Line 1057 
Line 1148 
         {         {
             Uint32 portNumberHttps = 0;             Uint32 portNumberHttps = 0;
             String httpsPort = configManager->getCurrentValue("httpsPort");             String httpsPort = configManager->getCurrentValue("httpsPort");
             if (httpsPort == String::EMPTY)              if (httpsPort.size() == 0)
             {             {
                 //                 //
                 // Look up the WBEM-HTTPS port number                 // Look up the WBEM-HTTPS port number
                 //                 //
                 portNumberHttps = System::lookupPort(                 portNumberHttps = System::lookupPort(
                     WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);                     WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT);
                   _initConfigProperty("httpsPort", portNumberHttps);
             }             }
             else             else
             {             {
                 //                  Uint64 longNumber;
                 // user-specified                  // use the current value which has been checked for validity at
                 //                  // load(fct. GetOptions), see DefaultPropertyOwner::isValid()
                 CString portString = httpsPort.getCString();                  StringConversion::decimalStringToUint64(
                 char* end = 0;                      httpsPort.getCString(),
                 portNumberHttps = strtol(portString, &end, 10);                      longNumber);
                 if (!(end != 0 && *end == '\0'))                  portNumberHttps = longNumber & 0xffff;
                 {  
                     throw InvalidPropertyValue("httpsPort", httpsPort);  
                 }  
             }             }
   
               String listenOn = configManager->getCurrentValue("listenAddress");
               if(String::equalNoCase(listenOn, "All"))
               {
             if (addIP6Acceptor)             if (addIP6Acceptor)
             {             {
                 _cimServer->addAcceptor(HTTPAcceptor::IPV6_CONNECTION,                 _cimServer->addAcceptor(HTTPAcceptor::IPV6_CONNECTION,
Line 1088 
Line 1181 
                 _cimServer->addAcceptor(HTTPAcceptor::IPV4_CONNECTION,                 _cimServer->addAcceptor(HTTPAcceptor::IPV4_CONNECTION,
                     portNumberHttps, true);                     portNumberHttps, true);
             }             }
               }
               else //Restricted
               {
                   _restrictListening(
                       configManager, listenOn, portNumberHttps, true);
               }
   
             // The port number is converted to a string to avoid the             // The port number is converted to a string to avoid the
             //  addition of localized characters (e.g., "5,989").             //  addition of localized characters (e.g., "5,989").
             char scratchBuffer[22];             char scratchBuffer[22];
Line 1165 
Line 1265 
             parms);             parms);
         cerr << MessageLoader::getMessage(parms) << endl;         cerr << MessageLoader::getMessage(parms) << endl;
  
           deleteCIMServer();
   
         //         //
         // notify parent process (if there is a parent process) to terminate         // notify parent process (if there is a parent process) to terminate
         //         //
         if (daemonOption)         if (daemonOption)
             _cimServerProcess->notify_parent(1);             _cimServerProcess->notify_parent(1);
  
         deleteCIMServer();  
         return 1;         return 1;
     }     }
  
Line 1195 
Line 1296 
 #ifdef PEGASUS_ENABLE_SLP #ifdef PEGASUS_ENABLE_SLP
         _cimServer->startSLPProvider();         _cimServer->startSLPProvider();
 #endif #endif
           _cimServer->initComplete();
   
         //         //
         // Loop to call CIMServer's runForever() method until CIMServer         // Loop to call CIMServer's runForever() method until CIMServer
         // has been shutdown         // has been shutdown


Legend:
Removed from v.1.228  
changed lines
  Added in v.1.243

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2