summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-23 06:09:27 +0000
committerJeremy Allison <jra@samba.org>2001-04-23 06:09:27 +0000
commitd6a5dec6f225395ec764b29eb76c0a6577f3e039 (patch)
tree73971f75af4a064c880a0c0da28573e4bac57fb6
parentae8418d0c400f6458c1eb0b79881fd02629e5acd (diff)
downloadsamba-d6a5dec6f225395ec764b29eb76c0a6577f3e039.tar.gz
samba-d6a5dec6f225395ec764b29eb76c0a6577f3e039.tar.bz2
samba-d6a5dec6f225395ec764b29eb76c0a6577f3e039.zip
Fix for bug in code for pam_session failure - pam_end called twice.
Jeremy. (This used to be commit c4048fcdb6ff3a890b69be8ef4832e9bd958cfec)
-rw-r--r--source3/auth/pampass.c17
-rw-r--r--source3/passdb/pampass.c17
2 files changed, 10 insertions, 24 deletions
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 553ffcd323..3335ed5551 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -327,24 +327,18 @@ static BOOL smb_internal_pam_session(pam_handle_t *pamh, char *user, char *tty,
#ifdef PAM_TTY
DEBUG(4,("PAM: tty set to: %s\n", tty));
pam_error = pam_set_item(pamh, PAM_TTY, tty);
- if (!smb_pam_error_handler(pamh, pam_error, "set tty failed", 0)) {
- smb_pam_end(pamh);
+ if (!smb_pam_error_handler(pamh, pam_error, "set tty failed", 0))
return False;
- }
#endif
if (flag) {
pam_error = pam_open_session(pamh, PAM_SILENT);
- if (!smb_pam_error_handler(pamh, pam_error, "session setup failed", 0)) {
- smb_pam_end(pamh);
+ if (!smb_pam_error_handler(pamh, pam_error, "session setup failed", 0))
return False;
- }
} else {
pam_error = pam_close_session(pamh, PAM_SILENT);
- if (!smb_pam_error_handler(pamh, pam_error, "session close failed", 0)) {
- smb_pam_end(pamh);
+ if (!smb_pam_error_handler(pamh, pam_error, "session close failed", 0))
return False;
- }
}
return (True);
}
@@ -368,12 +362,11 @@ BOOL smb_pam_session(BOOL flag, const char *in_user, char *tty, char *rhost)
return False;
}
- if (smb_internal_pam_session(pamh, user, tty, flag)) {
- return smb_pam_end(pamh);
- } else {
+ if (!smb_internal_pam_session(pamh, user, tty, flag)) {
smb_pam_end(pamh);
return False;
}
+ return smb_pam_end(pamh);
}
/*
diff --git a/source3/passdb/pampass.c b/source3/passdb/pampass.c
index 553ffcd323..3335ed5551 100644
--- a/source3/passdb/pampass.c
+++ b/source3/passdb/pampass.c
@@ -327,24 +327,18 @@ static BOOL smb_internal_pam_session(pam_handle_t *pamh, char *user, char *tty,
#ifdef PAM_TTY
DEBUG(4,("PAM: tty set to: %s\n", tty));
pam_error = pam_set_item(pamh, PAM_TTY, tty);
- if (!smb_pam_error_handler(pamh, pam_error, "set tty failed", 0)) {
- smb_pam_end(pamh);
+ if (!smb_pam_error_handler(pamh, pam_error, "set tty failed", 0))
return False;
- }
#endif
if (flag) {
pam_error = pam_open_session(pamh, PAM_SILENT);
- if (!smb_pam_error_handler(pamh, pam_error, "session setup failed", 0)) {
- smb_pam_end(pamh);
+ if (!smb_pam_error_handler(pamh, pam_error, "session setup failed", 0))
return False;
- }
} else {
pam_error = pam_close_session(pamh, PAM_SILENT);
- if (!smb_pam_error_handler(pamh, pam_error, "session close failed", 0)) {
- smb_pam_end(pamh);
+ if (!smb_pam_error_handler(pamh, pam_error, "session close failed", 0))
return False;
- }
}
return (True);
}
@@ -368,12 +362,11 @@ BOOL smb_pam_session(BOOL flag, const char *in_user, char *tty, char *rhost)
return False;
}
- if (smb_internal_pam_session(pamh, user, tty, flag)) {
- return smb_pam_end(pamh);
- } else {
+ if (!smb_internal_pam_session(pamh, user, tty, flag)) {
smb_pam_end(pamh);
return False;
}
+ return smb_pam_end(pamh);
}
/*