winbindd: use set_auth_errors (avoid code duplication).
authorGünther Deschner <gd@samba.org>
Tue, 19 Aug 2008 16:31:35 +0000 (18:31 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 19 Aug 2008 20:00:48 +0000 (22:00 +0200)
Guenther
(This used to be commit ae35a5110ea03d8ff27f320cdc685e5623715a2a)

source3/winbindd/winbindd_pam.c

index a808b37791aff6c2632f9becb642d16294e9b37b..1cddfe391fc27dab6dc2b7fb444c726910667092 100644 (file)
@@ -1699,13 +1699,7 @@ done:
                result = NT_STATUS_NO_LOGON_SERVERS;
        }
 
-       state->response.data.auth.nt_status = NT_STATUS_V(result);
-       fstrcpy(state->response.data.auth.nt_status_string, nt_errstr(result));
-
-       /* we might have given a more useful error above */
-       if (!*state->response.data.auth.error_string)
-               fstrcpy(state->response.data.auth.error_string, get_friendly_nt_error_msg(result));
-       state->response.data.auth.pam_error = nt_status_to_pam(result);
+       set_auth_errors(&state->response, result);
 
        DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2, ("Plain-text authentication for user %s returned %s (PAM: %d)\n",
              state->request.data.auth.user,
@@ -1971,14 +1965,7 @@ done:
                result = nt_status_squash(result);
        }
 
-       state->response.data.auth.nt_status = NT_STATUS_V(result);
-       fstrcpy(state->response.data.auth.nt_status_string, nt_errstr(result));
-
-       /* we might have given a more useful error above */
-       if (!*state->response.data.auth.error_string) {
-               fstrcpy(state->response.data.auth.error_string, get_friendly_nt_error_msg(result));
-       }
-       state->response.data.auth.pam_error = nt_status_to_pam(result);
+       set_auth_errors(&state->response, result);
 
        DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2,
              ("NTLM CRAP authentication for user [%s]\\[%s] returned %s (PAM: %d)\n",
@@ -2164,10 +2151,7 @@ done:
 
 process_result:
 
-       state->response.data.auth.nt_status = NT_STATUS_V(result);
-       fstrcpy(state->response.data.auth.nt_status_string, nt_errstr(result));
-       fstrcpy(state->response.data.auth.error_string, get_friendly_nt_error_msg(result));
-       state->response.data.auth.pam_error = nt_status_to_pam(result);
+       set_auth_errors(&state->response, result);
 
        DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2,
              ("Password change for user [%s]\\[%s] returned %s (PAM: %d)\n",
@@ -2300,10 +2284,7 @@ process_result:
 
        winbindd_delete_memory_creds(state->request.data.logoff.user);
 
-       state->response.data.auth.nt_status = NT_STATUS_V(result);
-       fstrcpy(state->response.data.auth.nt_status_string, nt_errstr(result));
-       fstrcpy(state->response.data.auth.error_string, get_friendly_nt_error_msg(result));
-       state->response.data.auth.pam_error = nt_status_to_pam(result);
+       set_auth_errors(&state->response, result);
 
        return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
 }
@@ -2449,11 +2430,8 @@ enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domai
                new_lm_password, old_lm_hash_enc);
 
  done:
-       state->response.data.auth.nt_status = NT_STATUS_V(result);
-       fstrcpy(state->response.data.auth.nt_status_string, nt_errstr(result));
-       fstrcpy(state->response.data.auth.error_string,
-               get_friendly_nt_error_msg(result));
-       state->response.data.auth.pam_error = nt_status_to_pam(result);
+
+       set_auth_errors(&state->response, result);
 
        DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2,
              ("Password change for user [%s]\\[%s] returned %s (PAM: %d)\n",