|
|
a53777 |
From 1fd7a5ecb46a02a29ebf42039575b5344307bfbb Mon Sep 17 00:00:00 2001
|
|
|
a53777 |
From: Alexey Tikhonov <atikhono@redhat.com>
|
|
|
a53777 |
Date: Wed, 8 Feb 2023 18:58:37 +0100
|
|
|
a53777 |
Subject: [PATCH 4/4] PAM_SSS: close(sss_cli_sd) should also be protected with
|
|
|
a53777 |
mutex. Otherwise a thread calling pam_end() can close socket mid pam
|
|
|
a53777 |
transaction in another thread.
|
|
|
a53777 |
MIME-Version: 1.0
|
|
|
a53777 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a53777 |
Content-Transfer-Encoding: 8bit
|
|
|
a53777 |
|
|
|
a53777 |
Bug only manifested on platforms where "lockfree client"
|
|
|
a53777 |
feature wasn't built.
|
|
|
a53777 |
|
|
|
a53777 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
a53777 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
a53777 |
(cherry picked from commit bf3f73ea0ee123fe4e7c4bdd2287ac5a5e6d9082)
|
|
|
a53777 |
---
|
|
|
a53777 |
src/sss_client/pam_sss.c | 3 +++
|
|
|
a53777 |
src/sss_client/pam_sss_gss.c | 2 ++
|
|
|
a53777 |
2 files changed, 5 insertions(+)
|
|
|
a53777 |
|
|
|
a53777 |
diff --git a/src/sss_client/pam_sss.c b/src/sss_client/pam_sss.c
|
|
|
a53777 |
index afbdef59a..39ad17188 100644
|
|
|
a53777 |
--- a/src/sss_client/pam_sss.c
|
|
|
a53777 |
+++ b/src/sss_client/pam_sss.c
|
|
|
a53777 |
@@ -117,7 +117,10 @@ static void close_fd(pam_handle_t *pamh, void *ptr, int err)
|
|
|
a53777 |
#endif /* PAM_DATA_REPLACE */
|
|
|
a53777 |
|
|
|
a53777 |
D(("Closing the fd"));
|
|
|
a53777 |
+
|
|
|
a53777 |
+ sss_pam_lock();
|
|
|
a53777 |
sss_cli_close_socket();
|
|
|
a53777 |
+ sss_pam_unlock();
|
|
|
a53777 |
}
|
|
|
a53777 |
|
|
|
a53777 |
struct cert_auth_info {
|
|
|
a53777 |
diff --git a/src/sss_client/pam_sss_gss.c b/src/sss_client/pam_sss_gss.c
|
|
|
a53777 |
index 1109ec570..dd578ae5d 100644
|
|
|
a53777 |
--- a/src/sss_client/pam_sss_gss.c
|
|
|
a53777 |
+++ b/src/sss_client/pam_sss_gss.c
|
|
|
a53777 |
@@ -581,7 +581,9 @@ int pam_sm_authenticate(pam_handle_t *pamh,
|
|
|
a53777 |
}
|
|
|
a53777 |
|
|
|
a53777 |
done:
|
|
|
a53777 |
+ sss_pam_lock();
|
|
|
a53777 |
sss_cli_close_socket();
|
|
|
a53777 |
+ sss_pam_unlock();
|
|
|
a53777 |
free(username);
|
|
|
a53777 |
free(domain);
|
|
|
a53777 |
free(target);
|
|
|
a53777 |
--
|
|
|
a53777 |
2.37.3
|
|
|
a53777 |
|