Author: metze
Date: 2006-07-28 11:51:07 +0000 (Fri, 28 Jul 2006)
New Revision: 17290

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17290

Log:
don't do any stuff that can fail in the _recv function

metze
Modified:
   branches/SAMBA_4_0/source/winbind/wb_pam_auth.c


Changeset:
Modified: branches/SAMBA_4_0/source/winbind/wb_pam_auth.c
===================================================================
--- branches/SAMBA_4_0/source/winbind/wb_pam_auth.c     2006-07-28 07:49:07 UTC 
(rev 17289)
+++ branches/SAMBA_4_0/source/winbind/wb_pam_auth.c     2006-07-28 11:51:07 UTC 
(rev 17290)
@@ -37,6 +37,7 @@
        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 @@
        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 @@
                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 @@
                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;

Reply via email to