bluetooth/btstack/secman/btaccessrequester.cpp
branchRCL_3
changeset 13 20fda83a6398
parent 8 2b6718f05bdb
child 14 9b6d3ca0c601
equal deleted inserted replaced
12:8a27654f7b62 13:20fda83a6398
    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)
   703 		LOG(_L8("\tACCESS DENIED"));
   694 		LOG(_L8("\tACCESS DENIED"));
   704 		}
   695 		}
   705 	else if(aResult == EBTSecManAccessGranted)
   696 	else if(aResult == EBTSecManAccessGranted)
   706 		{
   697 		{
   707 		LOG(_L8("\tACCESS GRANTED"));
   698 		LOG(_L8("\tACCESS GRANTED"));
       
   699 		if (RemoteIndicatedNoBondingToDedicatedBonding())
       
   700 			{
       
   701 			// We allow the device to bond, but tell theUI layer so it can delete the link key if it wants to
       
   702 			aResult = KErrRemoteDeviceIndicatedNoBonding;
       
   703 			LOG(_L8("\t... but remote indicated no bonding"));
       
   704 			}
   708 		}
   705 		}
   709 	else
   706 	else
   710 		{
   707 		{
   711 		LOG1(_L8("\tERROR (%d)"), aResult);
   708 		LOG1(_L8("\tERROR (%d)"), aResult);
   712 		}
   709 		}
  1002 	__ASSERT_DEBUG(!encryptionRequired || iBaseband->Authenticated(), PANIC(KBTSecPanic, EBTSecEncryptionRequiredOnUnauthenticatedLink));
   999 	__ASSERT_DEBUG(!encryptionRequired || iBaseband->Authenticated(), PANIC(KBTSecPanic, EBTSecEncryptionRequiredOnUnauthenticatedLink));
  1003 
  1000 
  1004 	return encryptionRequired;
  1001 	return encryptionRequired;
  1005 	}
  1002 	}
  1006 
  1003 
  1007 TBool CBTAccessRequester::UnableToBond() const
  1004 TBool CBTAccessRequester::RemoteIndicatedNoBondingToDedicatedBonding() const
  1008 	{
  1005 	{
  1009 	LOG_FUNC
  1006 	LOG_FUNC
  1010 	return (iAccessType == EDedicatedBonding && iDedicatedBondingNotAvailable);
  1007 	return (iAccessType == EDedicatedBonding && iRemoteIndicatedNoBonding);
  1011 	}
  1008 	}
  1012 
  1009 
  1013 TAccessType CBTAccessRequester::AccessType() const
  1010 TAccessType CBTAccessRequester::AccessType() const
  1014 	{
  1011 	{
  1015 	return iAccessType;
  1012 	return iAccessType;