Bug 339170 - Remember encryption passwords
Summary: Remember encryption passwords
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 0.20.0
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-18 11:41 UTC by arian
Modified: 2015-02-10 00:33 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Workaround patch to allow access to KWallet (587 bytes, patch)
2015-02-06 23:18 UTC, MarkW
Details

Note You need to log in before you can comment on or make changes to this bug.
Description arian 2014-09-18 11:41:38 UTC
At least PDF may be password protected (I don't know about the other formats). As of now, every time one opens one single protected PDF one is asked for the password. I propose okular saves the password for future use.
Comment 1 Andre Klapper 2014-09-18 11:48:24 UTC
Hi Arian,
do you have kwallet enabled? This should already be possible according to bug 218806.
Comment 2 Albert Astals Cid 2014-09-18 13:07:06 UTC
Yeah we already do that
Comment 3 Christoph Feck 2014-10-23 20:59:21 UTC
If you can provide the information requested in comment #1, please add it.
Comment 4 Christoph Feck 2014-11-16 11:15:57 UTC
To further investigate this issue, KDE developers need the information requested in comment #1. If you can provide it, or need help with finding that information, please add a comment.
Comment 5 Christoph Feck 2014-12-12 21:57:43 UTC
No response, changing status. If you have more information, please add a comment.
Comment 6 MarkW 2015-02-06 23:18:14 UTC
Created attachment 90957 [details]
Workaround patch to allow access to KWallet
Comment 7 MarkW 2015-02-06 23:18:46 UTC
I also suffer the same issue. But I have 2 systems, one where passwords are being saved, and another where passwords are not being saved.

Here are the system details:
Okular 0.19.3 / KDE 4.13.3 - allows for storage / retrieve in KWallet
Okular 0.20.0 / KDE 4.14.1 - does not store / retrieve from KWallet
origin/master (v14.12.2-18-g24006bb) also fails in the same way

On both system, I do have KWallet enabled, and it is working.

Doing some debug, here is my analysis:
  - KWallet will be used in Part::doOpenFile if walletKey.isNull() != NULL (in my case it is NULL)
  - walletKey should be setup by m_document->walletDataForFile()
  - In Document::walletDataForFile, d->m_generator == NULL, so nothing gets set
  - Rolling back the anaylsis...
  - Before m_document->walletDataForFile() is called, m_document->openDocument() will be called
  - Document::openDocument() calls d->openDocumentInternal()
  - DocumentPrivate::openDocumentInternal() does setup m_generator, but as DocumentPrivate::openDocumentInternal() can't open the file (it is password protected, but we don't have a valid password yet), this routine will fail
  - as part of the cleanup during failure processing, DocumentPrivate::openDocumentInternal() will set m_generator = 0, but it is this m_generator that is required later to access KWallet

I have coded the one line code change to remove setting 'm_generator = 0;' and okular / KWallet integration is working correctly.

I've added my patch to work-around (fix?) the issue.

But, what are the implications of removing 'm_generator = 0;' from DocumentPrivate::openDocumentInternal() ? Though it does solve the immediate problem - but are there other issues that could be introduced ?
Comment 8 CynthMcG 2015-02-07 02:06:22 UTC
I am finding it difficult to use Okular to open a locked PDF from my university. We use these files for sharing textbooks, and I need to be able to unlock it on my desktop. While I can use the web viewer from my online college, this can be rather tedious and it would be preferable to use the login/password protocols that exist within the document. I cannot even use the forms to do this. I am new to Linux, and will need to learn how to open up KWallet. Even so, being able to open this document in the first place will be a big help.
Comment 9 Albert Astals Cid 2015-02-09 21:04:23 UTC
Git commit 10a1899058898eeacc4e3064506825634d2c07ad by Albert Astals Cid.
Committed on 09/02/2015 at 21:03.
Pushed by aacid into branch 'Applications/14.12'.

Hack to restore KWallet support

Better fix code-wise will come with an API break in master

M  +6    -0    core/document.cpp
M  +2    -0    core/document_p.h

http://commits.kde.org/okular/10a1899058898eeacc4e3064506825634d2c07ad
Comment 10 MarkW 2015-02-10 00:30:41 UTC
Albert - works a dream.

Thanks,
MarkW
Comment 11 Albert Astals Cid 2015-02-10 00:33:08 UTC
Thanks for your analysis :)