https://bugs.kde.org/show_bug.cgi?id=376573

--- Comment #6 from un...@physics.ubc.ca ---
OK, I think I have tracked down the problems.

a) pam_kwallet does not have the user's USER and HOME entries in the
environment and thus kwalletd5 cannot open the .local/share/kwalletd directory
to find the wallets. 
One needs to put something like
set_env(pamh,"HOME",userInfo->pw_dir);
set_env(pamh,"USER",username);
somwhere after userInfo is set up in
kwallet-pam-5.9.2/pam_kwallet.c
Otherwise Qt cannot open the above directory.

b)
There is a race between pam's running of kwalletd5 and X coming up, which, at
least on Mageia 6 kwalletd5 always looses. I have kludged this by putting a 2
second sleep into main() in kwallet.5.32.0/src/runtime/kwalletd/main.cpp 
just after 
hash=checkPamModule(argc,argv);
if(hash != nullptr) sleep(2);

This delays the Qt calls in kwalletd5 long enough that X has come up and the Qt
calls do not crash. Note that there must be a more elegant way of doing this
than putting in that sleep.

c) as mentioned, the waitForEnvironment call in checkPamModule is unnecessary
because pam already copies the environment over to kwalletd5 in the execve
call, and unwanted because for some reason waitForEnvironment() waits forever
and never returns.

Doing all of the above, when I log into my account, the wallet after login is
open. 

Without them, I have to reenter my password into the first program that uses
kwallet.

Note that the socket in /run/user/<UID>/kwallet.socket  is never actually used
by anything as far as I know. Certainly kwalletd5 does not use it, and only
uses the 
existence of PAM_KWALLET5_LOGIN environment variable to see if kwalletd was
started with the --pam-logon argument. 
Since that environment variable is in the environment opened by pam forever
after, all of the programs using kwalletd5 check for the --pam-login variable.
This causes no real harm, it is just not very elegant.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to