Skip to content

Commit

Permalink
s4-auth: Do not override the NT_STATUS_NOT_IMPLEMENTED error for winb…
Browse files Browse the repository at this point in the history
…indd

This changes the auth code in winbindd to use this as a flag, and to
therefore contact the RW DC.

Change-Id: If4164d27b57b453b398642fdf7d46d03cd0e65f2
Signed-off-by: Andrew Bartlett <[email protected]>
Reviewed-by: Nadezhda Ivanova <[email protected]>
  • Loading branch information
abartlet committed Jul 4, 2014
1 parent 5d069a0 commit 0b77cd9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion auth/common_auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define USER_INFO_CASE_INSENSITIVE_PASSWORD 0x02 /* password may be in any case */
#define USER_INFO_DONT_CHECK_UNIX_ACCOUNT 0x04 /* don't check unix account status */
#define USER_INFO_INTERACTIVE_LOGON 0x08 /* Interactive logon */
#define USER_INFO_LOCAL_SAM_ONLY 0x10 /* Only authenticate against the local SAM */
#define USER_INFO_LOCAL_SAM_ONLY 0x10 /* Only authenticate against the local SAM, do not map missing passwords to NO_SUCH_USER */
#define USER_INFO_INFO3_AND_NO_AUTHZ 0x20 /* Only fill in server_info->info3 and do not do any authorization steps */

enum auth_password_state {
Expand Down
7 changes: 7 additions & 0 deletions source3/auth/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
if ( NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_NOT_IMPLEMENTED) ) {
DEBUG(10,("check_ntlm_password: %s had nothing to say\n", auth_method->name));
TALLOC_FREE(tmp_ctx);
if (user_info->flags & USER_INFO_LOCAL_SAM_ONLY) {
/* we don't expose the NT_STATUS_NOT_IMPLEMENTED
* internals, except when the caller is only probing
* one method, as they may do the fallback
*/
nt_status = result;
}
continue;
}

Expand Down
16 changes: 14 additions & 2 deletions source3/winbindd/winbindd_pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,13 @@ static NTSTATUS winbindd_dual_pam_auth_samlogon(TALLOC_CTX *mem_ctx,
result = winbindd_dual_auth_passdb(
mem_ctx, 0, name_domain, name_user,
&chal_blob, &lm_resp, &nt_resp, info3);
goto done;

/*
* We need to try the remote NETLOGON server if this is NOT_IMPLEMENTED
*/
if (!NT_STATUS_EQUAL(result, NT_STATUS_NOT_IMPLEMENTED)) {
goto done;
}
}

/* check authentication loop */
Expand Down Expand Up @@ -1888,7 +1894,13 @@ NTSTATUS winbind_dual_SamLogon(struct winbindd_domain *domain,
logon_parameters,
name_domain, name_user,
&chal_blob, &lm_response, &nt_response, info3);
goto process_result;

/*
* We need to try the remote NETLOGON server if this is NOT_IMPLEMENTED
*/
if (!NT_STATUS_EQUAL(result, NT_STATUS_NOT_IMPLEMENTED)) {
goto process_result;
}
}

result = winbind_samlogon_retry_loop(domain,
Expand Down
10 changes: 7 additions & 3 deletions source4/auth/ntlm/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,13 @@ static void auth_check_password_async_trigger(struct tevent_context *ev,
}

if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
/* don't expose the NT_STATUS_NOT_IMPLEMENTED
internals */
status = NT_STATUS_NO_SUCH_USER;
if (!(state->user_info->flags & USER_INFO_LOCAL_SAM_ONLY)) {
/* don't expose the NT_STATUS_NOT_IMPLEMENTED
* internals, except when the caller is only probing
* one method, as they may do the fallback
*/
status = NT_STATUS_NO_SUCH_USER;
}
}

if (tevent_req_nterror(req, status)) {
Expand Down

0 comments on commit 0b77cd9

Please sign in to comment.