terminalsecurity/SCP/SCPTimestampPlugin/src/SCPTimestampPlugin.cpp
branchRCL_3
changeset 19 696f5dd11939
parent 13 86979fe66c4c
child 24 13d7c31c74e0
equal deleted inserted replaced
18:2de6635c154b 19:696f5dd11939
   296         Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL() KSCPIsNotAfter") )); 
   296         Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL() KSCPIsNotAfter") )); 
   297         TInt tolerance = 0;
   297         TInt tolerance = 0;
   298         iConfiguration->Get( KSCPUsedTolerance, tolerance ); // ignore errors
   298         iConfiguration->Get( KSCPUsedTolerance, tolerance ); // ignore errors
   299         Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): tolerance get: %d"), tolerance ) );                
   299         Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): tolerance get: %d"), tolerance ) );                
   300         Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): iMinTolerance : %d"), iMinTolerance ) );                
   300         Dprint( ( _L( "CSCPPatternPlugin::IsChangeAllowedL(): iMinTolerance : %d"), iMinTolerance ) );                
   301         if ( tolerance >= iMinTolerance )
   301 
       
   302         if ( iMinTolerance > 0 && tolerance >= iMinTolerance )
   302             {
   303             {
   303             ret = KErrSCPCodeChangeNotAllowed;
   304             ret = KErrSCPCodeChangeNotAllowed;
   304             Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL() KErrSCPCodeChangeNotAllowed") )); 
   305             Dprint( (_L("CSCPTimestampPlugin::IsChangeAllowedL() KErrSCPCodeChangeNotAllowed") )); 
   305             }
   306             }
   306         
   307         
   424         
   425         
   425         if ( iExpiration > 0 )
   426         if ( iExpiration > 0 )
   426             {
   427             {
   427             // Set the last time the password was changed, for expiration
   428             // Set the last time the password was changed, for expiration
   428             iConfiguration->Set( KSCPLastChangeTime, timeBuf );
   429             iConfiguration->Set( KSCPLastChangeTime, timeBuf );
   429             }        
   430             }
       
   431 
   430         Dprint( ( _L( "CSCPPatternPlugin::PasswordChanged(): iMinInterval: %d"), iMinInterval ) );
   432         Dprint( ( _L( "CSCPPatternPlugin::PasswordChanged(): iMinInterval: %d"), iMinInterval ) );
   431         if ( iMinInterval > 0 )
   433 
   432             {
   434         if ( iMinInterval > 0 && iMinTolerance > 0) {
   433             TInt ret = IsAfter( KSCPIntervalStartTime, iMinInterval, KSCPTypeHours );
   435             TInt ret = IsAfter( KSCPIntervalStartTime, iMinInterval, KSCPTypeHours );
       
   436 
   434             if ( ret == KSCPIsAfter )
   437             if ( ret == KSCPIsAfter )
   435                 {                                                        
   438                 {                                                        
   436                 // Interval exceeded, start a new interval from here
   439                 // Interval exceeded, start a new interval from here
   437                 Dprint( (_L("CSCPTimestampPlugin::PasswordChanged() KSCPIsAfter") ));    
   440                 Dprint( (_L("CSCPTimestampPlugin::PasswordChanged() KSCPIsAfter") ));    
   438                 iConfiguration->Set( KSCPIntervalStartTime, timeBuf );
   441                 iConfiguration->Set( KSCPIntervalStartTime, timeBuf );
   460                 tolerance++;        
   463                 tolerance++;        
   461                 iConfiguration->Set( KSCPUsedTolerance, tolerance );
   464                 iConfiguration->Set( KSCPUsedTolerance, tolerance );
   462                 Dprint( ( _L( "CSCPPatternPlugin::PasswordChanged(): tolerance set: %d"), tolerance ) );  
   465                 Dprint( ( _L( "CSCPPatternPlugin::PasswordChanged(): tolerance set: %d"), tolerance ) );  
   463                 }                       
   466                 }                       
   464             }        
   467             }        
   465         
   468 		else {
       
   469 			iConfiguration->Set( KSCPIntervalStartTime, 0 );
       
   470 			iConfiguration->Set( KSCPUsedTolerance, 0 );
       
   471 		}
       
   472 
       
   473 
   466         WriteConfiguration();
   474         WriteConfiguration();
   467         }
   475         }
   468         else
   476         else
   469         {
   477         {
   470             Dprint( (_L("CSCPTimestampPlugin::PasswordChanged() ReadConfiguration() != KErrNone") ));                      
   478             Dprint( (_L("CSCPTimestampPlugin::PasswordChanged() ReadConfiguration() != KErrNone") ));