commit:     8248ba08cccbeb3d0a8632ec4b4e7871abd5e3b9
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 19 23:37:08 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Jan 19 23:38:48 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8248ba08

kde-plasma/kwallet-pam: Fix automatic unlock with x11-misc/lightdm

Upstream commit 8f899902e6a3be8ad4948eb1ebdf679186aa20a7
KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=400929
Closes: https://bugs.gentoo.org/717606
Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...kwallet-pam-5.20.5-socket-listening-error.patch | 44 ++++++++++++++++++++++
 .../kwallet-pam/kwallet-pam-5.20.5-r1.ebuild       | 39 +++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git 
a/kde-plasma/kwallet-pam/files/kwallet-pam-5.20.5-socket-listening-error.patch 
b/kde-plasma/kwallet-pam/files/kwallet-pam-5.20.5-socket-listening-error.patch
new file mode 100644
index 00000000000..790a644003d
--- /dev/null
+++ 
b/kde-plasma/kwallet-pam/files/kwallet-pam-5.20.5-socket-listening-error.patch
@@ -0,0 +1,44 @@
+From 06cd94634feb70dfa7e2f8695b97317cb2ebe44c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefano=20Alo=C3=A9?= <stefano.al...@gmail.com>
+Date: Sun, 17 Jan 2021 23:16:57 +0100
+Subject: [PATCH] Avoid socket listening error
+
+Closing all file descriptor above 3 is causing problem to socket() and 
listen(). Setting FD_CLOEXEC on them solves the problem and should have exactly 
the same behavior.
+
+BUG: 400929
+(cherry picked from commit 8f899902e6a3be8ad4948eb1ebdf679186aa20a7)
+---
+ pam_kwallet.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/pam_kwallet.c b/pam_kwallet.c
+index 2585a68..a099872 100644
+--- a/pam_kwallet.c
++++ b/pam_kwallet.c
+@@ -21,6 +21,7 @@
+ #include <stdio.h>
+ #include <signal.h>
+ #include <unistd.h>
++#include <fcntl.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+@@ -355,12 +356,13 @@ static int drop_privileges(struct passwd *userInfo)
+ static void execute_kwallet(pam_handle_t *pamh, struct passwd *userInfo, int 
toWalletPipe[2], char *fullSocket)
+ {
+     //In the child pam_syslog does not work, using syslog directly
++
+     //keep stderr open so socket doesn't returns us that fd
+     int x = 3;
+-    //Close fd that are not of interest of kwallet
++    //Set FD_CLOEXEC on fd that are not of interest of kwallet
+     for (; x < 64; ++x) {
+         if (x != toWalletPipe[0]) {
+-            close (x);
++            fcntl(x, F_SETFD, FD_CLOEXEC);
+         }
+     }
+ 
+-- 
+GitLab
+

diff --git a/kde-plasma/kwallet-pam/kwallet-pam-5.20.5-r1.ebuild 
b/kde-plasma/kwallet-pam/kwallet-pam-5.20.5-r1.ebuild
new file mode 100644
index 00000000000..2dd76daad16
--- /dev/null
+++ b/kde-plasma/kwallet-pam/kwallet-pam-5.20.5-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+KFMIN=5.74.0
+PVCUT=$(ver_cut 1-3)
+inherit ecm kde.org
+
+DESCRIPTION="PAM module to not enter KWallet password again after login"
+
+LICENSE="LGPL-2.1"
+SLOT="5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE=""
+
+DEPEND="
+       dev-libs/libgcrypt:0=
+       >=kde-frameworks/kwallet-${KFMIN}:5
+       sys-libs/pam
+"
+RDEPEND="${DEPEND}
+       net-misc/socat
+"
+
+PATCHES=( "${FILESDIR}/${P}-socket-listening-error.patch" ) # bug 717606
+
+src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_INSTALL_LIBDIR="/$(get_libdir)"
+       )
+       ecm_src_configure
+}
+
+pkg_postinst() {
+       ecm_pkg_postinst
+       elog "This package enables auto-unlocking of kde-frameworks/kwallet:5."
+       elog "See also: https://wiki.gentoo.org/wiki/KDE#KWallet_auto-unlocking";
+}

Reply via email to