auth3: Don't try other auth modules on any error
authorVolker Lendecke <vl@samba.org>
Sat, 11 Feb 2017 14:05:52 +0000 (15:05 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 24 Mar 2017 10:57:08 +0000 (11:57 +0100)
So far if any kind of error has happened, we just tried further auth
modules. An auth module should have the chance to definitely say "no,
this is a valid error, no further attempts anywhere else". The protocol
so far was for an auth module to return NT_STATUS_NOT_IMPLEMENTED if it
wanted to pass on to other modules, but any error led to the next auth
modules also being given a try.

This patch makes any auth module return code except NOT_IMPLEMENTED to
terminate the loop, such that every module has to explicitly request to
pass on to the next module via NOT_IMPLEMENTED.

All modules we reference in make_auth_context_subsystem() have code to
explicitly say "not for me please" with NOT_IMPLEMENTED.

This *might* break existing setups which fail in for example "guest" or
"winbind" due to other reasons. I prefer it this way though, because
adding another parameter like "This is a real authoritative failure,
don't go looking somewhere else" will only add to the mess.
But it's more a theoretical than a practical change with the
default auth backends.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=2976

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/auth/auth.c

index 2b0eb50fcdcf7268d4d00fee04c0b995ec862910..ff41404f770e2df67968a8f08867668bfec9bda2 100644 (file)
@@ -250,9 +250,7 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
                                  auth_method->name, user_info->client.account_name, nt_errstr(nt_status)));
                }
 
-               if (NT_STATUS_IS_OK(nt_status)) {
-                       break;
-               }
+               break;
        }
 
        /* successful authentication */