diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-04-06 21:45:16 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-04-18 10:23:56 -0400 |
commit | a330324ee6a4ea148b56c7bd8c2cecadb3230968 (patch) | |
tree | ec2728dca1de8576d12109a8b96b65c2d1c7a05f /src | |
parent | a9370601d5ea8555e7f4e4bd64648e38d40abe38 (diff) | |
download | sssd-a330324ee6a4ea148b56c7bd8c2cecadb3230968.tar.gz sssd-a330324ee6a4ea148b56c7bd8c2cecadb3230968.tar.xz sssd-a330324ee6a4ea148b56c7bd8c2cecadb3230968.zip |
pam_sss: improve error handling in SELinux code
Diffstat (limited to 'src')
-rw-r--r-- | src/sss_client/pam_sss.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sss_client/pam_sss.c b/src/sss_client/pam_sss.c index 4fe4613aa..8778fe19e 100644 --- a/src/sss_client/pam_sss.c +++ b/src/sss_client/pam_sss.c @@ -1198,6 +1198,7 @@ static int send_and_receive(pam_handle_t *pamh, struct pam_items *pi, oldmask = umask(022); fd = mkstemp(tmp_path); + umask(oldmask); if (fd < 0) { logger(pamh, LOG_ERR, "creating the temp file for SELinux " "data failed. %s", tmp_path); @@ -1223,9 +1224,6 @@ static int send_and_receive(pam_handle_t *pamh, struct pam_items *pi, close(fd); rename(tmp_path, path); - free(path); - free(tmp_path); - umask(oldmask); #endif /* HAVE_SELINUX */ break; case SSS_PAM_SETCRED: @@ -1242,6 +1240,10 @@ done: free(buf); } free(repbuf); +#ifdef HAVE_SELINUX + free(path); + free(tmp_path); +#endif /* HAVE_SELINUX */ return pam_status; } |