Issue 119366

Summary: Can't remove password from file (regression)
Product: General Reporter: DonJaime <donjaime>
Component: uiAssignee: Oliver-Rainer Wittmann <orw>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: doneyourself, doudou1976, jsc, orw, polo8495, zheng.easyfan
Version: 3.4.0 Beta (OOo)Flags: jsc: 3.4.1_release_blocker+
Target Milestone: 3.4.1   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
The solution of i119366
orw: review+
new patch orw: review+

Description DonJaime 2012-05-16 15:26:09 UTC
Once a file has been saved with a password, it is not possible to save it without a password. Choosing "Save as..." and unchecking "Save with password" does not work, whether you save it with a new name or overwrite the old file.

Something similar was fixed under Bug 96205, but that was only reported for overwrites.
Comment 1 Oliver-Rainer Wittmann 2012-05-24 09:48:38 UTC
I have reproduce the described defect on Windows 7 with OOo 3.4 beta and AOO 3.4.
It works fine in OOo 3.3
Comment 2 Oliver-Rainer Wittmann 2012-05-24 09:49:04 UTC
forgot to confirm
Comment 3 zhao xia 2012-06-18 01:59:18 UTC
Agree this should be taken as zoo 341 release blocker.
Comment 4 zhengfan 2012-06-18 09:48:47 UTC
Taking a look on this issue. Maybe give response in several days.
Comment 5 jsc 2012-06-19 08:31:54 UTC
set release blocker flag for 3.4.1
Comment 6 zhengfan 2012-06-25 08:19:08 UTC
Created attachment 78458 [details]
The solution of i119366
Comment 7 zhengfan 2012-06-25 08:19:23 UTC
This issue was solved.

In general, this is a setting confusion issue. In current saving process, both SID_ENCRYPTIONDATA and SID_PASSWORD are working for setting password on a document.
Refer to the SfxObjectShell::ExecFile_Impl() in file SRC/sfx2/source/doc/objserv.cxx:line 595-599 please.
And, as what we imagine, after doing the file dialog executing with deselecting the check box of "Save with password", the result parameter set, which is to customize saving process, wont record said 2 SID inside anymore, for indicating that the following saving process will not concern about the password stuff anymore.
But when performing the exact preparation SaveAs process in SfxobjectShell::PreDoSaveAs_impl(), only the the default SID_PASSWORD was cleared, but  SID_ENCRYPTIONDATA  was not. The issue happens.

For solving it, we just simply add the item SID_ENCRYPTIONDATA  clearing in  SfxobjectShell::PreDoSaveAs_impl(), similar as the SID_PASSWORD.
Comment 8 Oliver-Rainer Wittmann 2012-06-25 08:28:35 UTC
taking over for reviewing the patch
Comment 9 Oliver-Rainer Wittmann 2012-06-25 10:55:36 UTC
Comment on attachment 78458 [details]
The solution of i119366

minor remark:
the patch does not contain the full path information for the patched file objstor.cxx. I am lucky that I know that it located in /sfx2/source/doc/
Comment 10 Oliver-Rainer Wittmann 2012-06-25 11:04:20 UTC
Comment on attachment 78458 [details]
The solution of i119366

The patch looks good and works.
But it does not solve the issue, if the "Save As..." action is used to overwrite the existing file.
Comment 11 Oliver-Rainer Wittmann 2012-06-25 11:08:39 UTC
-> zhengfan:
I have reviewed your patch. It solves the issue when saving a document under a new file name.
When the document is saved via "Save As..." to overwrite the existing file the password protection is not removed.

Will you continue your work on this issue to solve this defect, too?
If yes, I will assign this issue to you. Otherwise, I can take care of it.
Comment 12 Oliver-Rainer Wittmann 2012-06-25 11:42:31 UTC
assigning to zhengfan as he will continue to work on this issue.
Comment 13 zhengfan 2012-06-26 09:42:34 UTC
Created attachment 78487 [details]
new patch

Refine the patch following the Oliver's use case
Comment 14 Oliver-Rainer Wittmann 2012-06-26 10:21:51 UTC
taking over this issue for reviewing the new patch.
Thx zhengfan for the new solution.
Comment 15 Oliver-Rainer Wittmann 2012-06-26 14:26:15 UTC
Comment on attachment 78487 [details]
new patch

finished my review -> patch works and solves the problem as far as I can see
Comment 16 Oliver-Rainer Wittmann 2012-06-26 14:45:45 UTC
Comment on attachment 78458 [details]
The solution of i119366

I think this patch can be marked as obsolete as it is included in the new one.
Comment 17 Oliver-Rainer Wittmann 2012-06-26 14:50:02 UTC
applied the patch to trunk - revision 1354039

I took the freedom to adjust the formatting and the comments. If this is not ok, I will adjust it.
Comment 18 Oliver-Rainer Wittmann 2012-06-26 15:10:56 UTC
merged patch from trunk into branch AOO34, revision 1354054
Comment 19 Terry Yang 2012-06-28 03:23:02 UTC
Verify not fixed on trunk r1354384, Failed to saved a file with password, the failed message in dialog is "General Error: Generral input/output error", also failed open the password protect file, it pop up password incorrect dialog but i input correct password. Reopen this bug.
My Platform is Win 7 X64 EN.
Comment 20 Terry Yang 2012-06-28 03:28:10 UTC
Test again with MS format (.xls) it will work fine, but with our format (.ods), the issue i mentioned before will repro.
Comment 21 liuping 2012-06-28 06:41:27 UTC
I verfity the bug  on build  version 1354384 on Win7 OS 
I save .ods .odt .odp without password successfully ,but save .ods .odt .odp with password ,the error message pop up
 
I verify this bug on build  version  r1351960 on Win7 OS
 
I save .ods .odt .odp without password or password ,which is successful
Comment 22 zhengfan 2012-06-28 07:07:10 UTC
lucky for me that I have 3 build enviroment on verification this, all of them are under Windows XP. The difference are: 
In build env A, there is no moz package involved;
In build env B, there is moz package involved, but without my solution of issue 119366;
In build env C, there is moz package involved and with my solution of issue 119366;

And I did the following test cases:
In env A:
1.1 Save into ODT, without password, passed;
1.2 Save into ODT, with password, failed, with error message "General Error: Generral input/output error";
1.3 Save into DOC, without password, passed;
1.4 Save into DOC, with password, passed; But in continual case: "Save As without password", failed;
2.1 Save into ODP, without password, passed;
2.2 Save into ODP, with password, failed, with error message "General Error: Generral input/output error";
2.3 Save into PPT, without password, passed;
2.4 Save into PPT, the "saveing with password" checkbox is disabled... Weird.
3.1 Save into ODS, without password, passed;
3.2 Save into ODS, with password, failed, with error message "General Error: Generral input/output error";
3.3 Save into XLS, without password, passed;
3.4 Save into XLS, with password, passed; But in continual case: "Save As without password", failed;

In env B:
1.1 Save into ODT, without password, passed;
1.2 Save into ODT, with password, passed; But in continual case: "Save As without password", failed;
1.3 Save into DOC, without password, passed;
1.4 Save into DOC, with password, passed; But in continual case: "Save As without password", failed;
2.1 Save into ODP, without password, passed;
2.2 Save into ODP,with password, passed; But in continual case: "Save As without password", failed;
2.3 Save into PPT, without password, passed;
2.4 Save into PPT, the "saveing with password" checkbox is disabled... Weird.
3.1 Save into ODS, without password, passed;
3.2 Save into ODS, with password, passed; But in continual case: "Save As without password", failed;
3.3 Save into XLS, without password, passed;
3.4 Save into XLS, with password, passed; But in continual case: "Save As without password", failed;

In env C:
1.1 Save into ODT, without password, passed;
1.2 Save into ODT, with password, passed; In continual case: "Save As without password", Passed;
1.3 Save into DOC, without password, passed;
1.4 Save into DOC, with password, passed; In continual case: "Save As without password", Passed;
2.1 Save into ODP, without password, passed;
2.2 Save into ODP,with password, passed; In continual case: "Save As without password", Passed;
2.3 Save into PPT, without password, passed;
2.4 Save into PPT, the "saveing with password" checkbox is disabled... Weird.
3.1 Save into ODS, without password, passed;
3.2 Save into ODS, with password, passed; In continual case: "Save As without password", Passed;
3.3 Save into XLS, without password, passed;
3.4 Save into XLS, with password, passed; In continual case: "Save As without password", Passed;

Conclution:

Such error messages are caused missing moz package building involved.
And such I/O error message only occurs in the ODF format file saving with password.
Both ODF format saving with password and OFFICE format saving with password have the issue 119366;
My solution could work on both MS office files saving and ODF format saving;

For you review.
Comment 23 Terry Yang 2012-06-29 09:53:51 UTC
Test again on trunk r1355082 which include modules nss and moz.
From the result I think we can close this bug.

Test with 3 scenario.
A. Saved with password, then remove password with same revision
B. Saved with password with OOo3.3, then remove password with r1355082
C. Saved with password with MS 2003, then remove password with r1355082

Result:
Scenario A:
ods/xls/odt/odp work fine
doc can saved with password successfully, but when reopen the saved file, it is under read-only mode. This also repro on OOo 3.3
ppt is weird, in OOo 3.3, In saved dialog, the password check box can check,  input password and saved the file then reopen it, No need password, so saved with password in OOo3.3 for ppt format is not work.
In trunk r1355082, In saved dialog, "saveing with password" checkbox is disabled
If we saved ppt file with password protect by OpenOffice, then open in MS Office, no need input password, so it is totally not work.

Scenario B:
ods/xls/odt/odp work fine
doc file with password open under read-only mode, we can saved to another file to remove password.
ppt file can't saved with password protect


Scenario C:
xls work fine
doc file with password open under read-only mode, we can saved to another file to remove password.
ppt file with password protect by MS office can't open in Open Office, it said "Read Error. the loading of password-encrypted Microsoft PowerPint presentations is not supported."

For PPT issue, there have 2 bugs about saved(Bug 39527) and loading(Bug 46307)
For doc open with read-only mode issue, i think it is a know issue, but i can't find the bug in bugzilla, I will double check in bugzilla and open a new one if need.
Comment 24 Terry Yang 2012-07-02 06:22:03 UTC
Verify fixed on AOO34 branch r1354891.
Close this bug
Comment 25 jsc 2012-07-25 09:15:15 UTC
set target milestone AOO 3.4.1