version 1.27, 2006/03/14 18:21:25
|
version 1.28, 2006/04/19 19:39:25
|
|
|
//Out of provider support for OS400 goes here when needed. | //Out of provider support for OS400 goes here when needed. |
| |
#else | #else |
|
|
|
# ifndef PEGASUS_DISABLE_PROV_USERCTXT |
|
// Get and save the effective user name and the uid/gid for the user |
|
// context of the agent process |
|
|
|
String effectiveUserName = System::getEffectiveUserName(); |
|
PEGASUS_UID_T newUid = (PEGASUS_UID_T) -1; |
|
PEGASUS_GID_T newGid = (PEGASUS_GID_T) -1; |
|
if (_userName != effectiveUserName) |
|
{ |
|
if (!System::lookupUserId(_userName.getCString(), newUid, newGid)) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION_L( |
|
CIM_ERR_FAILED, |
|
MessageLoaderParms( |
|
"ProviderManager.OOPProviderManagerRouter." |
|
"USER_CONTEXT_CHANGE_FAILED", |
|
"Unable to change user context to \"$0\".", _userName)); |
|
} |
|
} |
|
# endif |
|
|
pid_t pid = fork(); | pid_t pid = fork(); |
if (pid < 0) | if (pid < 0) |
{ | { |
|
|
| |
#ifndef PEGASUS_DISABLE_PROV_USERCTXT | #ifndef PEGASUS_DISABLE_PROV_USERCTXT |
// Set the user context of the Provider Agent process | // Set the user context of the Provider Agent process |
if (_userName != System::getEffectiveUserName()) |
if (_userName != effectiveUserName) |
{ | { |
if (!System::changeUserContext(_userName.getCString())) |
if (!System::changeUserContext(newUid, newGid)) |
{ | { |
Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, | Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"System::changeUserContext() failed. userName = %s.", | "System::changeUserContext() failed. userName = %s.", |
|
|
request->operationContext.get(IdentityContainer::NAME); | request->operationContext.get(IdentityContainer::NAME); |
userName = ic.getUserName(); | userName = ic.getUserName(); |
} | } |
catch (Exception& e) |
catch (Exception&) |
{ | { |
// If no IdentityContainer is present, default to the CIM | // If no IdentityContainer is present, default to the CIM |
// Server's user context | // Server's user context |