Example #1
0
void CQLParser::parse(
    const Buffer& text,
    CQLSelectStatement& statement)
{
    PEG_METHOD_ENTER(TRC_CQL,"CQLParser::parse");

    if (text.size() == 0 || text[text.size() - 1] != '\0')
    {
        PEG_METHOD_EXIT();
        throw MissingNullTerminator();
    }

    parse(text.getData(), statement);
    PEG_METHOD_EXIT();
}
String AuthenticationManager::getHttpAuthResponseHeader()
#endif
{
    PEG_METHOD_ENTER(TRC_AUTHENTICATION,
        "AuthenticationManager::getHttpAuthResponseHeader()");

#ifdef PEGASUS_NEGOTIATE_AUTHENTICATION
    String respHeader = _httpAuthHandler->getAuthResponseHeader(
        String::EMPTY, String::EMPTY, authInfo);
#else
    String respHeader = _httpAuthHandler->getAuthResponseHeader();
#endif
    PEG_METHOD_EXIT();
    return respHeader;
}
Boolean SecureLocalAuthenticator::validateUser (const String& userName)
{
    PEG_METHOD_ENTER(TRC_AUTHENTICATION,
        "SecureLocalAuthenticator::validateUser()");

    Boolean authenticated = false;

    if (System::isSystemUser(userName.getCString()))
    {
        authenticated = true;
    }

    PEG_METHOD_EXIT();
    return (authenticated);
}
Example #4
0
//
// Verify whether the specified CIM user is valid
//
Boolean UserManager::verifyCIMUser(const String& userName)
{
    PEG_METHOD_ENTER(TRC_USER_MANAGER, "UserManager::verifyCIMUser");

#ifndef PEGASUS_NO_PASSWORDFILE
    if (_userFileHandler->verifyCIMUser(userName))
    {
        PEG_METHOD_EXIT();
        return true;
    }
#endif

    PEG_METHOD_EXIT();
    return false;
}
PEGASUS_NAMESPACE_BEGIN

WSMANExportResponseDecoder::WSMANExportResponseDecoder(
    MessageQueue* outputQueue,
    MessageQueue* encoderQueue,
    ClientAuthenticator* authenticator)
    :MessageQueue(PEGASUS_QUEUENAME_EXPORTRESPDECODER),
    _outputQueue(outputQueue),
    _encoderQueue(encoderQueue),
    _authenticator(authenticator)
{
    PEG_METHOD_ENTER(TRC_EXPORT_CLIENT,
        "WSMANExportResponseDecoder::WSMANExportResponseDecoder()");
    PEG_METHOD_EXIT();
}
Example #6
0
Sint32 SSLSocket::read(void* ptr, Uint32 size)
{
    PEG_METHOD_ENTER(TRC_SSL, "SSLSocket::read()");
    Sint32 rc;

    PEG_TRACE_CSTRING(TRC_SSL, Tracer::LEVEL4, "---> SSL: (r) ");
    PEG_TRACE_CSTRING(TRC_SSL, Tracer::LEVEL4,
        SSL_state_string_long(static_cast<SSL*>(_SSLConnection)));
    rc = SSL_read(static_cast<SSL*>(_SSLConnection), (char *)ptr, size);

    _sslReadErrno = errno;

    PEG_METHOD_EXIT();
    return rc;
}
Example #7
0
void ProviderAgent::_writeResponse(Message* message)
{
    PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::_writeResponse");

    CIMMessage* response = dynamic_cast<CIMMessage*>(message);
    PEGASUS_ASSERT(response != 0);

    //
    // Write the response message to the pipe
    //
    try
    {
        // Use Mutex to prevent concurrent writes to the same pipe
        AutoMutex pipeLock(_pipeToServerMutex);

        AnonymousPipe::Status writeStatus =
            _pipeToServer->writeMessage(response);

        if (writeStatus != AnonymousPipe::STATUS_SUCCESS)
        {
            PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
                "Error writing response to pipe.");
            Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
                MessageLoaderParms(
                    "ProviderManager.ProviderAgent.ProviderAgent."
                        "CIMSERVER_COMMUNICATION_FAILED",
                    "cimprovagt \"$0\" communication with CIM Server failed.  "
                        "Exiting.",
                    _agentId));
            _terminating = true;
        }
    }
    catch (...)
    {
        PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
            "Caught exception while writing response.");
        Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::WARNING,
            MessageLoaderParms(
                "ProviderManager.ProviderAgent.ProviderAgent."
                    "CIMSERVER_COMMUNICATION_FAILED",
                "cimprovagt \"$0\" communication with CIM Server failed.  "
                    "Exiting.",
                _agentId));
        _terminating = true;
    }

    PEG_METHOD_EXIT();
}
Example #8
0
void MessageQueue::enqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_MESSAGEQUEUESERVICE,"MessageQueue::enqueue()");

    PEGASUS_ASSERT(message != 0);

    PEG_TRACE((TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
        "Queue name: [%s], Message: [%s]",
        getQueueName(),
        MessageTypeToString(message->getType())));

    _messageList.insert_back(message);

    handleEnqueue();
    PEG_METHOD_EXIT();
}
void CIMOperationRequestAuthorizer::sendResponse(
   Uint32 queueId,
   Array<char>& message)
{
   PEG_METHOD_ENTER(TRC_SERVER, "CIMOperationRequestAuthorizer::sendResponse");

   MessageQueue* queue = MessageQueue::lookup(queueId);

   if (queue)
   {
      AutoPtr<HTTPMessage> httpMessage(new HTTPMessage(message));

      queue->enqueue(httpMessage.release());
   }
   PEG_METHOD_EXIT();
}
CIMOperationRequestAuthorizer::CIMOperationRequestAuthorizer(
   MessageQueueService* outputQueue)
   :
   Base(PEGASUS_QUEUENAME_OPREQAUTHORIZER),
   _outputQueue(outputQueue),
   _serverTerminating(false)
{
   PEG_METHOD_ENTER(TRC_SERVER, "CIMOperationRequestAuthorizer::"
                    "CIMOperationRequestAuthorizer");

#ifdef PEGASUS_ENABLE_USERGROUP_AUTHORIZATION
   _authorizedUserGroups = _getAuthorizedUserGroups();
#endif

   PEG_METHOD_EXIT();
}
Example #11
0
ProviderAgent::~ProviderAgent()
{
    PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::~ProviderAgent");

    _providerAgent = 0;

#if defined(PEGASUS_BUILD_SCX) 
# if defined(PEGASUS_PLATFORM_AIX_RS_IBMCXX) 
    // workaround for "coredump-on-exit" problem. This is strictly AIX 5.3 
    // specific. See WI 7241 for more details.
    _exit(0);
# endif
#endif

    PEG_METHOD_EXIT();
}
Example #12
0
// CIMIndicationProvider interface
void DynamicIndicationProvider::enableIndications(
    IndicationResponseHandler& handler)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "DynamicIndicationProvider::enableIndications");
    _refCnt++;

    if (_refCnt.get() == 1)
    {
        _pHandler = &handler;

        _pHandler->processing();
    }

    PEG_METHOD_EXIT();
}
BasicProviderManagerRouter::BasicProviderManagerRouter(
    PEGASUS_INDICATION_CALLBACK_T indicationCallback,
    PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
    ProviderManager* (*createDefaultProviderManagerCallback)())
{
    PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
        "BasicProviderManagerRouter::BasicProviderManagerRouter");

    _indicationCallback = indicationCallback;
    _responseChunkCallback = responseChunkCallback;
    _subscriptionInitComplete = false;
    _createDefaultProviderManagerCallback =
        createDefaultProviderManagerCallback;

    PEG_METHOD_EXIT();
}
PEGASUS_NAMESPACE_BEGIN


BasicAuthenticationHandler::BasicAuthenticationHandler()
{
    PEG_METHOD_ENTER(TRC_AUTHENTICATION, 
        "BasicAuthenticationHandler::BasicAuthenticationHandler()");

#ifdef PEGASUS_PAM_AUTHENTICATION
    _basicAuthenticator = (BasicAuthenticator*) new PAMBasicAuthenticator();
#else
    _basicAuthenticator = (BasicAuthenticator*) new SecureBasicAuthenticator();
#endif

    PEG_METHOD_EXIT();
}
static void addIfNotExists(TableauRow_WQL &tr, const term_el_WQL& el)
{
    PEG_METHOD_ENTER(
        TRC_CMPIPROVIDERINTERFACE,
        "CMPI_Wql2Dnf:addIfNotExists()");
    for( int i=0,m=tr.size(); i<m; i++ )
    {
        if( tr[i]==el )
        {
            PEG_METHOD_EXIT();
            return;
        }
    }
    tr.append(el);
    PEG_METHOD_EXIT();
}
void ProviderIndicationCountTable::removeEntry(
    const CIMInstance& providerInstance)
{
    PEG_METHOD_ENTER(TRC_INDICATION_SERVICE,
        "ProviderIndicationCountTable::removeEntry");

    String providerModuleName;
    String providerName;
    getProviderKeys(providerInstance, providerModuleName, providerName);
    String providerKey = _generateKey(providerModuleName, providerName);

    WriteLock lock(_tableLock);
    _table.remove(providerKey);

    PEG_METHOD_EXIT();
}
AuthenticationInfoRep::AuthenticationInfoRep()
    : _connectionAuthenticated(false),
      _wasRemotePrivilegedUserAccessChecked(false),
      _authHandle(),
      _isExpiredPassword(false)
#ifdef PEGASUS_ENABLE_SESSION_COOKIES
      ,_cookie()
#endif
{
    PEG_METHOD_ENTER(
        TRC_AUTHENTICATION, "AuthenticationInfoRep::AuthenticationInfoRep");
#ifdef PEGASUS_NEGOTIATE_AUTHENTICATION
      _session.reset(new NegotiateServerSession());
#endif
    PEG_METHOD_EXIT();
}
Example #18
0
Boolean PAMBasicAuthenticator::validateUser(
    const String& userName)
{
    PEG_METHOD_ENTER(TRC_AUTHENTICATION,
        "PAMBasicAuthenticator::validateUser()");

    // FUTURE: PAM authentication is not implemented on non Unix platforms,
    // hence this function return false as default indicating validation
    // failure.

    Boolean authenticated = false;

    PEG_METHOD_EXIT();

    return authenticated;
}
Example #19
0
//
// Part of this code logic comes from the CIMServer::_getSSLContext()
// and CIMServer::_getExportSSLContext() methods.
//
void SSLContextManager::createSSLContext(Uint32 contextType,
    const String& trustStore, const String& certPath, const String& keyPath, 
    const String& crlStore, Boolean callback, const String& randFile)
{
    PEG_METHOD_ENTER(TRC_SSL, "SSLContextManager::createSSLContext()");

    if ( contextType == SERVER_CONTEXT  && !_sslContext )
    {
        PEG_TRACE_STRING(TRC_SSL, Tracer::LEVEL4,
            "Creating the Server SSL Context.");

        //
        // Create the SSLContext object
        //
        if ( callback )
        {
            _sslContext = new SSLContext(trustStore, certPath, 
                keyPath, crlStore, 
                (SSLCertificateVerifyFunction*)verifyClientOptionalCallback,
                randFile);
        }
        else if ( trustStore != String::EMPTY )
        {
            _sslContext = new SSLContext(trustStore, certPath, 
                keyPath, crlStore, 0, randFile);
        }
        else 
        {
            _sslContext = new SSLContext(String::EMPTY, certPath, 
                keyPath, crlStore, 0, randFile);
        }
    }
    else if ( contextType == EXPORT_CONTEXT && !_exportSSLContext )
    {
        PEG_TRACE_STRING(TRC_SSL, Tracer::LEVEL4,
            "Creating the Export SSL Context.");

        //
        // Note: Trust store is used by default on Export connections,
        // verification callback function is not used.
        //
        _exportSSLContext = new SSLContext(trustStore, certPath, 
            keyPath, crlStore, 0, randFile);
    }

    PEG_METHOD_EXIT();
}
Example #20
0
/////////////////////////////////////////////////////////////////////////////
// WMIBaseProvider::getCIMClass - retrieves a CIMClass object
//
// ///////////////////////////////////////////////////////////////////////////
CIMClass WMIBaseProvider::getCIMClass(const String& nameSpace,
										const String& userName,
										const String& password,
										const String& className,
										const CIMPropertyList &propertyList)
{
	CIMClass cimClass;
	CIMStatusCode errorCode = CIM_ERR_SUCCESS;
	String errorDescription;
	WMIClassProvider provider;

	PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIBaseProvider::getCIMClass()");

	try
	{
        // This fix uses the current boolean value stored in collector
        // to initialize it. 
        provider.initialize(_collector->isLocalConnection()); 

		cimClass = provider.getClass(nameSpace, userName, password, className, false, true, true, propertyList);

		provider.terminate();
	}
	catch(CIMException& exception)
	{
		provider.terminate();
		errorCode = exception.getCode();
		errorDescription = exception.getMessage();
		throw PEGASUS_CIM_EXCEPTION(errorCode, errorDescription);
	}
	catch(Exception& exception)
	{
		provider.terminate();
		errorCode = CIM_ERR_FAILED;
		errorDescription = exception.getMessage();
		throw PEGASUS_CIM_EXCEPTION(errorCode, errorDescription);
	}
	catch(...)
	{
		provider.terminate();
		throw CIMException(CIM_ERR_FAILED);
	}

    PEG_METHOD_EXIT();

	return cimClass;
}
Example #21
0
    static CMPIEnumeration* mbEnumInstances(
        const CMPIBroker *mb,
        const CMPIContext *ctx,
        const CMPIObjectPath *cop,
        const char **properties,
        CMPIStatus *rc)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Broker:mbEnumInstances()");
        mb = CM_BROKER;

        CMPIFlags flgs =
            ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32;
        const CIMPropertyList props = getList(properties);

        try
        {
            CIMResponseData resData =
                CM_CIMOM(mb)->enumerateInstances(
                    *CM_Context(ctx),
                    SCMO_ObjectPath(cop)->getNameSpace(),
                    SCMO_ObjectPath(cop)->getClassName(),
                    true,
                    CM_IncludeQualifiers(flgs),
                    CM_ClassOrigin(flgs),
                    props);

            // When running out of process the returned instances don't contain
            // a namespace.
            // Add the namespace from the input parameters where neccessary
            resData.completeNamespace(SCMO_ObjectPath(cop));

            Array<SCMOInstance>* aInst =
                new Array<SCMOInstance>(resData.getSCMO());

            CMPIEnumeration* cmpiEnum = reinterpret_cast<CMPIEnumeration*>(
                new CMPI_Object(new CMPI_InstEnumeration(aInst)));

            CMSetStatus(rc,CMPI_RC_OK);
            PEG_METHOD_EXIT();
            return cmpiEnum;
        }
        HandlerCatchSetStatus(rc, NULL);

        // Code flow should never get here.
    }
Example #22
0
void MessageQueue::enqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_MESSAGEQUEUESERVICE,"MessageQueue::enqueue()");

    if (!message)
    {
        Tracer::trace(TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
                    "MessageQueue::enqueue failure");
        PEG_METHOD_EXIT();
        throw NullPointer();
    }

    PEG_TRACE_STRING( TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
                      String("Queue name: ") + getQueueName() ) ;
    Tracer::trace   ( TRC_MESSAGEQUEUESERVICE,
                      Tracer::LEVEL3,
                      "Message: [%s, %d]",
                      MessageTypeToString(message->getType()),
                      message->getKey() );

    {
    AutoMutex autoMut(_mut);
    if (_back)
    {
        _back->_next = message;
        message->_prev = _back;
        message->_next = 0;
        _back = message;
    }
    else
    {
        _front = message;
        _back = message;
        message->_prev = 0;
        message->_next = 0;
    }
    message->_owner = this;

    _count++;
    Tracer::trace(TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL4,
                  "MessageQueue::enqueue _queueId = %d, _count = %d", _queueId, _count);

    } // mutex unlocks here

    handleEnqueue();
    PEG_METHOD_EXIT();
}
void EnumerationContext::signalProviderWaitCondition()
{
    PEG_METHOD_ENTER(TRC_ENUMCONTEXT,
        "EnumerationContext::signalProviderLimitCondition");

    PEGASUS_DEBUG_ASSERT(valid());

    PEG_TRACE((TRC_ENUMCONTEXT, Tracer::LEVEL4,
      "EnumerationContext::signalProviderWait Condition ContextId=%s"
          " cacheSize=%u", *Str(getContextId()), responseCacheSize() ));

    AutoMutex autoMut(_providerWaitConditionMutex);

    _providerWaitCondition.signal();

    PEG_METHOD_EXIT();
}
Example #24
0
//
// Verify user authorization
//
void UserAuthProvider::_verifyAuthorization(const String& user)
{
    PEG_METHOD_ENTER(TRC_CONFIG,
        "UserAuthProvider::_verifyAuthorization()");

    if ( System::isPrivilegedUser(user) == false )
    {
        PEG_METHOD_EXIT();
        MessageLoaderParms parms(
            "ControlProviders.UserAuthProvider."
            "MUST_BE_PRIVILEGED_USER",
            "Must be a privileged user to execute this CIM operation.");
        throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,parms);
    }

    PEG_METHOD_EXIT();
}
CIMResponseData ClientCIMOMHandleRep::enumerateInstanceNames(
    const OperationContext & context,
    const CIMNamespaceName &nameSpace,
    const CIMName& className)
{
    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE,
        "ClientCIMOMHandleRep::enumerateInstanceNames");

    AutoPThreadSecurity revPthreadSec(context, true);
    ClientCIMOMHandleAccessController access(_clientMutex);
    ClientCIMOMHandleSetup setup(_client, context);

    PEG_METHOD_EXIT();
    return _client->enumerateInstanceNames(
        nameSpace,
        className);
}
void ClientCIMOMHandleRep::modifyClass(
    const OperationContext & context,
    const CIMNamespaceName &nameSpace,
    const CIMClass& modifiedClass)
{
    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE, "ClientCIMOMHandleRep::modifyClass");

    AutoPThreadSecurity revPthreadSec(context, true);
    ClientCIMOMHandleAccessController access(_clientMutex);
    ClientCIMOMHandleSetup setup(_client, context);

    _client->modifyClass(
        nameSpace,
        modifiedClass);

    PEG_METHOD_EXIT();
}
//
// Builds an instance of the class named className. Gets Class defintion and
// fills in the correct properties from the class.  This requires a repository
// getClass request for each instance built. The skeleton is built by
// creating the instance and copying qualifiers and properties from
// the class. Finally the instance is cloned to separate it from the
// original objects.
// NOTE: This is very inefficient for anything larger than a few instances.
// We should separate the get from the createSkeleton.
// @param className CIMName of the class for which the instance is to be built
// @return CIMInstance of this class with properties complete.
// @exception passes on any exceptions received from the repository request.
//
CIMInstance InteropProvider::buildInstanceSkeleton(
      const CIMNamespaceName & nameSpace,
      const CIMName& className,
      Boolean includeQualifiers,
      CIMClass& returnedClass)
{
    PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
        "InteropProvider::_buildInstanceSkeleton()");
    // get class with lo = false, qualifier = true classorig = true
    returnedClass = repository->getClass(nameSpace,
        className, false, true, true);
    CIMInstance skeleton = returnedClass.buildInstance(
        includeQualifiers, true, CIMPropertyList());

    PEG_METHOD_EXIT();
    return skeleton;
}
CIMObjectPath ClientCIMOMHandleRep::createInstance(
    const OperationContext & context,
    const CIMNamespaceName &nameSpace,
    const CIMInstance& newInstance)
{
    PEG_METHOD_ENTER(TRC_CIMOM_HANDLE,
        "ClientCIMOMHandleRep::createInstance");

    AutoPThreadSecurity revPthreadSec(context, true);
    ClientCIMOMHandleAccessController access(_clientMutex);
    ClientCIMOMHandleSetup setup(_client, context);

    PEG_METHOD_EXIT();
    return _client->createInstance(
        nameSpace,
        newInstance);
}
Example #29
0
int CQL_error(const char* errorMessage)
{
    PEG_METHOD_ENTER(TRC_CQL,"CQL_error");
    CQL_globalParserState->error = true;
    CQL_globalParserState->errorMessage = errorMessage;

    //
    //  flex does not automatically flush the input buffer in case of error
    //
    CQL_restart (0);

    // flush ArgList 
    CQL_Arglist_Cleanup();

    PEG_METHOD_EXIT();
    return -1;
}
Example #30
0
HTTPAuthenticatorDelegator::HTTPAuthenticatorDelegator(
    Uint32 cimOperationMessageQueueId,
    Uint32 cimExportMessageQueueId,
    CIMRepository* repository)
    : Base(PEGASUS_QUEUENAME_HTTPAUTHDELEGATOR, MessageQueue::getNextQueueId()),
      _cimOperationMessageQueueId(cimOperationMessageQueueId),
      _cimExportMessageQueueId(cimExportMessageQueueId),
      _wsmanOperationMessageQueueId(PEG_NOT_FOUND),
      _repository(repository)
{
    PEG_METHOD_ENTER(TRC_HTTP,
        "HTTPAuthenticatorDelegator::HTTPAuthenticatorDelegator");

    _authenticationManager.reset(new AuthenticationManager());

    PEG_METHOD_EXIT();
}