bluetooth/btstack/secman/btaccessrequester.cpp
branchRCL_3
changeset 11 20fda83a6398
parent 8 2b6718f05bdb
child 12 9b6d3ca0c601
--- a/bluetooth/btstack/secman/btaccessrequester.cpp	Fri Mar 12 15:49:00 2010 +0200
+++ b/bluetooth/btstack/secman/btaccessrequester.cpp	Mon Mar 15 12:44:59 2010 +0200
@@ -79,7 +79,7 @@
 	, iPrefetchQueueLink(this)
 	, iAuthenticationInProgress(EFalse)
 	, iAccessType(aAccessType)
-	, iDedicatedBondingNotAvailable(EFalse)
+	, iRemoteIndicatedNoBonding(EFalse)
 	, iCurrentState(EBTUninitialised)
 	{
 	LOG_FUNC
@@ -508,7 +508,7 @@
 	THCIAuthenticationRequirement authReq = event->AuthenticationRequirements();
 	if (iAccessType == EDedicatedBonding && (authReq == EMitmReqNoBonding || authReq == EMitmNotReqNoBonding))
 		{
-		iDedicatedBondingNotAvailable = ETrue;
+		iRemoteIndicatedNoBonding = ETrue;
 		}
 	}
 
@@ -592,15 +592,6 @@
 	TBTSecEventUserConfirmationRequest* event = TBTSecEventUserConfirmationRequest::Cast(&aEvent);
 	__ASSERT_ALWAYS(event, User::Panic(KBTSecPanic, EBTSecBadStateMachineEvent));
 		
-	// Ignore the user confirmation request, we're unable to bond
-	// (dedicated bonding not available at both ends of the link)
-	// A negative reply is also sent in secman.cpp
-	if (UnableToBond())
-		{
-		CompleteRequest(KErrRemoteDeviceIndicatedNoBonding);
-		return;
-		}
-
 	// start guard timer...
 	iTimer->Start();
 	}
@@ -705,6 +696,12 @@
 	else if(aResult == EBTSecManAccessGranted)
 		{
 		LOG(_L8("\tACCESS GRANTED"));
+		if (RemoteIndicatedNoBondingToDedicatedBonding())
+			{
+			// We allow the device to bond, but tell theUI layer so it can delete the link key if it wants to
+			aResult = KErrRemoteDeviceIndicatedNoBonding;
+			LOG(_L8("\t... but remote indicated no bonding"));
+			}
 		}
 	else
 		{
@@ -1004,10 +1001,10 @@
 	return encryptionRequired;
 	}
 
-TBool CBTAccessRequester::UnableToBond() const
+TBool CBTAccessRequester::RemoteIndicatedNoBondingToDedicatedBonding() const
 	{
 	LOG_FUNC
-	return (iAccessType == EDedicatedBonding && iDedicatedBondingNotAvailable);
+	return (iAccessType == EDedicatedBonding && iRemoteIndicatedNoBonding);
 	}
 
 TAccessType CBTAccessRequester::AccessType() const