Blob Blame History Raw
From: Dario Faggioli <dfaggioli@suse.com>
Date: Wed Jan 26 04:01:09 AM CET 2022
Subject: [PATCH] Console: Avoid terminating on failed password check

File-roller (i.e., GNOME's Archive Manager), which was working fine
with p7zip and p7zip-full, does not work well with 7zip. More specifically,
it is not possible to open or extract a password protected archive, for
which also the list of the files in the archive itself has been hidden.

This seems to happen because now GetPassword_HRESULT() does some kind of
error checking, and depending on the results, cause its calling function
to return with an error, which in turns terminates the 7zz program in
a way that file-roller interpretes as a critical error, and everything
stops.

On the other hand, in p7zip-full, the GetPassword() function wasn't
doing this. There's still a failure, but one that triggers File-roller
to ask the password of the archive, and once that is provided everything
works.

From a CLI perspecvive, nothing changes, and things still work fine and
in the exact same way, no matter whether or not this patch is applied.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
 OpenCallbackConsole.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -Nru 7zip/CPP/7zip/UI/Console/OpenCallbackConsole.cpp 7zip_2/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
--- 7zip/CPP/7zip/UI/Console/OpenCallbackConsole.cpp	2017-02-18 00:42:14.000000000 +0100
+++ 7zip_2/CPP/7zip/UI/Console/OpenCallbackConsole.cpp	2022-01-26 08:40:15.616512459 +0100
@@ -87,7 +87,7 @@
   if (!PasswordIsDefined)
   {
     ClosePercents();
-    RINOK(GetPassword_HRESULT(_so, Password));
+    GetPassword_HRESULT(_so, Password);
     PasswordIsDefined = true;
   }
   return StringToBstr(Password, password);