Line 0
Link Here
|
|
|
1 |
From 8da1a47035fc92bc1496059583772bc4bd6e8ba6 Mon Sep 17 00:00:00 2001 |
2 |
From: Maximiliano Curia <maxy@gnuservers.com.ar> |
3 |
Date: Fri, 4 May 2018 22:06:06 +0200 |
4 |
Subject: [PATCH] Avoid giving an stderr to kwallet |
5 |
|
6 |
Summary: |
7 |
The fixes for CVE-2018-10380 introduced a regression for most users not |
8 |
using kde, and some for kde sessions. In particular the reorder of the |
9 |
close calls and creating a new socket caused that the socket is always |
10 |
assigned the file descriptor 2, aka stderr. |
11 |
|
12 |
BUG: 393856 |
13 |
|
14 |
Test Plan: It works |
15 |
|
16 |
Reviewers: #plasma, aacid |
17 |
|
18 |
Reviewed By: aacid |
19 |
|
20 |
Subscribers: asturmlechner, rdieter, davidedmundson, plasma-devel |
21 |
|
22 |
Tags: #plasma |
23 |
|
24 |
Differential Revision: https://phabricator.kde.org/D12702 |
25 |
--- |
26 |
pam_kwallet.c | 5 ++++- |
27 |
1 file changed, 4 insertions(+), 1 deletion(-) |
28 |
|
29 |
diff --git a/pam_kwallet.c b/pam_kwallet.c |
30 |
index b9c984a..661ed8d 100644 |
31 |
--- pam_kwallet.c |
32 |
+++ pam_kwallet.c |
33 |
@@ -375,7 +375,8 @@ static int drop_privileges(struct passwd *userInfo) |
34 |
static void execute_kwallet(pam_handle_t *pamh, struct passwd *userInfo, int toWalletPipe[2], char *fullSocket) |
35 |
{ |
36 |
//In the child pam_syslog does not work, using syslog directly |
37 |
- int x = 2; |
38 |
+ //keep stderr open so socket doesn't returns us that fd |
39 |
+ int x = 3; |
40 |
//Close fd that are not of interest of kwallet |
41 |
for (; x < 64; ++x) { |
42 |
if (x != toWalletPipe[0]) { |
43 |
@@ -424,6 +425,8 @@ static void execute_kwallet(pam_handle_t *pamh, struct passwd *userInfo, int toW |
44 |
pam_syslog(pamh, LOG_INFO, "%s-kwalletd: Couldn't listen in socket\n", logPrefix); |
45 |
return; |
46 |
} |
47 |
+ //finally close stderr |
48 |
+ close(2); |
49 |
|
50 |
// Fork twice to daemonize kwallet |
51 |
setsid(); |