https://bugs.documentfoundation.org/show_bug.cgi?id=55425

--- Comment #4 from Kevin Suo <suokunl...@126.com> ---
A better approach is to add a --mode checkEncryption in the out-of-process
xpdfimport binary in 
https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx?r=648e4106

It should be called like this:
./xpdfimport --mode checkEncryption filename
./xpdfimport --mode checkEncryption -upw 123456 filename

it should return 0 if the file is not encrypted, or return 0 if file is
encrypted and the password upw is correct.

it should exit(1) or any other error code, or print a message, if the file is
encrypted but no password is provided or wrong password.


then call this to replace the encryption check in
https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/wrapper/wrapper.cxx?r=8b9e5024#1021

here, we first call the xpdfimport in checkEncryption mode without a password.
If the process return code 0 then go on with the following
osl_executeProcess_WithRedirectedIO process call in normal mode, otherwise call
getPassword as shown in
https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/wrapper/wrapper.cxx?r=8b9e5024#928
until checkEncryption mode returns 0 or user cancels password input

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to