summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-23 06:22:02 +0000
committerJeremy Allison <jra@samba.org>2001-04-23 06:22:02 +0000
commite00451106bc0365405f68195afcb6351bd2a55c0 (patch)
treef48df1fadf5b9067e581b39d903b0796de19523d
parentd6a5dec6f225395ec764b29eb76c0a6577f3e039 (diff)
downloadsamba-e00451106bc0365405f68195afcb6351bd2a55c0.tar.gz
samba-e00451106bc0365405f68195afcb6351bd2a55c0.tar.bz2
samba-e00451106bc0365405f68195afcb6351bd2a55c0.zip
Fix more free twice bugs.
Jeremy. (This used to be commit 4db22afeed659a871a4a1f719d5fa1f2df07e24d)
-rw-r--r--source3/auth/pampass.c7
-rw-r--r--source3/passdb/pampass.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 3335ed5551..f91f472603 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -153,11 +153,13 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost)
{
int pam_error;
+ *pamh = (pam_handle_t *)NULL;
+
DEBUG(4,("PAM: Init user: %s\n", user));
pam_error = pam_start("samba", user, &smb_pam_conversation, pamh);
if( !smb_pam_error_handler(*pamh, pam_error, "Init Failed", 0)) {
- smb_pam_end(*pamh);
+ *pamh = (pam_handle_t *)NULL;
return False;
}
@@ -172,6 +174,7 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost)
pam_error = pam_set_item(*pamh, PAM_RHOST, rhost);
if(!smb_pam_error_handler(*pamh, pam_error, "set rhost failed", 0)) {
smb_pam_end(*pamh);
+ *pamh = (pam_handle_t *)NULL;
return False;
}
#endif
@@ -180,6 +183,7 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost)
pam_error = pam_set_item(*pamh, PAM_TTY, "samba");
if (!smb_pam_error_handler(*pamh, pam_error, "set tty failed", 0)) {
smb_pam_end(*pamh);
+ *pamh = (pam_handle_t *)NULL;
return False;
}
#endif
@@ -358,7 +362,6 @@ BOOL smb_pam_session(BOOL flag, const char *in_user, char *tty, char *rhost)
}
if (!smb_pam_start(&pamh, user, rhost)) {
- smb_pam_end(pamh);
return False;
}
diff --git a/source3/passdb/pampass.c b/source3/passdb/pampass.c
index 3335ed5551..f91f472603 100644
--- a/source3/passdb/pampass.c
+++ b/source3/passdb/pampass.c
@@ -153,11 +153,13 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost)
{
int pam_error;
+ *pamh = (pam_handle_t *)NULL;
+
DEBUG(4,("PAM: Init user: %s\n", user));
pam_error = pam_start("samba", user, &smb_pam_conversation, pamh);
if( !smb_pam_error_handler(*pamh, pam_error, "Init Failed", 0)) {
- smb_pam_end(*pamh);
+ *pamh = (pam_handle_t *)NULL;
return False;
}
@@ -172,6 +174,7 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost)
pam_error = pam_set_item(*pamh, PAM_RHOST, rhost);
if(!smb_pam_error_handler(*pamh, pam_error, "set rhost failed", 0)) {
smb_pam_end(*pamh);
+ *pamh = (pam_handle_t *)NULL;
return False;
}
#endif
@@ -180,6 +183,7 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost)
pam_error = pam_set_item(*pamh, PAM_TTY, "samba");
if (!smb_pam_error_handler(*pamh, pam_error, "set tty failed", 0)) {
smb_pam_end(*pamh);
+ *pamh = (pam_handle_t *)NULL;
return False;
}
#endif
@@ -358,7 +362,6 @@ BOOL smb_pam_session(BOOL flag, const char *in_user, char *tty, char *rhost)
}
if (!smb_pam_start(&pamh, user, rhost)) {
- smb_pam_end(pamh);
return False;
}