summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-14 22:08:47 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-14 22:08:47 +0000
commitd76478f0a777cde74c0a5af04f3d8c3fd36c84dd (patch)
tree848df6b873e7c2923c05bd4ee39916799a49c5d0 /source3/nsswitch
parentdd0f0f043f740a4099ed17a43fd7d5cbe1142540 (diff)
downloadsamba-d76478f0a777cde74c0a5af04f3d8c3fd36c84dd.tar.gz
samba-d76478f0a777cde74c0a5af04f3d8c3fd36c84dd.tar.bz2
samba-d76478f0a777cde74c0a5af04f3d8c3fd36c84dd.zip
Initialise cli variables and try not to do a cli_shutdown() of uninitialsed
memory. The winbind connection caching code isn't exactly a plesent beast, and there is more work that needs to be done to nail this properly. Andrew Bartlett (This used to be commit dd40ce54b7f170854d63e08ac737f1b4306bd95b)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_pam.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c
index aab1302a94..95f0d527bb 100644
--- a/source3/nsswitch/winbindd_pam.c
+++ b/source3/nsswitch/winbindd_pam.c
@@ -36,7 +36,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
time_t last_change_time;
uint32 smb_uid_low;
NET_USER_INFO_3 info3;
- struct cli_state *cli;
+ struct cli_state *cli = NULL;
uchar chal[8];
TALLOC_CTX *mem_ctx;
DATA_BLOB lm_resp;
@@ -57,6 +57,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
if (!parse_domain_user(state->request.data.auth.user, name_domain,
name_user)) {
DEBUG(5,("no domain seperator (%s) in username (%s) - failing fauth\n", lp_winbind_separator(), state->request.data.auth.user));
+ talloc_destroy(mem_ctx);
return WINBINDD_ERROR;
}
@@ -64,6 +65,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
if (!*state->request.data.auth.pass) {
return WINBINDD_ERROR;
+ talloc_destroy(mem_ctx);
} else {
unsigned char local_lm_response[24];
unsigned char local_nt_response[24];
@@ -85,6 +87,7 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
lp_workgroup(), trust_passwd, &last_change_time)) {
DEBUG(0, ("winbindd_pam_auth: could not fetch trust account "
"password for domain %s\n", lp_workgroup()));
+ talloc_destroy(mem_ctx);
return WINBINDD_ERROR;
}
@@ -110,7 +113,8 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state)
uni_group_cache_store_netlogon(mem_ctx, &info3);
done:
- cli_shutdown(cli);
+ if (cli)
+ cli_shutdown(cli);
talloc_destroy(mem_ctx);
@@ -125,7 +129,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state)
unsigned char trust_passwd[16];
time_t last_change_time;
NET_USER_INFO_3 info3;
- struct cli_state *cli;
+ struct cli_state *cli = NULL;
TALLOC_CTX *mem_ctx;
DATA_BLOB lm_resp, nt_resp;
@@ -151,6 +155,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state)
lp_workgroup(), trust_passwd, &last_change_time)) {
DEBUG(0, ("winbindd_pam_auth: could not fetch trust account "
"password for domain %s\n", lp_workgroup()));
+ talloc_destroy(mem_ctx);
return WINBINDD_ERROR;
}
@@ -173,7 +178,8 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state)
done:
talloc_destroy(mem_ctx);
- cli_shutdown(cli);
+ if (cli)
+ cli_shutdown(cli);
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
}