File 0001-Don-t-create-salt-file-if-user-home-directory-does-n.patch of Package pam_kwallet
From ead47c3cd4762375f584d41019c3e4170d2868bd Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Wed, 16 May 2018 19:54:48 +0200
Subject: [PATCH 1/4] Don't create salt file if user home directory does not
exist
Reviewers: mart, fvogt
Reviewed By: mart, fvogt
Subscribers: fvogt, mgerstner, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D12909
---
pam_kwallet.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pam_kwallet.c b/pam_kwallet.c
index 661ed8d..07b357d 100644
--- a/pam_kwallet.c
+++ b/pam_kwallet.c
@@ -707,6 +707,12 @@ int kwallet_hash(pam_handle_t *pamh, const char *passphrase, struct passwd *user
return 1;
}
+ struct stat info;
+ if (stat(userInfo->pw_dir, &info) != 0 || !S_ISDIR(info.st_mode)) {
+ syslog(LOG_ERR, "%s-kwalletd: user home folder does not exist", logPrefix);
+ return 1;
+ }
+
#ifdef KWALLET5
char *fixpath = "kwalletd/kdewallet.salt";
#else
@@ -716,7 +722,6 @@ int kwallet_hash(pam_handle_t *pamh, const char *passphrase, struct passwd *user
char *path = (char*) malloc(pathSize);
sprintf(path, "%s/%s/%s", userInfo->pw_dir, kdehome, fixpath);
- struct stat info;
char *salt = NULL;
if (stat(path, &info) != 0 || info.st_size == 0) {
createNewSalt(pamh, path, userInfo);
--
2.17.1