bluetooth/btstack/secman/btaccessrequester.cpp
changeset 17 907b2fb7aa8e
parent 16 0089b2f7ebd8
child 21 5e5528a288fe
equal deleted inserted replaced
16:0089b2f7ebd8 17:907b2fb7aa8e
    77 	, iDeviceRetrievedFromRegistry(EFalse)
    77 	, iDeviceRetrievedFromRegistry(EFalse)
    78 	, iQueLink(this)
    78 	, iQueLink(this)
    79 	, iPrefetchQueueLink(this)
    79 	, iPrefetchQueueLink(this)
    80 	, iAuthenticationInProgress(EFalse)
    80 	, iAuthenticationInProgress(EFalse)
    81 	, iAccessType(aAccessType)
    81 	, iAccessType(aAccessType)
    82 	, iDedicatedBondingNotAvailable(EFalse)
    82 	, iRemoteIndicatedNoBonding(EFalse)
    83 	, iCurrentState(EBTUninitialised)
    83 	, iCurrentState(EBTUninitialised)
    84 	{
    84 	{
    85 	LOG_FUNC
    85 	LOG_FUNC
    86 	// try to get name for UI dialogs
    86 	// try to get name for UI dialogs
    87 	SetDeviceName();
    87 	SetDeviceName();
   506 	// If remote device says "no bonding" when asked for dedicated
   506 	// If remote device says "no bonding" when asked for dedicated
   507 	// bonding, remember this for sending a negative reply later
   507 	// bonding, remember this for sending a negative reply later
   508 	THCIAuthenticationRequirement authReq = event->AuthenticationRequirements();
   508 	THCIAuthenticationRequirement authReq = event->AuthenticationRequirements();
   509 	if (iAccessType == EDedicatedBonding && (authReq == EMitmReqNoBonding || authReq == EMitmNotReqNoBonding))
   509 	if (iAccessType == EDedicatedBonding && (authReq == EMitmReqNoBonding || authReq == EMitmNotReqNoBonding))
   510 		{
   510 		{
   511 		iDedicatedBondingNotAvailable = ETrue;
   511 		iRemoteIndicatedNoBonding = ETrue;
   512 		}
   512 		}
   513 	}
   513 	}
   514 
   514 
   515 void CBTAccessRequester::IOCapsRequested(TBTSecEvent& aEvent)
   515 void CBTAccessRequester::IOCapsRequested(TBTSecEvent& aEvent)
   516 	{
   516 	{
   590 	{
   590 	{
   591 	LOG_FUNC
   591 	LOG_FUNC
   592 	TBTSecEventUserConfirmationRequest* event = TBTSecEventUserConfirmationRequest::Cast(&aEvent);
   592 	TBTSecEventUserConfirmationRequest* event = TBTSecEventUserConfirmationRequest::Cast(&aEvent);
   593 	__ASSERT_ALWAYS(event, User::Panic(KBTSecPanic, EBTSecBadStateMachineEvent));
   593 	__ASSERT_ALWAYS(event, User::Panic(KBTSecPanic, EBTSecBadStateMachineEvent));
   594 		
   594 		
   595 	// Ignore the user confirmation request, we're unable to bond
       
   596 	// (dedicated bonding not available at both ends of the link)
       
   597 	// A negative reply is also sent in secman.cpp
       
   598 	if (UnableToBond())
       
   599 		{
       
   600 		CompleteRequest(KErrRemoteDeviceIndicatedNoBonding);
       
   601 		return;
       
   602 		}
       
   603 
       
   604 	// start guard timer...
   595 	// start guard timer...
   605 	iTimer->Start();
   596 	iTimer->Start();
   606 	}
   597 	}
   607 
   598 
   608 void CBTAccessRequester::PasskeyEntry(TBTSecEvent& aEvent)
   599 void CBTAccessRequester::PasskeyEntry(TBTSecEvent& aEvent)
   709 	else
   700 	else
   710 		{
   701 		{
   711 		LOG1(_L8("\tERROR (%d)"), aResult);
   702 		LOG1(_L8("\tERROR (%d)"), aResult);
   712 		}
   703 		}
   713 #endif // __FLOG_ACTIVE
   704 #endif // __FLOG_ACTIVE
       
   705 	
       
   706 	if (aResult == EBTSecManAccessGranted && RemoteIndicatedNoBondingToDedicatedBonding())
       
   707 		{
       
   708 		// We allow the device to bond, but tell theUI layer so it can delete the link key if it wants to
       
   709 		aResult = KErrRemoteDeviceIndicatedNoBonding;
       
   710 		LOG(_L8("\t... but remote indicated no bonding"));
       
   711 		}
       
   712 	
   714 	iSecMan.AccessRequestComplete(this, aResult);
   713 	iSecMan.AccessRequestComplete(this, aResult);
   715 	}
   714 	}
   716 
   715 
   717 /**
   716 /**
   718 Take the access requirements of the service and compare them with the permissions given 
   717 Take the access requirements of the service and compare them with the permissions given 
  1002 	__ASSERT_DEBUG(!encryptionRequired || iBaseband->Authenticated(), PANIC(KBTSecPanic, EBTSecEncryptionRequiredOnUnauthenticatedLink));
  1001 	__ASSERT_DEBUG(!encryptionRequired || iBaseband->Authenticated(), PANIC(KBTSecPanic, EBTSecEncryptionRequiredOnUnauthenticatedLink));
  1003 
  1002 
  1004 	return encryptionRequired;
  1003 	return encryptionRequired;
  1005 	}
  1004 	}
  1006 
  1005 
  1007 TBool CBTAccessRequester::UnableToBond() const
  1006 TBool CBTAccessRequester::RemoteIndicatedNoBondingToDedicatedBonding() const
  1008 	{
  1007 	{
  1009 	LOG_FUNC
  1008 	LOG_FUNC
  1010 	return (iAccessType == EDedicatedBonding && iDedicatedBondingNotAvailable);
  1009 	return (iAccessType == EDedicatedBonding && iRemoteIndicatedNoBonding);
  1011 	}
  1010 	}
  1012 
  1011 
  1013 TAccessType CBTAccessRequester::AccessType() const
  1012 TAccessType CBTAccessRequester::AccessType() const
  1014 	{
  1013 	{
  1015 	return iAccessType;
  1014 	return iAccessType;