Apache OpenOffice (AOO) Bugzilla – Issue 108245
Password protection and unprotection of sheet with API/Macro is broken
Last modified: 2017-05-20 10:34:16 UTC
When I unprotect a sheet with a Macro, the password used in the macro is not relevant. When setting the protection in the same macro, the first time the original password (set via the GUI) is kept. Only after running the second time, the password used in the macro is set... To test: Open tstSheetProtection_WithAPI Instructions there 1. set sheet protection with password “testpw” 2. run macro standard.module1.main (Alt-F11) 3. check the protection of the sheet via Tools|Protection|Sheet 4. note that you still have to use “testpw” 5. now run the macro again 6. to unprotect via Tools|Protect|Sheet, now you have to use “doesnt matter”
Created attachment 67142 [details] test document
first stumbled over the bug in 3.2.0rc1 but it also exists in 3.1.1
I cannot reproduce on OOO 3.1.1, Windows XP. The macro does not unprotect, nor change the password of a sheet protected by another password.
I confirm on OOo 3.2.0 (OOo320m12 (Build 9483)) that : - The unprotect() method doesn't return an error if you enter the wrong password. Moreover, it doesn't return an exception if you enter an integer as a parameter of the method unprotect() : void unprotect(string aPassword)[1]. - The protect() method overrides the current password (set via the GUI) ! [1] http://api.openoffice.org/docs/common/ref/com/sun/star/util/XProtectable.html#unprotect
.
taking the issue
Fixed in CWS "dr73": 1. unprotect with a wrong password throws an IllegalArgumentException. 2. protect on a sheet that was already protected doesn't modify the password (but no exception - consistent with other operations on protected cells). Note: The second case includes protection without password. If protect is first called with an empty string, and then again with a password, in OOo 3.1.1 the result was protection with the password. Now, it's protection without password, to be consistent.
Created attachment 68147 [details] test case protect
Protect on a sheet that was already protected does modify the password with a macro (see protect.ods).
I confirm that a protect() call overrides the previous sheet protection password on OOo 3.2.0 (OOo320m12 (Build 9483)) on Linux. I tested it with aladdin2k7's test file (protect.ods, http://www.openoffice.org/nonav/issues/showattachment.cgi/68147/protect.ods).
reassigning to QA for verification
verified in internal build cws_dr73