From 689bbb41b91b82c7467a1a51d11efcff268ea3d2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 28 Jul 2006 11:51:07 +0000 Subject: r17290: don't do any stuff that can fail in the _recv function metze (This used to be commit 88bcb57e82c799197b1d87212466a9b21d61edf8) --- source4/winbind/wb_pam_auth.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'source4') diff --git a/source4/winbind/wb_pam_auth.c b/source4/winbind/wb_pam_auth.c index 5db0f3054a..07c7e0eb02 100644 --- a/source4/winbind/wb_pam_auth.c +++ b/source4/winbind/wb_pam_auth.c @@ -37,6 +37,7 @@ struct pam_auth_crap_state { uint32_t logon_parameters; const char *domain_name; const char *user_name; + const char *unix_username; const char *workstation; DATA_BLOB chal, nt_resp, lm_resp; @@ -89,6 +90,8 @@ struct composite_context *wb_cmd_pam_auth_crap_send(TALLOC_CTX *mem_ctx, state->user_name = talloc_strdup(state, user); if (state->user_name == NULL) goto failed; + state->unix_username = NULL; + state->workstation = talloc_strdup(state, workstation); if (state->workstation == NULL) goto failed; @@ -255,6 +258,12 @@ static void pam_auth_crap_recv_samlogon(struct rpc_request *req) talloc_steal(state, base->domain.string); } + state->unix_username = talloc_asprintf(state, "%s%s%s", + state->domain_name, + lp_winbind_separator(), + state->user_name); + if (composite_nomem(state->unix_username, state->ctx)) return; + composite_done(state->ctx); } @@ -273,13 +282,7 @@ NTSTATUS wb_cmd_pam_auth_crap_recv(struct composite_context *c, info3->data = talloc_steal(mem_ctx, state->info3.data); *user_session_key = state->user_session_key; *lm_key = state->lm_key; - *unix_username = talloc_asprintf(mem_ctx, "%s%s%s", - state->domain_name, - lp_winbind_separator(), - state->user_name); - if (!*unix_username) { - status = NT_STATUS_NO_MEMORY; - } + *unix_username = talloc_steal(mem_ctx, state->unix_username); } talloc_free(state); return status; -- cgit