summaryrefslogtreecommitdiff
path: root/src/pam-module.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-06-24 22:55:39 +0200
committerLennart Poettering <lennart@poettering.net>2011-06-24 22:55:39 +0200
commit21c390ccd1b4f7bc962c16549df929ad518a1d37 (patch)
tree68458572b17f28cd20ea560216f0eea668cefddc /src/pam-module.c
parent0771475394887e3635e67196fa6f56486fa2126c (diff)
logind: properly handle if two session with identical loginuids are attempted to be created
Diffstat (limited to 'src/pam-module.c')
-rw-r--r--src/pam-module.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pam-module.c b/src/pam-module.c
index dc7c00166e..eba59f65f2 100644
--- a/src/pam-module.c
+++ b/src/pam-module.c
@@ -457,10 +457,12 @@ _public_ PAM_EXTERN int pam_sm_open_session(
goto finish;
}
- r = pam_set_data(handle, "systemd.session-fd", INT_TO_PTR(session_fd+1), NULL);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
- return r;
+ if (session_fd >= 0) {
+ r = pam_set_data(handle, "systemd.session-fd", INT_TO_PTR(session_fd+1), NULL);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
+ return r;
+ }
}
session_fd = -1;