version 1.25.2.4, 2006/05/19 17:31:41
|
version 1.26, 2006/02/24 19:16:28
|
|
|
{ | { |
public: | public: |
OutstandingRequestEntry( | OutstandingRequestEntry( |
String originalMessageId_, |
String messageId_, |
CIMRequestMessage* requestMessage_, | CIMRequestMessage* requestMessage_, |
CIMResponseMessage*& responseMessage_, | CIMResponseMessage*& responseMessage_, |
Semaphore* responseReady_) | Semaphore* responseReady_) |
: originalMessageId(originalMessageId_), |
: messageId(messageId_), |
requestMessage(requestMessage_), | requestMessage(requestMessage_), |
responseMessage(responseMessage_), | responseMessage(responseMessage_), |
responseReady(responseReady_) | responseReady(responseReady_) |
{ | { |
} | } |
| |
/** |
String messageId; |
A unique value is substituted as the request messageId attribute to |
|
allow responses to be definitively correllated with requests. |
|
The original messageId value is stored here to avoid a race condition |
|
between the processing of a response chunk and the resetting of the |
|
original messageId in the request message. |
|
*/ |
|
String originalMessageId; |
|
CIMRequestMessage* requestMessage; | CIMRequestMessage* requestMessage; |
CIMResponseMessage*& responseMessage; | CIMResponseMessage*& responseMessage; |
Semaphore* responseReady; | Semaphore* responseReady; |
|
|
//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 != effectiveUserName) |
if (_userName != System::getEffectiveUserName()) |
{ | { |
if (!System::changeUserContext(newUid, newGid)) |
if (!System::changeUserContext(_userName.getCString())) |
{ | { |
Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, | Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"System::changeUserContext() failed. userName = %s.", | "System::changeUserContext() failed. userName = %s.", |
|
|
// connection | // connection |
// | // |
{ | { |
// |
|
// If not a clean shutdown, log a warning message in case module |
|
// included indication providers |
|
// |
|
if (!cleanShutdown) |
|
{ |
|
Logger::put_l( |
|
Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
|
"ProviderManager.OOPProviderManagerRouter." |
|
"OOP_PROVIDER_MODULE_FAILURE_DETECTED", |
|
"A failure was detected in provider module $0. The" |
|
" generation of indications by providers in this module" |
|
" may be affected. To ensure these providers are" |
|
" serving active subscriptions, disable and then" |
|
" re-enable this module using the cimprovider command.", |
|
_moduleName); |
|
} |
|
|
|
AutoMutex tableLock(_outstandingRequestTableMutex); | AutoMutex tableLock(_outstandingRequestTableMutex); |
| |
CIMResponseMessage* response = | CIMResponseMessage* response = |
|
|
i != 0; i++) | i != 0; i++) |
{ | { |
PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, | PEG_TRACE_STRING(TRC_PROVIDERMANAGER, Tracer::LEVEL2, |
String("Completing messageId \"") + i.key() + |
String("Completing messageId \"") + i.value()->messageId + |
"\" with a null response."); | "\" with a null response."); |
i.value()->responseMessage = response; | i.value()->responseMessage = response; |
i.value()->responseReady->signal(); | i.value()->responseReady->signal(); |
|
|
// | // |
Semaphore waitSemaphore(0); | Semaphore waitSemaphore(0); |
OutstandingRequestEntry outstandingRequestEntry( | OutstandingRequestEntry outstandingRequestEntry( |
originalMessageId, request, response, &waitSemaphore); |
uniqueMessageId, request, response, &waitSemaphore); |
| |
// | // |
// Lock the Provider Agent Container while initializing the | // Lock the Provider Agent Container while initializing the |
|
|
| |
// Put the original message ID into the response | // Put the original message ID into the response |
response->messageId = | response->messageId = |
_outstandingRequestEntry->originalMessageId; |
_outstandingRequestEntry->requestMessage->messageId; |
| |
// Call the response chunk callback to process the chunk | // Call the response chunk callback to process the chunk |
_responseChunkCallback( | _responseChunkCallback( |
|
|
request->operationContext.get(IdentityContainer::NAME); | request->operationContext.get(IdentityContainer::NAME); |
userName = ic.getUserName(); | userName = ic.getUserName(); |
} | } |
catch (Exception&) |
catch (Exception& e) |
{ | { |
// 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 |