summaryrefslogtreecommitdiff
path: root/src/sss_client/common.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-10-11 20:18:18 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-10-12 10:11:16 +0200
commit8445e39d8e154523b1c39ce701830dacef51d1e9 (patch)
tree941d4a090e7bcfdf31e810225e27f098d8f9bd9f /src/sss_client/common.c
parente7a24374d97e1d1c32d3e18561a20e8c5e6319ec (diff)
downloadsssd-8445e39d8e154523b1c39ce701830dacef51d1e9.tar.gz
sssd-8445e39d8e154523b1c39ce701830dacef51d1e9.tar.bz2
sssd-8445e39d8e154523b1c39ce701830dacef51d1e9.zip
PAM: fix handling the client fd in pam destructor
* Protect the fd with a mutex when closing * Set it to a safe value after closing
Diffstat (limited to 'src/sss_client/common.c')
-rw-r--r--src/sss_client/common.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/sss_client/common.c b/src/sss_client/common.c
index a4d523cd..7cfa3e0e 100644
--- a/src/sss_client/common.c
+++ b/src/sss_client/common.c
@@ -795,11 +795,6 @@ errno_t check_server_cred(int sockfd)
return 0;
}
-int *sss_pam_get_socket(void)
-{
- return &sss_cli_sd;
-}
-
int sss_pam_make_request(enum sss_cli_command cmd,
struct sss_cli_req_data *rd,
uint8_t **repbuf, size_t *replen,
@@ -879,6 +874,18 @@ out:
return ret;
}
+void sss_pam_close_fd(void)
+{
+ sss_pam_lock();
+
+ if (sss_cli_sd != -1) {
+ close(sss_cli_sd);
+ sss_cli_sd = -1;
+ }
+
+ sss_pam_unlock();
+}
+
int sss_sudo_make_request(enum sss_cli_command cmd,
struct sss_cli_req_data *rd,
uint8_t **repbuf, size_t *replen,