Revision: 201023 RCL_3 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 16:49:56 +0300
branchRCL_3
changeset 20 352850cbed81
parent 18 74294b43d401
child 22 9f4e37332ce5
Revision: 201023 Kit: 2010125
vpnclient_sis/group/create_vpnclient_sis.pl
vpnengine/vpnmanager/group/vpnmanager.mmp
vpnengine/vpnmanager/group/vpnmanager_test.mmp
vpnengine/vpnmanager/src/policystore.cpp
--- a/vpnclient_sis/group/create_vpnclient_sis.pl	Wed Jun 09 10:48:33 2010 +0300
+++ b/vpnclient_sis/group/create_vpnclient_sis.pl	Mon Jun 21 16:49:56 2010 +0300
@@ -101,10 +101,7 @@
 
 	# remove temp files
 	unlink <temp_*_urel.pkg>;  
-		
-}
-elsif ($config eq "UDEB")  
-{
+
 	# nokia_vpn_client_localised_armv5_udeb.pkg
 		replace_line_and_create_temp(
 		    '^\(0x101F5147\),.*?,.*?,.*?, TYPE=SA, RU$',
@@ -121,6 +118,11 @@
 			
 	# remove temp files
 	unlink <temp_*_udeb.pkg>;
+			
+}
+elsif ($config eq "UDEB")  
+{
+#empty
 }
 else
 {
--- a/vpnengine/vpnmanager/group/vpnmanager.mmp	Wed Jun 09 10:48:33 2010 +0300
+++ b/vpnengine/vpnmanager/group/vpnmanager.mmp	Mon Jun 21 16:49:56 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003-2010 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"
@@ -21,7 +21,7 @@
 TARGETTYPE      exe
 UID             0x1000008d 0x101F7993
 
-CAPABILITY      NetworkControl NetworkServices ProtServ WriteDeviceData
+CAPABILITY      NetworkControl NetworkServices ProtServ WriteDeviceData ReadDeviceData
 VENDORID        VID_DEFAULT
 
 SOURCEPATH      ../src
@@ -75,6 +75,7 @@
 LIBRARY         charconv.lib 
 LIBRARY         cmmanager.lib
 LIBRARY         cryptography.lib
+LIBRARY         centralrepository.lib
 
 DEBUGLIBRARY    flogger.lib
 
--- a/vpnengine/vpnmanager/group/vpnmanager_test.mmp	Wed Jun 09 10:48:33 2010 +0300
+++ b/vpnengine/vpnmanager/group/vpnmanager_test.mmp	Mon Jun 21 16:49:56 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003-2010 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"
@@ -15,23 +15,21 @@
 *
 */
 
-
-
 #include <platform_paths.hrh>
 
 TARGET          vpnmanager.exe
 TARGETTYPE      exe
 UID             0x1000008d 0x101F7993
 
-CAPABILITY      NetworkControl NetworkServices ProtServ WriteDeviceData
+CAPABILITY      NetworkControl NetworkServices ProtServ WriteDeviceData ReadDeviceData
 VENDORID        VID_DEFAULT
 
 SOURCEPATH      ../src
 SOURCE          fileutil.cpp
-SOURCE          pinparser.cpp 
-SOURCE          pkiutil.cpp 
+SOURCE          pinparser.cpp
+SOURCE          pkiutil.cpp
 SOURCE          pwdchanger.cpp
-SOURCE          policyimporter.cpp 
+SOURCE          policyimporter.cpp
 SOURCE          policypatcher.cpp 
 SOURCE          policystore.cpp
 SOURCE          vpnapiservant.cpp
@@ -78,6 +76,7 @@
 LIBRARY         charconv.lib 
 LIBRARY         cmmanager.lib
 LIBRARY         cryptography.lib
+LIBRARY         centralrepository.lib
 
 DEBUGLIBRARY    flogger.lib
 
--- a/vpnengine/vpnmanager/src/policystore.cpp	Wed Jun 09 10:48:33 2010 +0300
+++ b/vpnengine/vpnmanager/src/policystore.cpp	Mon Jun 21 16:49:56 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2000-2010 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"
@@ -15,11 +15,11 @@
 *
 */
 
-
-
 #include <e32math.h>
 #include <cmconnectionmethod.h>
 #include <cmpluginvpndef.h> // vpn plugin
+#include <centralrepository.h>
+#include <browseruisdkcrkeys.h>
 #include "policystore.h"
 #include "pinparser.h"
 #include "ikepolparser.h"
@@ -188,6 +188,39 @@
         iFileUtil.DeleteFileL(*polFile);
         }
     CleanupStack::PopAndDestroy(2); // polFile, pinFile
+    	
+    // Policy was deleted successfully.
+    TUint policyCount = PolicyCount();
+                
+    if ( policyCount == 0 )
+        {
+        CRepository* repository = CRepository::NewLC( KCRUidBrowser );
+        TInt tempMode;
+        TBrowserCenRepApSelectionModeValues mode;   
+                    
+        TUint err = repository->Get( KBrowserOccAccessPointSelectionMode, tempMode );
+        mode = static_cast<TBrowserCenRepApSelectionModeValues> ( tempMode );
+    
+        // This was the last policy. Now restore old value, if appropriate.                                 
+        if (mode != EBrowserCenRepApSelModeAlwaysAsk)
+            {
+            // Nothing to change because user has edited the setting in meanwhile and this code will not
+            // mess up user's choice.
+            LOG(Log::Printf(_L("Browser user has changed mode from EBrowserCenRepApSelModeAlwaysAsk - no change"))); 
+            }
+        else
+            {               
+            // Reset to original value	
+            TInt err = repository->Reset( KBrowserOccAccessPointSelectionMode );
+            LOG(Log::Printf(_L("Set KBrowserOccAccessPointSelectionMode -> Original value")));	
+            }
+        CleanupStack::PopAndDestroy( repository );
+        }
+    else
+        {
+        LOG(Log::Printf(_L("Browser settings not changed because policy count > 0")));
+        }	            	
+    	
     LOG(Log::Printf(_L("<- CPolicyStore::DeletePolicyL()")));            
     return KErrNone;
     }
@@ -298,6 +331,40 @@
         }
 
     CleanupStack::PopAndDestroy(policyInfo);
+    
+    // Policy was installed successfully.
+    // Now change Browser's settings so that it must ask always for SNAP/IAP.
+    // This is done because otherwise the VPN usage is seen difficult for Browser users.
+    TUint policyCount = PolicyCount();
+                
+    if ( policyCount == 1 )
+        {
+        CRepository* repository = CRepository::NewLC( KCRUidBrowser );
+        TInt tempMode;
+        TBrowserCenRepApSelectionModeValues mode;   
+                    
+        TInt err = repository->Get( KBrowserOccAccessPointSelectionMode, tempMode );
+        mode = static_cast<TBrowserCenRepApSelectionModeValues> ( tempMode );            
+    
+        // This is the first policy. Now do the changes and save old value.                
+        if (mode == EBrowserCenRepApSelModeAlwaysAsk)
+            {
+            // Nothing to change
+            LOG(Log::Printf(_L("Browser already uses mode EBrowserCenRepApSelModeAlwaysAsk"))); 
+            }
+        else
+            {               
+            TInt err = repository->Set( KBrowserOccAccessPointSelectionMode, EBrowserCenRepApSelModeAlwaysAsk );
+            LOG_1("Set KBrowserOccAccessPointSelectionMode -> EBrowserCenRepApSelModeAlwaysAsk, error code: %d", err);
+            }
+        
+        CleanupStack::PopAndDestroy( repository );                      
+        }
+    else
+        {
+        LOG(Log::Printf(_L("Browser settings not changed because policy count > 1")));
+        }
+    
     LOG(Log::Printf(_L("<- CPolicyStore::AddPolicyL")));            
     }