577 using namespace CommsDat; |
577 using namespace CommsDat; |
578 |
578 |
579 CMDBSession* db = CMDBSession::NewL( KCDVersion1_1 ); |
579 CMDBSession* db = CMDBSession::NewL( KCDVersion1_1 ); |
580 CleanupStack::PushL( db ); |
580 CleanupStack::PushL( db ); |
581 |
581 |
582 db->OpenTransactionL(); |
|
583 CleanupStack::PushL(TCleanupItem(RollBackDBTransaction, db)); |
|
584 |
|
585 // Set attributes so that also protected iaps can be accessed |
582 // Set attributes so that also protected iaps can be accessed |
586 db->SetAttributeMask( ECDHidden | ECDProtectedWrite ); |
583 db->SetAttributeMask( ECDHidden | ECDProtectedWrite ); |
587 |
584 |
588 // Create an iap record |
585 // Create an iap record |
589 CCDIAPRecord* iapRecord = |
586 CCDIAPRecord* iapRecord = |
590 static_cast<CCDIAPRecord*>( |
587 static_cast<CCDIAPRecord*>( |
591 CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); |
588 CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); |
592 CleanupStack::PushL( iapRecord ); |
589 CleanupStack::PushL( iapRecord ); |
593 |
590 |
594 iapRecord->SetRecordId( iIapId ); |
591 iapRecord->SetRecordId( iIapId ); |
595 |
|
596 TBool clearedProtectedIap = ClearProtectedRecord( *iapRecord ); |
|
597 |
592 |
598 iapRecord->LoadL( *db ); |
593 iapRecord->LoadL( *db ); |
599 |
594 |
600 iapRecord->iService.LoadL( *db ); |
595 iapRecord->iService.LoadL( *db ); |
601 |
596 |
613 PROFILE_DEBUG1( |
608 PROFILE_DEBUG1( |
614 "CSIPApnConfigurationHandler::ChangeApnL linked service loaded" ) |
609 "CSIPApnConfigurationHandler::ChangeApnL linked service loaded" ) |
615 |
610 |
616 CCDOutgoingGprsRecord* serviceRecord = |
611 CCDOutgoingGprsRecord* serviceRecord = |
617 static_cast<CCDOutgoingGprsRecord*>( iapRecord->iService.iLinkedRecord ); |
612 static_cast<CCDOutgoingGprsRecord*>( iapRecord->iService.iLinkedRecord ); |
618 |
|
619 TBool clearedProtectedService = ClearProtectedRecord( *serviceRecord ); |
|
620 |
613 |
621 PROFILE_DEBUG6( |
614 PROFILE_DEBUG6( |
622 "CSIPApnConfigurationHandler::ChangeApnL() curr apn", |
615 "CSIPApnConfigurationHandler::ChangeApnL() curr apn", |
623 serviceRecord->iGPRSAPN.GetL() ); |
616 serviceRecord->iGPRSAPN.GetL() ); |
624 |
617 |
635 serviceRecord->iGPRSDisablePlainTextAuth = aUseSecureAuthentication; |
628 serviceRecord->iGPRSDisablePlainTextAuth = aUseSecureAuthentication; |
636 |
629 |
637 PROFILE_DEBUG3( |
630 PROFILE_DEBUG3( |
638 "CSIPApnConfigurationHandler::ChangeApnL() new security", |
631 "CSIPApnConfigurationHandler::ChangeApnL() new security", |
639 aUseSecureAuthentication ) |
632 aUseSecureAuthentication ) |
640 |
633 |
641 serviceRecord->ModifyL( *db ); |
634 TRAPD(err, serviceRecord->ModifyL( *db )); |
642 |
635 if (err != KErrNone) |
643 if ( clearedProtectedIap ) |
636 { |
644 { |
637 PROFILE_DEBUG3( "CSIPApnConfigurationHandler::ChangeApnL,ModifyL leaves",err ) |
645 // Set protection back |
638 User::Leave(err); |
646 iapRecord->SetAttributes( ECDProtectedWrite ); |
639 } |
647 iapRecord->ModifyL( *db ); |
640 |
648 } |
|
649 |
|
650 if ( clearedProtectedService ) |
|
651 { |
|
652 // Set protection back |
|
653 serviceRecord->SetAttributes( ECDProtectedWrite ); |
|
654 serviceRecord->ModifyL( *db ); |
|
655 } |
|
656 |
|
657 db->ClearAttributeMask( ECDHidden | ECDProtectedWrite ); |
641 db->ClearAttributeMask( ECDHidden | ECDProtectedWrite ); |
658 |
642 |
659 CleanupStack::PopAndDestroy( iapRecord ); |
643 CleanupStack::PopAndDestroy( iapRecord ); |
660 |
|
661 db->CommitTransactionL(); |
|
662 |
|
663 CleanupStack::Pop(); //cleanup item |
|
664 |
644 |
665 CleanupStack::PopAndDestroy( db ); |
645 CleanupStack::PopAndDestroy( db ); |
666 |
646 |
667 if (iCellularDataBlocked) |
647 if (iCellularDataBlocked) |
668 { |
648 { |
671 |
651 |
672 SendApnChangedNotificationL( aApn ); |
652 SendApnChangedNotificationL( aApn ); |
673 |
653 |
674 PROFILE_DEBUG1( |
654 PROFILE_DEBUG1( |
675 "CSIPApnConfigurationHandler::ChangeApnL(), exit" ) |
655 "CSIPApnConfigurationHandler::ChangeApnL(), exit" ) |
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CSIPApnConfigurationHandler::ClearProtectedRecord |
|
680 // ----------------------------------------------------------------------------- |
|
681 // |
|
682 TBool CSIPApnConfigurationHandler::ClearProtectedRecord( |
|
683 CommsDat::CCDRecordBase& aRecord ) |
|
684 { |
|
685 TBool cleared( EFalse ); |
|
686 if ( aRecord.IsSetAttribute( CommsDat::ECDProtectedWrite ) ) |
|
687 { |
|
688 aRecord.ClearAttributes( CommsDat::ECDProtectedWrite ); |
|
689 cleared = ETrue; |
|
690 } |
|
691 return cleared; |
|
692 } |
656 } |
693 |
657 |
694 // ----------------------------------------------------------------------------- |
658 // ----------------------------------------------------------------------------- |
695 // CSIPApnConfigurationHandler::SetMonitoringState |
659 // CSIPApnConfigurationHandler::SetMonitoringState |
696 // ----------------------------------------------------------------------------- |
660 // ----------------------------------------------------------------------------- |
934 iDBMonitoringRetryCount = 0; |
898 iDBMonitoringRetryCount = 0; |
935 iCellularDataBlocked = EFalse; |
899 iCellularDataBlocked = EFalse; |
936 PROFILE_DEBUG1("DatabaseMonitoringCompletedL::AllowCellularDataUsage Exit" ); |
900 PROFILE_DEBUG1("DatabaseMonitoringCompletedL::AllowCellularDataUsage Exit" ); |
937 } |
901 } |
938 |
902 |
939 // ----------------------------------------------------------------------------- |
|
940 // CSIPApnConfigurationHandler::RollBackDBTransaction |
|
941 // ----------------------------------------------------------------------------- |
|
942 // |
|
943 void CSIPApnConfigurationHandler::RollBackDBTransaction(TAny* aDb) |
|
944 { |
|
945 CMDBSession* db = static_cast<CMDBSession*>(aDb); |
|
946 TRAP_IGNORE(db->RollbackTransactionL()); |
|
947 } |
|
948 |
|
949 // End of file |
903 // End of file |