Update contrib.
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 LOCAL_D RTest TheTest (_L("T_BACKUPSRVCAP"));
24 @SYMTestCaseID SYSLIB-BAFL-UT-4049
25 @SYMTestCaseDesc BAFL Backup System Potential Security Vulnerability
27 @SYMTestActions Call CloseAll, CloseFileL, RestartAll, RestartFile and NotifyBackupOperationL without correct capablity.
28 @SYMTestExpectedResults Capablity error is expected. Test must not fail*/
29 void Defect_DEF103793L()
33 CBaBackupSessionWrapper* backupSession = CBaBackupSessionWrapper::NewL();
35 TBackupOperationAttributes attribs;
36 attribs.iFileFlag=MBackupObserver::EReleaseLockNoAccess;
37 attribs.iOperation=MBackupOperationObserver::EStart;
39 TRAP(err, backupSession->NotifyBackupOperationL(attribs));
40 TheTest(err == KErrNone);
42 attribs.iOperation=MBackupOperationObserver::EEnd;
44 TRAP(err, backupSession->NotifyBackupOperationL(attribs));
45 TheTest(err == KErrNone);
47 TRequestStatus status;
48 backupSession->CloseAll(MBackupObserver::EReleaseLockNoAccess, status);
49 User::WaitForRequest (status);
50 TheTest(status == KErrPermissionDenied);
52 _LIT(KFileName1, "FileName1");
54 file.Copy(KFileName1);
56 backupSession->RestartFile(file);
58 backupSession->RestartAll();
60 TRAP(err, backupSession->CloseFileL(file, MBackupObserver::EReleaseLockNoAccess));
61 TheTest(err == KErrPermissionDenied);
69 LOCAL_C void DoTestsL()
78 CTrapCleanup* theTrapCleanup=CTrapCleanup::New();
80 TheTest.Printf(_L("\n"));
82 TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-BAFL-UT-4049 Backupsrc capablity Tests "));
84 TRAPD(err, DoTestsL());
85 TheTest(err == KErrNone);
90 delete theTrapCleanup;