version 1.1.2.13, 2007/01/17 18:48:53
|
version 1.2, 2007/05/25 18:35:07
|
|
|
** | ** |
** Determine which user to run CIMSERVERMAIN as. | ** Determine which user to run CIMSERVERMAIN as. |
** | ** |
** Note: this algorithm is no longer in use. |
|
** |
|
**============================================================================== | **============================================================================== |
*/ | */ |
| |
|
|
if (GetUserInfo(username, uid, gid) != 0) | if (GetUserInfo(username, uid, gid) != 0) |
{ | { |
Fatal(FL, | Fatal(FL, |
"The %s user does not exist: \"%s\". Please create " |
"The %s user \"%s\" does not exist.", |
"a system user with that name or use an OpenPegasus build that " |
CIMSERVERMAIN, username); |
"disables privilege separation.", CIMSERVERMAIN, username); |
|
} | } |
| |
return -1; |
return 0; |
} | } |
| |
/* | /* |
|
|
DefineMacro("currentConfigFilePath", path); | DefineMacro("currentConfigFilePath", path); |
} | } |
| |
/* Define ${repositoryDir} */ |
/* Define ${plannedConfigFilePath} */ |
|
{ |
|
char path[EXECUTOR_BUFFER_SIZE]; |
|
|
|
if (GetHomedPath(PEGASUS_PLANNED_CONFIG_FILE_PATH, path) != 0) |
|
{ |
|
Fatal(FL, "GetHomedPath() failed on \"%s\"", |
|
PEGASUS_PLANNED_CONFIG_FILE_PATH); |
|
} |
| |
if (DefineConfigPathMacro("repositoryDir", PEGASUS_REPOSITORY_DIR) != 0) |
DefineMacro("plannedConfigFilePath", path); |
Fatal(FL, "missing \"repositoryDir\" configuration parameter."); |
} |
| |
/* Define ${passwordFilePath} */ | /* Define ${passwordFilePath} */ |
| |
if (DefineConfigPathMacro("passwordFilePath", "cimserver.passwd") != 0) | if (DefineConfigPathMacro("passwordFilePath", "cimserver.passwd") != 0) |
Fatal(FL, "missing \"passwordFilePath\" configuration parameter."); | Fatal(FL, "missing \"passwordFilePath\" configuration parameter."); |
| |
/* Define ${traceFilePath} */ |
|
|
|
if (DefineConfigPathMacro("traceFilePath", NULL) != 0) |
|
Fatal(FL, "missing \"traceFilePath\" configuration parameter."); |
|
|
|
/* Define ${sslKeyFilePath} */ | /* Define ${sslKeyFilePath} */ |
| |
if (DefineConfigPathMacro("sslKeyFilePath", "file.pem") != 0) | if (DefineConfigPathMacro("sslKeyFilePath", "file.pem") != 0) |
|
|
if (DefineConfigPathMacro("crlStore", "crl") != 0) | if (DefineConfigPathMacro("crlStore", "crl") != 0) |
Fatal(FL, "missing \"crlStore\" configuration parameter."); | Fatal(FL, "missing \"crlStore\" configuration parameter."); |
| |
/* Define ${policyConfigFilePath} */ |
|
{ |
|
char path[EXECUTOR_BUFFER_SIZE]; |
|
|
|
if (GetHomedPath(PEGASUS_POLICY_CONFIG_FILE_PATH, path) != 0) |
|
{ |
|
Fatal(FL, "GetHomedPath() failed on \"%s\"", |
|
PEGASUS_POLICY_CONFIG_FILE_PATH); |
|
} |
|
|
|
DefineMacro("policyConfigFilePath", path); |
|
} |
|
|
|
/* Define ${privilegedUser} */ | /* Define ${privilegedUser} */ |
| |
DefineMacro("privilegedUser", "root"); | DefineMacro("privilegedUser", "root"); |
|
|
int pair[2]; | int pair[2]; |
char username[EXECUTOR_BUFFER_SIZE]; | char username[EXECUTOR_BUFFER_SIZE]; |
int childPid; | int childPid; |
const char* repositoryDir; |
|
struct Options options; | struct Options options; |
| |
/* Get options. */ | /* Get options. */ |
|
|
if (options.shutdown) | if (options.shutdown) |
ExecShutdown(); | ExecShutdown(); |
| |
/* Load the dynamic policy file. */ |
|
|
|
LoadDynamicPolicy(); |
|
|
|
/* Process --policy and --macros options. */ | /* Process --policy and --macros options. */ |
| |
if (options.policy || options.macros) |
if (options.dump) |
{ | { |
if (options.policy) |
|
DumpPolicy(1); | DumpPolicy(1); |
|
|
if (options.macros) |
|
DumpMacros(); | DumpMacros(); |
|
|
exit(0); | exit(0); |
} | } |
| |
|
|
| |
/* Open the log. */ | /* Open the log. */ |
| |
OpenLog("cimexecutor", options.perror); |
OpenLog("cimserver"); |
| |
Log(LL_INFORMATION, "starting"); | Log(LL_INFORMATION, "starting"); |
| |
|
|
| |
GetServerUser(&globals.childUid, &globals.childGid); | GetServerUser(&globals.childUid, &globals.childGid); |
| |
/* Get repositoryDir for child. */ |
|
|
|
if ((repositoryDir = FindMacro("repositoryDir")) == NULL) |
|
Fatal(FL, "failed to find repositoryDir macro"); |
|
|
|
/* Fork child process. */ | /* Fork child process. */ |
| |
childPid = fork(); | childPid = fork(); |
|
|
/* Child. */ | /* Child. */ |
close(pair[1]); | close(pair[1]); |
Child(argc, argv, cimservermainPath, globals.childUid, | Child(argc, argv, cimservermainPath, globals.childUid, |
globals.childGid, pair[0], repositoryDir); |
globals.childGid, pair[0]); |
} | } |
else if (childPid > 0) | else if (childPid > 0) |
{ | { |
/* Parent. */ | /* Parent. */ |
close(pair[0]); | close(pair[0]); |
Parent(pair[1], childPid); |
Parent(pair[1], childPid, options.bindVerbose); |
} | } |
else | else |
{ | { |