void CPosSession::GetModuleInfoByIndexL(const RMessage2& aMessage)
    {
    DEBUG_TRACE("EPositionServerGetModuleInfoByIndex in", __LINE__)

    // module index
    TInt modIndex = aMessage.Int0();

    CPosModuleIdList* moduleIdList = iModuleSettings.ModuleIdListL();
    CleanupStack::PushL( moduleIdList );
    if (modIndex >= moduleIdList->Count() || modIndex < 0)
        {
        User::Leave(KErrNotFound);
        }
    TPositionModuleId moduleId = (*moduleIdList)[modIndex];

    // module info
    HBufC8* buffer = Global::CopyClientBuffer8LC(aMessage, KParamModuleInfo);

    TPositionModuleInfoBase* moduleInfoBase =
        reinterpret_cast<TPositionModuleInfoBase*>(
        const_cast<TUint8*>(buffer->Ptr()));

    Global::ValidatePositionClassBufferL(*moduleInfoBase, buffer->Des());
    // TPositionModuleInfo is the only class supported by CPosModules
    Global::ValidatePositionClassTypeL(*moduleInfoBase, EPositionModuleInfoClass);
    DEBUG_TRACE("Buffer validation done", __LINE__)

    CleanupStack::PopAndDestroy(2, moduleIdList);

    // TPositionModuleInfo contains descriptor. If it is corrupt 
    // (malicious client) then writing to this will panic server
    // Local instance of TPositionModuleInfo is created to be sure
    // that module name descriptor is not corrupt

    TPositionModuleInfo modInfo;
    iModuleSettings.GetModuleInfoL(moduleId, modInfo);

    TPckg<TPositionModuleInfo> modInfoPack(modInfo);
    User::LeaveIfError(Global::Write(aMessage, KParamModuleInfo, modInfoPack));

    RequestComplete(aMessage, KErrNone);
    DEBUG_TRACE("EPositionServerGetModuleInfoByIndex out", __LINE__)
    }
Example #2
0
CPolicyServer::TCustomResult CMsmmServer::CustomSecurityCheckL(
    const RMessage2&  aMsg,
     TInt&  /*aAction*/,
     TSecurityInfo&  /*aMissing*/)
 {
     CPolicyServer::TCustomResult returnValue = CPolicyServer::EFail;    
     
     TSecureId ClientSID = aMsg.SecureId();
 
     if (KFDFWSecureId == ClientSID)
         {
         returnValue = CPolicyServer::EPass;
         }     
     else if ((KSidHbDeviceDialogAppServer == ClientSID) && SessionNumber() > 0)
         {
         returnValue = CPolicyServer::EPass;
         }
     return returnValue;
 }
Example #3
0
void CConfigSession::Cancel(
	const RMessage2& aMessage)
/**
 * Asynchronous request to cancel an existing asynchronous operation.
 *
 * @internalComponent
 *
 * @param aMessage Message containing the request status.
 */
	{
  	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::Cancel Start"));

    if (iConfigIf)
      	iConfigIf->CancelRequest();

    aMessage.Complete(KErrNone); 
	    
  	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::Cancel End"));
	}		
/**
Called when a message is received for this session.

@param aMessage The message from the client.
*/
void CSuplProxyPrivacySession::ServiceL(const RMessage2& aMessage)
	{
	LBSLOG(ELogP1, "CSuplProxyPrivacySession::ServiceL() Begin\n");

	switch (aMessage.Function())
		{
		case ELbsPrivacyServerNotifyLocation:
			NotifyLocationRequest(aMessage);
			break;
			
		case ELbsPrivacyServerVerifyLocation:
			VerifyLocationRequest(aMessage);
			break;
			
		case ELbsPrivacyServerNotifyVerificationTimeout:
			NotifyVerificationTimeout(aMessage);
			break;
			
		case ELbsPrivacyServerCancelVerifyLocationRequest:
			CancelVerifyLocationRequest(aMessage);
			break;

		case ELbsPrivacyServerNewPrivacyRequestLocal:
		case ELbsPrivacyServerNewPrivacyRequestNetwork:
			NewPrivacyRequest(aMessage);
			break;

		case ELbsPrivacyServerRepeatPrivacyRequestLocal:
		case ELbsPrivacyServerRepeatPrivacyRequestNetwork:
			RepeatPrivacyRequest(aMessage);
			break;

		case ELbsPrivacyServerCompleteRequest:
			CompleteRequest(aMessage);
			break;
		
		default:
			User::Leave(KErrNotSupported);
		}

	LBSLOG(ELogP1, "CSuplProxyPrivacySession::ServiceL() End\n");
	}
// ---------------------------------------------------------
// HandleOrderNotifications
// ---------------------------------------------------------
//
void CHotSpotSession::HandleOrderNotifications( const RMessage2& aMessage )
    {
    iPendingNotificationRequest = aMessage;
    iIsNotificationRequestPending = ETrue;
    if( !iNotificationHandle ) // == NULL i.e. is not activated
        {
        TRAPD( err, iNotificationHandle = CSessionNotification::NewL( *this ) );
        if ( err == KErrNone )
            {
            iServer.NotifyAdd( *iNotificationHandle );
            }
        else
            {
            iIsNotificationRequestPending = EFalse;
            aMessage.Complete( err );
            return;
            }
        }
    HandleNotification(); // check is there any unsent notifications
    }
// --------------------------------------------------------------------------
//
// --------------------------------------------------------------------------
void CAknCompaSrvSession::DispatchMessageL(const RMessage2& aMessage)
    {
    switch(aMessage.Function())
        {
    case ECompaSrvSimulateKeyEvent:
        SimulateKeyEventServiceL(aMessage);
        break;
    case ECompaSrvDisaTransEffects:
        Server().DisaTransEffectsL(aMessage);
        break;
    case ECompaSrvRestoreTransEffects:
        Server().RestoreTransEffectsL(aMessage);
        break;
    // Requests that we don't understand at all are a different matter.
    // This is considered a client programming error, so we panic the 
    // client - this also completes the message.
    default:
        CAknCompaServer::PanicClient(aMessage, EBadRequest);
        }
    }
Example #7
0
void CCntItemMsgHandler::SetAsyncActivityL(const RMessage2& aMessage)
	{
	CheckForManagerL();
	TBool asyncActivity = TBool(aMessage.Int0());
	// Create and then process appropriate request using state machine.
	CCntRequest* request = NULL;
	if (asyncActivity)
		{
		request = CReqAsyncActivity::NewLC(iSessionId, aMessage, iTimeOut);
		}
	else
		{
		request = CReqNoAsyncActivity::NewLC(iSessionId, aMessage, iTimeOut);
		}
	iManager->StateMachineL().ProcessRequestL(request); // ownership transferred
	
	// ProcessRequestL received ownership of the request, the request only need
	// to be popped from CleanupStack.		
	CleanupStack::Pop(request);
	}
Example #8
0
void CConfigSession::IoctlL(
	const RMessage2& aMessage)
/**
 * Asynchronous request to start an action.
 *
 * @internalComponent
 *
 * @param aMessage Message containing the type parameter and the request status.
 * @leave Leaves from CConfigControl::IoctlL.
 */
	{
	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::IoctlL Start"));

	if (!iConfigIf)
		User::Leave(KErrNotReady);

	iConfigIf->IoctlL(aMessage.Int1(), aMessage);

	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::IoctlL End"));
	}
Example #9
0
void CConfigSession::DeregisterL(
	const RMessage2& aMessage)
/**
 * Asynchronous deregistration request.
 *
 * @internalComponent
 *
 * @param aMessage	
 * @leave KErrNotReady If ConfigureL was not called previously. Leaves from CConfigControl::DeregisterL.
 */
	{
	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::DeregisterL Start"));

	if (!iConfigIf)
		User::Leave(KErrNotReady);

	iConfigIf->DeregisterL(aMessage.Int0(), aMessage);

	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::DeregisterL End"));		
	}	
/**
Submit a notification timeout request.

@param aMessage The message from the client.
*/
void CSuplProxyPrivacySession::NotifyVerificationTimeout(const RMessage2& aMessage)
	{
	LBSLOG(ELogP1, "CSuplProxyPrivacySession::NotifyVerificationTimeout() Begin\n");

	// NOTE: requestInfo does not complete the message in this case
	CSuplProxyPrivacyRequestInfo* requestInfo = NULL;
	TRAPD(err, requestInfo = CSuplProxyPrivacyRequestInfo::NewL(aMessage));
	if (err != KErrNone)
		{
		// Error creating request info object, complete with the error and return
		aMessage.Complete(err);
		return;
		}
    
    TLbsExternalRequestInfo2 extRequestInfo;
    TPckg<TLbsExternalRequestInfo2> extRequestInfoPkg(extRequestInfo);
    aMessage.Read(0,extRequestInfoPkg);
    requestInfo->SetRequestInfo(extRequestInfo);
    
	requestInfo->SetRequestId(aMessage.Int1());

	TLbsNetPosRequestPrivacy netPosRequestPrivacy;
	TPckg<TLbsNetPosRequestPrivacy>	netPosRequestPrivacyPkg(netPosRequestPrivacy);
	aMessage.Read(2,netPosRequestPrivacyPkg);
	requestInfo->SetRequestPrivacy(netPosRequestPrivacy);
    
	requestInfo->SetIsResponseRequired(EFalse);
	
	if (!IsRequestInfoValid(*requestInfo))
		{
		aMessage.Panic(KPosPrivacyPanicCategory,
					   EPosPrivSrvPanicInvalidArguments);
		delete requestInfo;
		return;
		}
	
	// temporary. Since NRH state machine can't deal with receiving a second privacy request while waiting for a location request, complete the first session so we start a new one.
	iPrivacyProtocol.EndPrivacySession(aMessage.Int1(), KErrNone);	 
	
	iPrivacyProtocol.NotifyVerificationTimeout(requestInfo);
	aMessage.Complete(KErrNone);

	LBSLOG(ELogP1, "CSuplProxyPrivacySession::NotifyVerificationTimeout() End\n");
	}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
TInt CPolicyClientRequestHandler::InsertClient(const RMessage2& aMessage)
	{
	
	TInt err = KErrNone;
	
	CPolicyEventReq* req = new CPolicyEventReq();
	if (!req)
		{
		return KErrNoMemory;
		}

	// Getting the client ID and storing it.	
	RThread client;
	err = aMessage.Client(client);
	if( err != KErrNone )
		{
		delete req;
		return err;
		}
	req->iClientId = client.Id();
	client.Close();
	
    err = iControlPolicyClients.Append(req);
    if( err == KErrNone )
    	{
		// Requesting all policies from the policy handler.
        err = iParent->GetAllControlPolicies( req->iOriginalControlPolicies );
		if( err == KErrNotFound )
			{
			// If no polices found, store message for later.
			req->iMessage = aMessage;
			return err;
			} 
        err = req->TotalPolicyCount();
    	}
    else
        {
        delete req;
        }
    return err;
	}
TBool CAppInfoViewSubsession::DoServiceL(TInt aFunction, const RMessage2& aMessage)
/**
    Implement CFileListSubsession by handling the supplied message.

    @param  aFunction       Function identifier without SCS code.
    @param  aMessage        Standard server-side handle to message.
    @return ETrue means complete client request now. EFalse for asynchronous tasks.
 */
    {
    TScrSessionFunction f = static_cast<TScrSessionFunction>(aFunction);
    
    switch (f)
        {
        case EOpenAppInfoView:
            {
            DeleteObjectZ(iAppInfoFilter);
            iAppInfoFilter = iServer->RequestImpL()->ReadAppInfoFilterL(aMessage);
            DeleteObjectZ(iStatement);
            iSubsessionContext->iLocale = TLanguage(aMessage.Int1());
    
            if(iSubsessionContext->iLocale == KUnspecifiedLocale)
                {
                iSubsessionContext->iLocale = User::Language();
                }
            iSubsessionContext->iAppInfoIndex = 0;
            iServer->RequestImpL()->OpenAppInfoViewL(*iAppInfoFilter, this->iSubsessionContext);
            break;
            }
        case EGetNextAppInfoSize:
             iServer->RequestImpL()->NextAppInfoSizeL(aMessage, iApaAppInfo, this->iSubsessionContext);
             break;
        case EGetNextAppInfoData:
             iServer->RequestImpL()->NextAppInfoDataL(aMessage, iApaAppInfo);
             break;
   
        default:
            User::Leave(KErrNotSupported);
            break;
        }
    return ETrue;
    }
void CNrhPrivacyServerSubsession::DispatchL(const RMessage2& aMessage)
	{
	switch(aMessage.Function())
		{
		case ENrhPrivacyControllerRegister:
			SetClientReady(aMessage);
			break;
			
		case ENrhPrivacyControllerCancelRegister:
			CancelClientReady(aMessage);
			break;
			
		case ENrhPrivacyControllerResponse:
			HandlePrivacyResponse(aMessage);
			break;
			
		case ENrhPrivacyControllerCancel:
			HandlePrivacyCancel(aMessage);
			break;
		}
	}
Example #14
0
// ---------------------------------------------------------------------------
// Returns the index of a given preset observer.
// ---------------------------------------------------------------------------
//
TInt CPSServer::PresetObserverIndex( const RMessage2& aMessage ) const
    {
    TInt idx = KErrNotFound;
        
    CSession2* currentSession = aMessage.Session();
        
    for ( TInt i = 0; i < iPresetObservers.Count(); i++ )
        {
        const RMessage2& message = iPresetObservers[i];

        if ( !message.IsNull() && message.Session() == currentSession && message.Int0() == aMessage.Int0() )
            {
            idx = i;
            /*lint -save -e960 (Note -- Violates MISRA Required Rule 58, non-switch break used)*/
            break;
            /*lint -restore*/
            }
        }
    
    return idx;
    }
Example #15
0
// ---------------------------------------------------------------------------
// Called when a session is disconnected.
// ---------------------------------------------------------------------------
//
void CPSServer::SessionDisconnected( const RMessage2& aMessage )
    {
    PSDEBUG( "CPSServer::SessionDisconnected( RMessage2& ) [enter]" );

    for ( TInt i = 0; i < iPresetObservers.Count(); i++ )
        {
        const RMessage2& message = iPresetObservers[i];
        
        if ( message.Session() == aMessage.Session() )
            {
            if ( !message.IsNull() )
                {
                message.Complete( KErrDied );
                }
            iPresetObservers.Remove( i );
            i--;
            }
        }

    PSDEBUG( "CPSServer::SessionDisconnected( RMessage2& ) [exit]" );
    }
// ============================================================================
// CCwrtRegistryServerSession::ServiceL()
// Handles messages from client
//
// ============================================================================
//
void CCwrtRegistryServerSession::ServiceL( const RMessage2& aMessage )
    {
    TBool retBool( EFalse );
    bool ret( false );
    TInt len = 0;
    TInt uid = 0;
    TInt count = 0;
    TInt policyId = 0;
    const TInt function = aMessage.Function();

    // TBD seems like we should trap leaves and return error codes so
    // as not to exit the server
    switch ( function )
        {
        case EOpCodeRegisterWidget:
            ret = OpRegisterWidgetL( aMessage );
            aMessage.Complete( ret );
            break;
        case EOpCodeDeRegisterWidget:
            ret = OpDeRegisterWidgetL( aMessage );
            aMessage.Complete( ret );
            break;
        case EOpCodeGetWebAttribute:
            OpGetWebAttributeL( aMessage );
            aMessage.Complete( KErrNone );
            break;
        case EOpCodeSetWebAttribute:
            ret = OpSetWebAttributeL( aMessage );
            aMessage.Complete( ret );
            break;
        case EOpCodeNativeIdToAppId:
            OpNativeIdToAppIdL( aMessage );
            aMessage.Complete( KErrNone );
            break;
        case EOpCodeWidgetRegistryDisconnect:
            OpDisconnect( aMessage );
            aMessage.Complete( KErrNone );
            break;
        default:
            User::Leave( KErrNotSupported );
            break;
        }
    }
/**
 *  Takes a buffer from the client and sends to the driver.
 *
 *  @param aMessage  RMessage2 client request.
 */
void CShBufTestServerSession::FromTPtr8ProcessAndReleaseL(const RMessage2& aMessage)
	{
	//
	// Read the client buffer...
	//
	TPtr8  bufPtr(iSessionTempBuffer, sizeof(iSessionTempBuffer));
	
	aMessage.ReadL(0, bufPtr); 

	//
	// Pass to the server to pass to the driver and back...
	//
	TInt  result;
	
	result = Server().FromTPtr8ProcessAndRelease(bufPtr);

	//
	// Complete the request...
	//
	CompleteRequest(aMessage, result);
	} // CShBufTestServerSession::FromTPtr8ProcessAndReleaseL
/**
   Services messages directed to a device. Messages associated with a single
   Logical Unit contained by the device are forwarded to the Logical Unit
   Handler.

   @param aMessage
 */
void TDeviceHandler::HandleMessageL(const RMessage2& aMessage)
    {
    __MSFNLOG
    TLun lun = iDevice.GetAndSetLunL(aMessage);

	switch (aMessage.Function())
		{
	case EUsbHostMsSuspendLun:
        iDevice.SuspendLunL(lun);
		break;
    case EUsbHostMsUnRegisterLun:
        iDevice.RemoveLunL(lun);
        break;
    default:
        // Try Logical Unit Handler
        CUsbHostMsLogicalUnit& lu = iDevice.GetLuL(lun);
        TLogicalUnitHandler luHandler(lu);
        luHandler.HandleMessageL(aMessage);
		break;
		}
    }
// ---------------------------------------------------------------------------
// Process a client message related to notifiers.
// ---------------------------------------------------------------------------
//
void CBTNotifGenInfoNotifier::HandleNotifierRequestL( const RMessage2& aMessage )
    {
    BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() );
    TInt opcode = aMessage.Function();
    TInt uid = aMessage.Int0();
    TInt err = KErrNone;
    switch ( opcode ) 
        {
        case EBTNotifCancelNotifier:
            {
            aMessage.Complete( err );
            break;
            }
        case EBTNotifUpdateNotifier:
            {
            aMessage.Complete( err );
            break;
            }
        case EBTNotifStartSyncNotifier:
            {
            TRAP(err,ShowNotificationL(aMessage));
            aMessage.Complete( err );
            break;
            }
        case EBTNotifStartAsyncNotifier:
            {
            TRAP(err,ShowNotificationL(aMessage));
            aMessage.Complete( err );
            break;
            }
        default:
            {
            aMessage.Complete( KErrNotSupported );
            }
        }
    BOstraceFunctionExit1( DUMMY_DEVLIST, this );
    }
// -----------------------------------------------------------------------------
// CWimCertHandler::GetCertificateInfo
// Fetches certificate info. Wrapper for WIMI call.
// -----------------------------------------------------------------------------
//
TBool CWimCertHandler::CheckReadCapsForUsage( const RMessage2& aMsg,
                               TUint8 aUsage )
    {
    TBool result = EFalse;

    switch ( aUsage )
        {
        case WIMI_CU_CA:
            {
            // CA certificate reading doesn't require any capability.
            _WIMTRACE(_L("CWimCertHandler::CheckReadCapsForUsage: CA cert read req, OK."));
            result = ETrue;
            break;
            }
        case WIMI_CU_Client:
            {
            // User certificate reading requires ReadUserData capability.
            if ( aMsg.HasCapability( ECapabilityReadUserData ))
                {
                result = ETrue;
                _WIMTRACE(_L("CWimCertHandler::CheckReadCapsForUsage: User cert read capa PASS"));
                }
            else
                {
                result = EFalse;
                _WIMTRACE(_L("CWimCertHandler::CheckReadCapsForUsage: User cert read capa FAIL"));
                }
            break;
            }
        default:
            {
            _WIMTRACE(_L("CWimCertHandler::CheckReadCapsAccordingToUsage: FAIL:Unknown usage."));
            result = EFalse;
            break;
            }
        }
    _WIMTRACE(_L("CWimCertHandler::CheckReadCapsForUsage | End"));
    return result;
    }
Example #21
0
/**
Called by ServiceL()

It tests the function code and then delegates to
the appropriate function.
*/
void CCountServSession::DispatchMessageL(const RMessage2& aMessage)
	{
	switch (aMessage.Function())
        {
	case ECountServSetFromString:
		SetFromStringL(aMessage);
		return;
	case ECountServIncrease:
		Increase();
		return;
	case ECountServIncreaseBy:
		IncreaseBy(aMessage);
		return;
	case ECountServDecrease:
		Decrease();
		return;
	case ECountServDecreaseBy:
		DecreaseBy(aMessage);
		return;
	case ECountServReset:
		Reset();
		return;
	case ECountServValue:
		CounterValueL(aMessage);
		return;
	  
	  // This is an example of a request that we know about, but don't support.
	  // We cause KErrNotSupported to be returned to the client.
	case ECountServUnsupportedRequest:
		User::Leave(KErrNotSupported);
		
	 //  Requests that we don't understand at all are a different matter.
	 //  This is considered a client programming error, so we panic the 
	 //  client - this also completes the message.
	default:
		PanicClient(aMessage,EBadRequest);
		return;
        }
	}
Example #22
0
TInt CEchoDaemonSession::DispatchMessageL(const RMessage2& aMessage)
	{
	TInt ret = KErrNotSupported;
	
	switch(aMessage.Function())
		{
		case EStartEchoDaemon:
			ret = Start(aMessage);
			break;
		case EStopEchoDaemon:
			ret = Stop(aMessage);
			break;
		case EStopAllEchoDaemons:
			ret = StopAll(aMessage);
			break;
		default:
			// Unknown function number - panic the client
			PanicClient(aMessage, EBadRequest);
		}
		
	return ret;
	}
// ---------------------------------------------------------------------------
// CSecurityDialogNotifierSession::DispatchMessageL()
// ---------------------------------------------------------------------------
//
void CSecurityDialogNotifierSession::DispatchMessageL( const RMessage2& aMessage )
    {
    TRACE( "CSecurityDialogNotifierSession::DispatchMessageL, begin" );
    if( !IsOperationCancelled( aMessage ) )
        {
        TSecurityDialogOperation operation =
                static_cast< TSecurityDialogOperation >( aMessage.Function() );
        TRACE( "CSecurityDialogNotifierSession::DispatchMessageL, operation=%d", operation );
        switch( operation )
            {
            case ESecureConnection:
            case ESignText:
                // TODO: implement
                User::Leave( KErrNotSupported );
                break;
            case EEnterPIN:
            case EEnablePIN:
            case EDisablePIN:
            case EChangePIN:
                BasicPinOperationL( aMessage );
                break;
            case EUnblockPIN:
            case EPINBlocked:
            case ETotalBlocked:
            case EUnblockPINInClear:
                // TODO: implement
                User::Leave( KErrNotSupported );
                break;
            case EServerAuthenticationFailure:
                ServerAuthenticationFailureL( aMessage );
                break;
            default:
                User::Leave( KErrNotSupported );
                break;
            }
        }
    TRACE( "CSecurityDialogNotifierSession::DispatchMessageL, end" );
    }
void CStsServerSession::ServiceL(const RMessage2& aMessage)
    {
    switch (aMessage.Function())
        {
        case StsMsg_RegisterMsgQueue:
            DoRegisterMsgQueueL(aMessage);
            break;
        case StsMsg_PlayTone:
            DoPlayToneL(aMessage);
            break;
        case StsMsg_PlayAlarm:
            DoPlayAlarmL(aMessage);
            break;
        case StsMsg_PlayToneAlarm:
            DoPlayToneAlarmL(aMessage);
            break;
        case StsMsg_StopAlarm:
            DoStopAlarmL(aMessage);
            break;
        default:
            break;
        }
    }
Example #25
0
void CMsmmSession::ServiceError(const RMessage2 &aMessage, TInt aError)
    {
    OstTraceFunctionEntry0( CMSMMSESSION_SERVICEERROR_ENTRY );
    
    CMsmmPolicyPluginBase* plugin = iServer.PolicyPlugin();    
    TUSBMSDeviceDescription& device = iDevicePkg();
       
    switch (aError)
        {
    case KErrNoMemory:
        iErrData->iError = EHostMsErrOutOfMemory;
        break;
    case KErrArgument:
        iErrData->iError = EHostMsErrInvalidParameter;
        break;
    case KErrNotFound:
        iErrData->iError = EHostMsErrInvalidParameter;
        break;
    default:
        iErrData->iError = EHostMsErrGeneral;
        }
    
    iErrData->iE32Error = aError;
    iErrData->iManufacturerString = device.iManufacturerString;
    iErrData->iProductString = device.iProductString;
    iErrData->iDriveName = 0x0;
   
    OstTrace1( TRACE_DUMP, CMSMMSESSION_SERVICEERROR, "iErrData->iE32Error = %d", aError );
    OstTraceExt1( TRACE_DUMP, CMSMMSESSION_SERVICEERROR_DUP1, "iErrData->iManufacturerString=\"%S\"", device.iManufacturerString );
    OstTraceExt1( TRACE_DUMP, CMSMMSESSION_SERVICEERROR_DUP2, "iErrData->iProductString=\"%S\"", device.iProductString );

        
    TInt err(KErrNone);
    TRAP(err, plugin->SendErrorNotificationL(*iErrData));
    aMessage.Complete(aError);
    OstTraceFunctionExit0( CMSMMSESSION_SERVICEERROR_EXIT );
    }
Example #26
0
/**
Handles the connect request from the client.  We trap Leaves, to ensure
that existing sessions aren't affected by failure to create a new one.

@param aMessage The Connect message sent by the client requesting the
                connection. aMessage.Ptr0() is the required Version.
*/
EXPORT_C void CServer2::DoConnect(const RMessage2& aMessage)
	{
	ASSERT(aMessage.Function() == RMessage2::EConnect);
	ASSERT(aMessage.Session() == NULL);
	ASSERT(!aMessage.IsNull());

	CSession2* newSession = NULL;
	TRAPD(err, DoConnectL(aMessage, newSession));
	if (err != KErrNone)
		{
		// Connect failed
		delete newSession;
		aMessage.Complete(err);
		}
	else
		{
		ASSERT(newSession != NULL);
		CServer2* sessionServer = const_cast<CServer2*>(newSession->Server());
		ASSERT(sessionServer != NULL);

		// The return value of Server() will be 'this', unless it was
		// changed by a call to SetServer().
		if (sessionServer == this)
			{
			// no SetServer() call, so just complete the Connect message
			aMessage.Complete(err);
			}
		else
			{
			// Transfer the new Csession to the specified slave Cserver
			newSession->iLink.Deque();
			sessionServer->iSessionQ.AddLast(*newSession);

			// Ask the kernel to transfer the DSession to the slave DServer.
			// Note: this Exec call also completes the Connect message.
			TInt msgHandle = aMessage.iHandle;
			const_cast<TInt&>(aMessage.iHandle) = 0;
			ASSERT(msgHandle);
			Exec::TransferSession(msgHandle, sessionServer->Server().Handle());
			}
		}

	ASSERT(aMessage.IsNull());
	}
void CRtaContentHandler::GetEmbeddedObjects2L(const RMessage2& aMessage)
	{
	RStreamablePtrArray<CEmbeddedObject> array;
	CleanupClosePushL(array);
	
	TEmbeddedType type;
	TPckg<TEmbeddedType> typePckg(type);
	
	aMessage.Read(1, typePckg);
	
	iArchive->DrmFilesL().CurrentContainer().GetEmbeddedObjectsL(array, type);

	// Write the object out to a buffer, send to client
	CBufFlat* buf = CBufFlat::NewL(50);
	CleanupStack::PushL(buf);
	// create write stream
	RBufWriteStream writeStream(*buf);
	// write the directory to the stream
	array.ExternalizeL(writeStream);
	TPtr8 bufPtr = buf->Ptr(0);
	WriteL(aMessage, 0, bufPtr);
	
	CleanupStack::PopAndDestroy(2, &array); // buf, array
	}
Example #28
0
void CConfigSession::ConfigureL(
	const RMessage2& aMessage)
/**
 * This function is used to start the configuration for
 * the connection specified in the RMessage.
 *
 * @internalComponent
 *
 * @param aMessage	
 * @leave KErrInUse if previously called. Leaves from CConfigControl::ConfigureL.
 */
	{
	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::ConfigureL Start"));

	if (iConfigIf)
		User::Leave(KErrInUse);

   	TConnectionInfoBuf configInfo;
   	aMessage.Read(0, configInfo);
	iConfigIf = CreateControlL();
	iConfigIf->ConfigureL(configInfo(), aMessage);

	__FLOG_STATIC(KConfigLoggingTag1(), KConfigLoggingTag2(), _L("CConfigSession::ConfigureL End"));		
	}
Example #29
0
// this is custom security check implemented just for example purposes
// check that client process has secure UID of our UI client application
CPolicyServer::TCustomResult CExPolicy_Server::CustomSecurityCheckL(const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/)
{ 
	if(iFile.SubSessionHandle())
	{
		iFile.Write(_L8("Security test\n,"));
	}
	
	CPolicyServer::TCustomResult test;
	test=EFail;// by default we will fail the test
	
	RThread ClientThread;
	
	aMsg.Client(ClientThread);// get client thread 
	
	if(ClientThread.Handle())// has handle --> is valid
	{
		RProcess ClientProcess;
		ClientThread.Process(ClientProcess);// then get the process
		
		TSecureId ProsID = ClientProcess.SecureId();// and check secure UID
		
		if(ProsID.iId  == (TUint32)KMAINYTasksUid31.iUid
		|| ProsID.iId  == (TUint32)KMAINYTasksUid32.iUid
		|| ProsID.iId  == (TUint32)KMAINYTasksUid33.iUid
		|| ProsID.iId  == (TUint32)KMAINYTasksUid34.iUid)// is it same as with client
		{	
			if(iFile.SubSessionHandle())
			{
				iFile.Write(_L8("Passed\n,"));
			}
			test=EPass;// pass check if it is, othervise it will fail
		}
	}
	
	return test;
} 
Example #30
0
// standard client request handling..
void CExPolicy_ServerSession::ServiceL(const RMessage2& aMessage)
	{

    switch (aMessage.Function())
        {
      	case EMainServSetFileMapping:
            SetFileMappingL(aMessage);
            break;
		case EMainServKillTask:
            KillTaskL(aMessage);
            break;
        case EMainServKillProcess:
            KillProcessL(aMessage);
            break;
        case EMainServKillThread:
            KillThreadL(aMessage);
            break;
        case EMainServGetEInfo:
            GetExtraInfoL(aMessage);
            break;
        default:
        	break;	
        }
    }