Bug 45171 - Can't open or create libreoffice documents with password, when mozilla profile has an absolute path
Summary: Can't open or create libreoffice documents with password, when mozilla profil...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
3.4.5 release
Hardware: x86 (IA32) All
: medium normal
Assignee: Markus Mohrhard
URL:
Whiteboard: target:3.6.0 target:3.5.1
Keywords:
: 45250 45309 45318 (view as bug list)
Depends on:
Blocks: mab3.5
  Show dependency treegraph
 
Reported: 2012-01-24 05:10 UTC by meilan
Modified: 2012-05-04 09:03 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Document saved with password "password" (8.12 KB, application/vnd.oasis.opendocument.text)
2012-02-14 03:39 UTC, John Talbut
Details
Spreadsheet saved with password "password" (6.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-02-14 03:40 UTC, John Talbut
Details
ods test document (6.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-02-20 22:27 UTC, John Talbut
Details

Note You need to log in before you can comment on or make changes to this bug.
Description meilan 2012-01-24 05:10:23 UTC
After upgrade Libreoffice today

Can't open documents (Calc) created with previous versions of Libreoffice with passwords.
Can't create new documents (Calc, Writer) with password.

When save a new document, enter the password, confirm tha password, then Libreoffice pause for two seconds, and then Message error (Can't save file, general error)

Have Ubuntu 11.10 and Libreoffice 3.4.5, both is Spanish.
Comment 1 meilan 2012-01-27 09:46:44 UTC
1) Create new Writer or Calc document with Libreoffice 3.4.5
2) Save file, check "Save with password", click "save".
3) Enter a password, confirm it.
4) Close file.
5) Open the file just created.
6) Enter the password to open the file.
7) Libreoffice fails to open the file.

Popup error message. Spreadsheet cannot be opened.  Error Message "The password is incorrect. The
file cannot be opened."
Comment 2 meilan 2012-01-27 09:50:40 UTC
*** Bug 45318 has been marked as a duplicate of this bug. ***
Comment 3 meilan 2012-01-27 09:52:02 UTC
*** Bug 45309 has been marked as a duplicate of this bug. ***
Comment 4 meilan 2012-01-27 09:52:40 UTC
*** Bug 45250 has been marked as a duplicate of this bug. ***
Comment 5 Jean-Baptiste Faure 2012-01-29 01:41:57 UTC
Not reproducible with vanilla 3.4.5 version. It is a bug Ubuntu only.
Please follows this bug here : https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/919659

Closing as NotOurBug.

Best regards. JBF
Comment 6 Kwintin 2012-02-02 01:27:46 UTC
Thanks very much!

On Sun, Jan 29, 2012 at 11:41 AM, <bugzilla-daemon@freedesktop.org> wrote:

> https://bugs.freedesktop.org/show_bug.cgi?id=45171
>
> Jean-Baptiste Faure <jbf.faure@orange.fr> changed:
>
>           What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>             Status|UNCONFIRMED                 |RESOLVED
>         Resolution|                            |NOTOURBUG
>                 CC|                            |jbf.faure@orange.fr
>           See Also|                            |
> https://launchpad.net/bugs/
>                   |                            |919659
>
> --- Comment #5 from Jean-Baptiste Faure <jbf.faure@orange.fr> 2012-01-29
> 01:41:57 PST ---
> Not reproducible with vanilla 3.4.5 version. It is a bug Ubuntu only.
> Please follows this bug here :
> https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/919659
>
> Closing as NotOurBug.
>
> Best regards. JBF
>
> --
> Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>
Comment 7 Rene Engelhard 2012-02-13 06:56:33 UTC
ehm, I don't think that we should fall back into the old OOo habit as
"this doesn't work in our build using internal libs, thus it's NOTOURBUG"

There's system-libs, you know, and we DO NOT PATCH the password things. (at least not in 3.5.0 rc3, where this was also reported for, see http://bugs.debian.org/659733.

"plain" source uses nss-3.12.8-with-nspr-4.8.6 whereas Debian has
 libnspr4-0d | 4.9~beta5-2                | sid | amd64, armel, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc,     
+s390, s390x, sparc                                                                                                                                     
 libnss3-1d  | 3.13.1.with.ckbi.1.88-1    | sid | amd64, armel, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390,      
+s390x, sparc                                                                                                                                           
 libnss3-1d  | 3.13.1.with.ckbi.1.88-1+b1 | sid | armhf

Some nss incompatibility? (Interestingly, the password unittest *succeeds*)
Comment 8 Tomáš Chvátal 2012-02-13 07:00:11 UTC
I have similar report in gentoo:

https://bugs.gentoo.org/show_bug.cgi?id=398599

Note that we do not patch things around this either. But funny enough it really works with 3.5 for us.
Comment 9 Rene Engelhard 2012-02-13 07:01:37 UTC
in my last comment I of course meant "do work" or "doesn't fail"....
Comment 10 Rene Engelhard 2012-02-13 07:14:48 UTC
JBF: so as we see here this is not a Ubuntu bug, nor a Debian bug nor some distro-only bug. Will do a build with LibreOffices bundled nss this night to reconfirm, but even if that works, it's still a valid LibreOffice bug.

(No, using internal nss/nspr which missed many security fixes is not an option)
Comment 11 Markus Mohrhard 2012-02-13 09:24:19 UTC
Some comments:

Do the failing documents  have passwords >= 15 characters? 
Are all of them created with <=3.4.4 or >=3.4.5?
Did you try to save the documents in ODF1.1/1.0?

It would be good to collect some more information about the problems because digging in the password code without an idea and a test document is useless.
Comment 12 John Talbut 2012-02-14 03:15:11 UTC
The document that brought this problem to my attention was old and had been opened and edited in many versions of Open/LibreOffice.  It had an eight character password with upper and lower case letters and numbers.

I created a test document and a spreadsheet with LibreOffice 3.4.3 and saved them with the password "password" in both cases.  I copied them to a computer with LibreOffice 3.4.5 installed (all from Debian) and could not open them.  The
message was "The password is incorrect"

I tried to save a similar document using LibreOffice 3.4.5 using the password "password" and after inputting the password, the message was "Error saving the document Untitled 1: General Error. General input/output error"
Comment 13 John Talbut 2012-02-14 03:39:13 UTC
Created attachment 57028 [details]
Document saved with password "password"
Comment 14 John Talbut 2012-02-14 03:40:33 UTC
Created attachment 57029 [details]
Spreadsheet saved with password "password"
Comment 15 timjohn7 2012-02-14 15:31:39 UTC
(In reply to comment #12)
> The document that brought this problem to my attention was old and had been opened and edited in many versions of Open/LibreOffice.  It had an eight character
> password with upper and lower case letters and numbers.
> 
> I created a test document and a spreadsheet with LibreOffice 3.4.3 and saved them with the password "password" in both cases.  I copied them to a computer with
> LibreOffice 3.4.5 installed (all from Debian) and could not open them.  The
> message was "The password is incorrect"
> 
> I tried to save a similar document using LibreOffice 3.4.5 using the password "password" and after inputting the password, the message was "Error saving the
> document Untitled 1: General Error. General input/output error"

As stated in my original report, my symptoms are identical.  I'm running Ubuntu 11.10 with LO3.4.5 and have identical issues.

Both my Calc & Writer documents, saved with 8 alphnumeric passwords under LO 3.4.3 open in Open Office 3.2 with no problem but still will not open under LO 3.4.5.

I can also not password protect any LO 3.4.5 document/spreadsheet and get the same error message quoted in this post.
Comment 16 Petr Mladek 2012-02-15 01:31:20 UTC
I am unable to reproduce this with SUSE-specific build based on LO-3.4.5.

It smells like the bug 43868. It was broken in 3.4.5-rc1 but we reverted the problematic change for rc2, see
http://cgit.freedesktop.org/libreoffice/components/commit/?h=libreoffice-3-4-5&id=af45ce4dc9a4b7aea9214b5d74bf60809a4da78d

Bjorn, is it possible that the Ubuntu packages are based on 3.4.5-rc1 or that they still have the problematic change from some reasons?
Comment 17 Rene Engelhard 2012-02-15 02:42:20 UTC
pmladek: given that it also was reported in Debian (which is based on 3.4.5 final *of course* - 3.4.5.2), and even for 3.5.0 (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659733) - no.
Comment 18 Markus Mohrhard 2012-02-20 19:00:58 UTC
So trying it in this bug report too.

Can someone who is able to reproduce this bug report provide me an ods test document with password test and content 2 in cell A1 under the terms of LGPLv3+/MPL?

I would like to add a test case for this to sc/qa/unit/subsequent_filters-test.cxx:testPassword to prevent such bugs in future.
Comment 19 John Talbut 2012-02-20 22:27:40 UTC
Created attachment 57371 [details]
ods test document
Comment 20 John Talbut 2012-02-20 22:32:48 UTC
ods test document with password "test" and content 2 in cell A1 created with LibreOffice 3.4.3 attached.  I release it under the terms of
LGPLv3+/MPL.  I cannot open this document or save a document with a password with LibreOffice 3.4.5 OOO340m1 (Build:502)
Comment 21 Not Assigned 2012-02-21 06:25:14 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8f82bccf26d14d3ad4a64739edd9ba23c124b8ad

add test case for old password algorithm, related fdo#45171
Comment 22 Not Assigned 2012-02-21 10:59:52 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=adb293f84d2f7e50ecc8b37ce439fd75c42ad84c&g=libreoffice-3-5

add test case for old password algorithm, related fdo#45171


It will be available in LibreOffice 3.5.1.
Comment 23 Markus Mohrhard 2012-02-23 09:43:01 UTC
(In reply to comment #20)
> ods test document with password "test" and content 2 in cell A1 created with
> LibreOffice 3.4.3 attached.  I release it under the terms of
> LGPLv3+/MPL.  I cannot open this document or save a document with a password
> with LibreOffice 3.4.5 OOO340m1 (Build:502)

Thanks a lot. We added this test case to master and libreoffice-3-5 so if this is really a build problem and not a problem related to one of the Mozilla profiles we should spot the error already during the test run.

But I still suspect that it is related to the Mozilla profile, either firefox or thunderbird.
Comment 24 Markus Mohrhard 2012-03-08 10:10:01 UTC
Gentoo problem has been identified. 

So it is now just a ubuntu/debian problem. I have set up a vm with Ubuntu 11.10 and created a build with nearly the same autogen.sh settings as Bjoern for the official builds but this does not show the problem.

Would be great to get more information or a someone with a debug build who can reproduce this problem. I can give some information how to debug the problem and where to look.
Comment 25 timjohn7 2012-03-08 13:25:36 UTC
The problem is cleared in LibreOffice 3.5 (Ubuntu 11.10).
I simply upgraded LO and password-protected documents work as expected.

Sent from my HTC Desire HD

On Mar 8, 2012 8:10 PM, <bugzilla-daemon@freedesktop.org> wrote:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=45171
>
> --- Comment #24 from Markus Mohrhard <markus.mohrhard@googlemail.com>
2012-03-08 10:10:01 PST ---
> Gentoo problem has been identified.
>
> So it is now just a ubuntu/debian problem. I have set up a vm with Ubuntu
11.10
> and created a build with nearly the same autogen.sh settings as Bjoern
for the
> official builds but this does not show the problem.
>
> Would be great to get more information or a someone with a debug build
who can
> reproduce this problem. I can give some information how to debug the
problem
> and where to look.
>
> --
> Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
Comment 26 Markus Mohrhard 2012-03-08 13:31:20 UTC
(In reply to comment #25)
> The problem is cleared in LibreOffice 3.5 (Ubuntu 11.10).
> I simply upgraded LO and password-protected documents work as expected.
> 

Which build did you use? Our official Libreoffice builds won't show that problem anyway. It seems to be a pure distro specific problem with external nss.

I have not yet seen any bug report with someone using a non distro build.
Comment 27 Björn Michaelsen 2012-04-03 06:15:20 UTC
Opening attachment 57028 [details] on libreoffice-3.5.1-1ubuntu1 on Ubuntu precise works.
Attachment 57371 [details] doesnt open, but complains about malformed XML.
Comment 28 Markus Mohrhard 2012-04-03 06:23:11 UTC
(In reply to comment #27)
> Opening attachment 57028 [details] on libreoffice-3.5.1-1ubuntu1 on Ubuntu precise works.
> Attachment 57371 [details] doesnt open, but complains about malformed XML.

57371 is now part of our automated calc test and should be in 3.5.2. You find it in sc/qa/unit/data/ods/passwordOld.ods and is not broken as you can see in all tinderboxes :)

The error message complaining about malformed XML looks like it does not know the encrpytion algorithm and therefore tries to open the encrypted files.
Comment 29 Björn Michaelsen 2012-04-03 06:51:12 UTC
I explicitly saved that document 57371 and opened it from disc -- works fine.
(Still on 3.5.1-1ubuntu1 on Ubuntu precise)
b59999df62bb1fc8da041148c267871e  /home/bjoern/Downloads/ods test document.ods
Comment 30 dE 2012-04-15 21:05:24 UTC
Not a frequently used feature, and it's not opened.
Comment 31 Cor Nouws 2012-04-16 12:33:04 UTC
(In reply to comment #30)
> Not a frequently used feature, and it's not opened.

Where so many developers spend attention to this one?
Comment 32 Björn Michaelsen 2012-04-16 15:12:59 UTC
I gave this a few tries:
- 3.4.4 without other updates in oneiric -> no bug
- 3.4.6 without other updates in oneiric -> no bug
- 3.4.6 with updates -> bug
Comment 33 Markus Mohrhard 2012-04-16 15:23:47 UTC
(In reply to comment #32)
> I gave this a few tries:
> - 3.4.4 without other updates in oneiric -> no bug
> - 3.4.6 without other updates in oneiric -> no bug
> - 3.4.6 with updates -> bug

What do you mean with updates?
Comment 34 Björn Michaelsen 2012-04-16 15:45:15 UTC
@Markus: Security updates of other packages etc.

3.4.6 oneiric with updates enabling repositories one by one => no bug
this is either a heisenbug, or it is triggered by package configuration scripts
firing in an unfortunate order.
Comment 35 Björn Michaelsen 2012-04-17 02:40:19 UTC
Closing as NOTOURBUG as 3.4.6 works on a Ubuntu Oneiric install without updates. This is most likely a bug in some of the maintainer scripts for some of the updated packages.
Comment 36 Cor Nouws 2012-04-17 03:07:46 UTC
(In reply to comment #35)
> Closing as NOTOURBUG 

would have been my interpretation of the comments too. But much safer if you decide this ;-)
Comment 37 Björn Michaelsen 2012-04-30 09:38:24 UTC
Interesting observation from https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/919659/comments/72 :
"My firefox profile was on another disk partition than /home (because it is shared between several OS).
I have copied it into the ~/.mozilla folder and then there's no bug anymore !

So the bug it has nothing to do with the content of the firefox profile but it depends on the path to the firefox profile.

So when working with passwords, libreoffice does read the profile.ini file in ~/.mozilla folder (WHY?), then :
- if the path to the profile is not relative and situated outside the ~/.mozilla folder -> bug
- if the path is relative and inside the ~/.mozilla folder -> NO BUG"

@Markus: Since you have investigated this issue quite thoroughly, does this make you see an immediate nice and small fix?


Reopening with normal severity as it only hits a very small subgroup of users.
Comment 38 Markus Mohrhard 2012-04-30 10:24:22 UTC
(In reply to comment #37)
> Interesting observation from
> https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/919659/comments/72 :
> "My firefox profile was on another disk partition than /home (because it is
> shared between several OS).
> I have copied it into the ~/.mozilla folder and then there's no bug anymore !
> 
> So the bug it has nothing to do with the content of the firefox profile but it
> depends on the path to the firefox profile.
> 
> So when working with passwords, libreoffice does read the profile.ini file in
> ~/.mozilla folder (WHY?), then :
> - if the path to the profile is not relative and situated outside the
> ~/.mozilla folder -> bug
> - if the path is relative and inside the ~/.mozilla folder -> NO BUG"
> 
> @Markus: Since you have investigated this issue quite thoroughly, does this
> make you see an immediate nice and small fix?
> 
> 
> Reopening with normal severity as it only hits a very small subgroup of users.

There are some more interesting observations in the bug report.
I will have a look at this tomorrow and see if it is a bug in our init code, nss or mozilla.
Comment 39 ape 2012-04-30 11:48:41 UTC
(In reply to comment #38)
> There are some more interesting observations in the bug report.
> I will have a look at this tomorrow and see if it is a bug in our init code,
> nss or mozilla.

Windows_XP_sp2_x64; Windows_7_HP_sp1_x32:
1. An error is confirmed in LOdev_3.5.4rc0+; ID:4506a1b-a73d29c-6845e52-f269e46 (MinGW; Data stamp 2012-04-28_20.20.23)
2. There is no error in LibreOffice_3.5.3rc2 and LOdev_3.6.0alpha0; ID: c0a4c46 {Win-x86@6-fast; Data stamp 2012-04-27_21.25.23)
Comment 40 Markus Mohrhard 2012-05-02 14:11:41 UTC
With the help from the ubuntu bug report I think I finally have a point that looks wrong.

http://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx#174 and following seem to be wrong for the MINIMAL_PROFILEDISCOVER case.

We then just create the path to the profile through regDir + profilePath and we no longer respect if the profile path has been marked as relative or not. I will try to create a debug build with the ubuntu release configuration to confirm this.

If it is really only this point we might get a simple fix for this problem.
Comment 41 Markus Mohrhard 2012-05-03 13:07:26 UTC
(In reply to comment #40)
> With the help from the ubuntu bug report I think I finally have a point that
> looks wrong.
> 
> http://opengrok.libreoffice.org/xref/core/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx#174
> and following seem to be wrong for the MINIMAL_PROFILEDISCOVER case.
> 

Seems like this is the problem. The problem is that we add the absolute profile path to the regPath which creates an invalid path and therefore initializing nss fails.

This problems is only visible in distro builds and maybe MacOSX/Windows builds if they use MINIMAL_PROFILEDISCOVER. (I'm quite sure that our windows builds are affected)

Will post a fix to the ML for review after some more manual testing.
Comment 42 Not Assigned 2012-05-03 14:09:18 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fff2d18a08a37c0fa6a370e56591117fc08664d2

respect absolute paths for mozilla profile, fdo#45171, lp#919659
Comment 43 Not Assigned 2012-05-03 14:58:58 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3ee18325cf8c06c04296173619f4535671e391e9&g=libreoffice-3-5

respect absolute paths for mozilla profile, fdo#45171, lp#919659


It will be available in LibreOffice 3.5.4.
Comment 44 Markus Mohrhard 2012-05-03 20:28:28 UTC
It seems I can no longer reproduce the problem that opening password protected document fails whithout .mozilla dir. If someone can reproduce this behavior please open a new bug report and cc me.
Comment 45 Not Assigned 2012-05-04 06:19:59 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7ead068be9f865327da7aef1cdc01614f25fc4a6

more robust nss initialization, related fdo#45171
Comment 46 Not Assigned 2012-05-04 09:03:33 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bf9ab0b486ee336bd4fb91e5ad2320d25593d696&g=libreoffice-3-5

more robust nss initialization, related fdo#45171


It will be available in LibreOffice 3.5.4.