version 1.191, 2006/11/29 22:09:32
|
version 1.191.2.2, 2006/12/27 01:19:24
|
|
|
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
|
#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION |
|
# define PEGASUS_PROCESS_NAME "cimservermain"; |
|
#else |
#define PEGASUS_PROCESS_NAME "cimserver"; | #define PEGASUS_PROCESS_NAME "cimserver"; |
|
#endif |
| |
//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 |
|
|
} | } |
} | } |
| |
|
#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION |
|
extern bool pegasusClientAuthenticatorShutdownInProgress; |
|
#endif /* PEGASUS_ENABLE_PRIVILEGE_SEPARATION */ |
|
|
void shutdownCIMOM(Uint32 timeoutValue) | void shutdownCIMOM(Uint32 timeoutValue) |
{ | { |
|
#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION |
|
|
|
// Let the client authenticator module know that a shutdown is in progress |
|
// so that it will attempt to authenticate as root for the purposes of |
|
// shutdown (with the help of the executor). |
|
|
|
pegasusClientAuthenticatorShutdownInProgress = true; |
|
|
|
#endif /* PEGASUS_ENABLE_PRIVILEGE_SEPARATION */ |
|
|
// | // |
// Create CIMClient object | // Create CIMClient object |
// | // |
|
|
} | } |
catch(Exception&) | catch(Exception&) |
{ | { |
|
cerr << "Shutdown failed" << endl; |
// | // |
// This may mean that the CIM Server has terminated, causing this | // This may mean that the CIM Server has terminated, causing this |
// client to get a "Empty HTTP response message" exception. It may | // client to get a "Empty HTTP response message" exception. It may |
|
|
return; | return; |
} | } |
| |
|
#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION |
|
|
|
static void _checkForExecutor(const char* arg0) |
|
{ |
|
#if 0 |
|
int uid = getuid(); |
|
int gid = getgid(); |
|
printf("%s: uid=%d, gid=%d\n", arg0, uid, gid); |
|
#endif |
|
|
|
// If the executor started this process, then it created and passed a |
|
// socket descriptor to this process with a value of three. To test this, |
|
// we open a file an check that its file descriptor is four. If not, then |
|
// the executor did not create this process. |
|
|
|
FILE* fs = tmpfile(); |
|
|
|
if (!fs) |
|
{ |
|
fprintf(stderr, "%s: tmpfile() failed()\n", arg0); |
|
exit(1); |
|
} |
|
|
|
if (fileno(fs) != 4) |
|
{ |
|
fprintf(stderr, "%s: do not be run this program directly. " |
|
"It is part of the cimserver program.\n", arg0); |
|
exit(1); |
|
} |
|
|
|
fclose(fs); |
|
} |
|
|
|
#endif /* PEGASUS_ENABLE_PRIVILEGE_SEPARATION */ |
| |
///////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////// |
// MAIN | // MAIN |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
int main(int argc, char** argv) | int main(int argc, char** argv) |
{ | { |
|
#ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION |
|
_checkForExecutor(argv[0]); |
|
#endif |
|
|
String pegasusHome = String::EMPTY; | String pegasusHome = String::EMPTY; |
Boolean shutdownOption = false; | Boolean shutdownOption = false; |
Boolean debugOutputOption = false; | Boolean debugOutputOption = false; |
|
|
return(0); | return(0); |
} | } |
#endif | #endif |
|
|
} | } |
| |
// l10n | // l10n |
|
|
deleteCIMServer(); | deleteCIMServer(); |
return 0; | return 0; |
} | } |
|
|
|
|
|
|
|
|