1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: security_trusted_path.inc,v $
13 '* last change: $Author: rt $ $Date: 2008-08-28 11:40:42 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/******************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : Execute macros from trusted path
38 '\******************************************************************************
40 testcase tSecTrustedPath( cWorkFile as string, iSecLevel as integer )
42 '///<h1>Execute macros from a trusted path</h1>
43 '///<i>This testcase takes parameters and requires a number of settings
44 '///+ to run. See the calling .bas-file for details. <br>
45 '///+ Furthermore a number of
46 '///+ workfiles are used that have a documentbound macro as payload which is
47 '///+ executed at the "On document load" event.<br>
53 '///+<li>Click "FileOpen" or go to the dialog via menu</li>
54 '///+<li>Enter the path to a file with macros within the trusted path</li>
55 '///+<li>Open the file</li>
56 cWorkFile = convertToUrl( convertpath( cWorkFile ) )
57 FileOpen( "URL", cWorkFile, "FrameName", "_default"
58 irc = hFileWait( false )
60 ' We have quite a bunch of possible combinations here. Some trigger a security warning
61 ' others do not. Files within a trusted path should never prompt.
63 ' |---------------------------------------------------------|
64 ' | Trusted | Security Level / Warning displayed |
65 ' | Path | Low | Medium | High | Very High |
66 ' |---------------------------------------------------------|
67 ' | Yes | No | No | No | No |
68 ' |---------------------------------------------------------|
69 ' | No*) | No | Yes | Blocked | Blocked |
70 ' |---------------------------------------------------------|
71 ' *) Covered by test "f_sec_macrosecurity.bas"
74 '///+<li>Test for security-warning, warn if it pops up</li>
76 kontext "SecurityWarning"
77 if ( SecurityWarning.exists() ) then
78 warnlog( "Macro Security Warning was not expected at this point" )
83 '///+<li>Verify that the macro is executed</li>
84 printlog( "Verify that the macro is executed" )
86 if ( active.exists( 2 ) ) then
87 cMsg = active.getText()
88 cMsg = hRemoveLineBreaks( cMsg )
89 if ( cMsg = "TTMacro3" ) then
90 printlog( "Macro was executed" )
92 warnlog( "Invalid messagebox is open, please check" )
95 '///+<li>Close the macro</li>
100 '///+<li>Close the document</li>