networksecurity/tls/protocol/tlsconnection.cpp
branchRCL_3
changeset 75 c1029e558ef5
parent 67 bb2423252ea3
--- a/networksecurity/tls/protocol/tlsconnection.cpp	Wed Sep 15 13:53:10 2010 +0300
+++ b/networksecurity/tls/protocol/tlsconnection.cpp	Wed Oct 13 16:17:27 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -26,8 +26,6 @@
 #include "applicationdata.h"
 #include <es_sock.h>
 #include <in_sock.h>
-#include <featdiscovery.h>
-#include <featureuids.h>
 
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
 #include <ssl_internal.h>
@@ -55,7 +53,7 @@
 
 	CleanupStack::PushL(self);
 	self->ConstructL(aSocket, aProtocol);
-	CleanupStack::Pop(self);
+	CleanupStack::Pop();
 	return self;
 }
 
@@ -80,7 +78,7 @@
 
 	CleanupStack::PushL(self);
 	self->ConstructL(aSocket, aProtocol);
-	CleanupStack::Pop(self);
+	CleanupStack::Pop();
 	return self;
 }
 
@@ -156,17 +154,7 @@
 	User::LeaveIfError( SetProtocol(aProtocol) );
 	iTlsProvider->Attributes()->iCurrentCipherSuite.iLoByte = 0x00;
 	iTlsProvider->Attributes()->iCurrentCipherSuite.iHiByte = 0x00;
-	TBool allowUntrustedCertificates = EFalse;
-	allowUntrustedCertificates = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KFeatureIdFfHttpAllowUntrustedCertificates);
-	
-	if( allowUntrustedCertificates )
-	  {
-      iTlsProvider->Attributes()->iDialogMode = ETTLSDialogModeAllowAutomatic;
-	  }
-	else
-	  {
-	  iTlsProvider->Attributes()->iDialogNonAttendedMode = EFalse;
-	  }
+	iTlsProvider->Attributes()->iDialogNonAttendedMode = EFalse;
 	iDialogMode = EDialogModeAttended;
 
 	iGenericSocket = new(ELeave)CGenericSecureSocket<RSocket>(aSocket);
@@ -218,17 +206,7 @@
 	User::LeaveIfError( SetProtocol(aProtocol) );
 	iTlsProvider->Attributes()->iCurrentCipherSuite.iLoByte = 0x00;
 	iTlsProvider->Attributes()->iCurrentCipherSuite.iHiByte = 0x00;
-	TBool allowUntrustedCertificates = EFalse;
-	allowUntrustedCertificates = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KFeatureIdFfHttpAllowUntrustedCertificates);
-
-	if( allowUntrustedCertificates )
-	  {
-	  iTlsProvider->Attributes()->iDialogMode = ETTLSDialogModeAttended;
-	  }
-	else
-	  {
-	  iTlsProvider->Attributes()->iDialogNonAttendedMode = EFalse;
-	  }
+	iTlsProvider->Attributes()->iDialogNonAttendedMode = EFalse;
 	iDialogMode = EDialogModeAttended;
 
 	iRecordParser = new(ELeave)CRecordParser( aSocket, *iTlsProvider );
@@ -932,56 +910,23 @@
 	// TDialogMode enum or has the value EDialogModeUnattended/EDialogModeAttended. 
 	// Otherwise, it must return KErrArgument
 	TInt ret = KErrNone;
-	TBool allowUntrustedCertificates = EFalse;
-	TRAP(ret, allowUntrustedCertificates = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KFeatureIdFfHttpAllowUntrustedCertificates));
-	
-	if(KErrNone == ret)
-	{
-		TTLSDialogMode tlsDialogMode( ETTLSDialogModeAttended );
-		switch(aDialogMode)
-		{
-			case EDialogModeUnattended:
-				{
-				if( allowUntrustedCertificates )
-					{
-					tlsDialogMode = ETTLSDialogModeUnattended;
-					iDialogMode = aDialogMode;
-					break;        
-					}
-				}
-			case EDialogModeAttended:
-				{
-				if( allowUntrustedCertificates )
-					{
-					tlsDialogMode = ETTLSDialogModeAttended;
-					}
-				iDialogMode = aDialogMode;
-				break;
-				}
-			case EDialogModeAllowAutomatic:
-				{
-				tlsDialogMode = ETTLSDialogModeAllowAutomatic;
-				iDialogMode = aDialogMode;
-				break; 
-				}
-			
-			default:  //-- wrong mode
-				LOG(Log::Printf(_L("SetDialogMode() - Unknown dialog mode, default setting (Attended mode) being used"));)
-			return KErrArgument;    
-		};
+   
+    switch(aDialogMode)
+    {
+        case EDialogModeUnattended:
+        case EDialogModeAttended:
+            iDialogMode = aDialogMode;
+        break;
+        
+        default:  //-- wrong mode
+            LOG(Log::Printf(_L("SetDialogMode() - Unknown dialog mode, default setting (Attended mode) being used"));)
+        return KErrArgument;    
+    };
 
-		if ( iTlsProvider )
-		{
-		if( allowUntrustedCertificates )
-			{
-			iTlsProvider->Attributes()->iDialogMode = tlsDialogMode;
-			}
-		else
-			{
-			iTlsProvider->Attributes()->iDialogNonAttendedMode = (iDialogMode == EDialogModeUnattended);
-			}
-		}
-	}
+    if ( iTlsProvider )
+    {
+   	    iTlsProvider->Attributes()->iDialogNonAttendedMode = (iDialogMode == EDialogModeUnattended);
+    }	
 
     return ret;
 }
@@ -1244,19 +1189,12 @@
 		   return EFalse;
 	      }
       else
-         {
-		 //We came here since tls handshake failed for some reasons.
-         //Attempting to delete the application data state machines here,
-         //leads to sending incorrect status to the caller application.
-         //Allow the cleanup of handshake statemachine to continue here.
-         //Let the application data state machines be cleaned up by the 
-         //tlsconnection desctructor function.
-         
-         //delete iSendAppData;
-         //iSendAppData = NULL;
-         //delete iRecvAppData;
-         //iRecvAppData = NULL;
-         //ResetCryptoAttributes();
+         {//delete data path in case it's re-negotiation what's failed
+         delete iSendAppData;
+         iSendAppData = NULL;
+         delete iRecvAppData;
+         iRecvAppData = NULL;
+         ResetCryptoAttributes();
          }
    }
    else
@@ -1370,7 +1308,7 @@
 	else
 	{	
 		iRecordComposer->SetUserData( (TDesC8*)&aDesc );
-		iRecordComposer->ResetCurrentPos();
+   	iRecordComposer->ResetCurrentPos();
 		iSendAppData->Start( &aStatus, this );
 	}