Commit 84dbc30f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Small fixes for execute_kwallet

Don't return on error conditions, exit instead. It's a child process we
need to finish it
Don't use pam_syslog, there's a comment at the beginning saying it
doesn't work, it seems to kind of work for me but some investigation by
Matthias Gerstner seems to show it's doing funny things with the fds
so don't use it.

Reviewers: fvogt

Reviewed By: fvogt

Subscribers: anthonyfieroni, mgerstner, fvogt, plasma-devel

Tags: #plasma

Differential Revision:
parent 62841819
cmake_minimum_required(VERSION 2.8.12)
set(PROJECT_VERSION "5.12.90")
set(PROJECT_VERSION "5.13.80")
find_package (ECM 1.2.0 REQUIRED NO_MODULE)
......@@ -390,40 +390,42 @@ static void execute_kwallet(pam_handle_t *pamh, struct passwd *userInfo, int toW
//Change to the user in case we are not it yet
if (drop_privileges(userInfo) < 0) {
syslog(LOG_ERR, "%s: could not set gid/uid/euid/egit for kwalletd", logPrefix);
goto cleanup;
int envSocket;
if ((envSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
pam_syslog(pamh, LOG_ERR, "%s: couldn't create socket", logPrefix);
syslog(LOG_ERR, "%s: couldn't create socket", logPrefix);
goto cleanup;
struct sockaddr_un local;
local.sun_family = AF_UNIX;
if (strlen(fullSocket) > sizeof(local.sun_path)) {
pam_syslog(pamh, LOG_ERR, "%s: socket path %s too long to open",
syslog(LOG_ERR, "%s: socket path %s too long to open",
logPrefix, fullSocket);
goto cleanup;
strcpy(local.sun_path, fullSocket);
fullSocket = NULL;
unlink(local.sun_path);//Just in case it exists from a previous login
pam_syslog(pamh, LOG_INFO, "%s: final socket path: %s", logPrefix, local.sun_path);
syslog(LOG_INFO, "%s: final socket path: %s", logPrefix, local.sun_path);
size_t len = strlen(local.sun_path) + sizeof(local.sun_family);
if (bind(envSocket, (struct sockaddr *)&local, len) == -1) {
pam_syslog(pamh, LOG_INFO, "%s-kwalletd: Couldn't bind to local file\n", logPrefix);
syslog(LOG_INFO, "%s-kwalletd: Couldn't bind to local file\n", logPrefix);
goto cleanup;
if (listen(envSocket, 5) == -1) {
pam_syslog(pamh, LOG_INFO, "%s-kwalletd: Couldn't listen in socket\n", logPrefix);
syslog(LOG_INFO, "%s-kwalletd: Couldn't listen in socket\n", logPrefix);
goto cleanup;
//finally close stderr
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment