s4-auth Allow NULL methods to be specified to auth_context_create_methods()
authorAndrew Bartlett <abartlet@samba.org>
Wed, 19 Jan 2011 11:27:51 +0000 (22:27 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 19 Jan 2011 11:29:05 +0000 (12:29 +0100)
This allows us to init an auth context that isn't going to do any NTLM
authentication, but is used by other subsystems.

Andrew Bartlett

source4/auth/ntlm/auth.c

index 7f355d70554230709caa912e677e052ddfb9a0c2..1a98fb414fa37d960e24b0a7357c6c8bf129704b 100644 (file)
@@ -122,12 +122,10 @@ _PUBLIC_ NTSTATUS auth_get_server_info_principal(TALLOC_CTX *mem_ctx,
                        continue;
                }
 
-               NT_STATUS_NOT_OK_RETURN(nt_status);
-
-               break;
+               return nt_status;
        }
 
-       return NT_STATUS_OK;
+       return NT_STATUS_NOT_IMPLEMENTED;
 }
 
 /**
@@ -437,11 +435,6 @@ _PUBLIC_ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **
 
        auth_init();
 
-       if (!methods) {
-               DEBUG(0,("auth_context_create: No auth method list!?\n"));
-               return NT_STATUS_INTERNAL_ERROR;
-       }
-
        if (!ev) {
                DEBUG(0,("auth_context_create: called with out event context\n"));
                return NT_STATUS_INTERNAL_ERROR;
@@ -463,7 +456,7 @@ _PUBLIC_ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **
                ctx->sam_ctx = samdb_connect(ctx, ctx->event_ctx, ctx->lp_ctx, system_session(ctx->lp_ctx), 0);
        }
 
-       for (i=0; methods[i] ; i++) {
+       for (i=0; methods && methods[i] ; i++) {
                struct auth_method_context *method;
 
                method = talloc(ctx, struct auth_method_context);
@@ -480,10 +473,6 @@ _PUBLIC_ NTSTATUS auth_context_create_methods(TALLOC_CTX *mem_ctx, const char **
                DLIST_ADD_END(ctx->methods, method, struct auth_method_context *);
        }
 
-       if (!ctx->methods) {
-               return NT_STATUS_INTERNAL_ERROR;
-       }
-
        ctx->check_password = auth_check_password;
        ctx->get_challenge = auth_get_challenge;
        ctx->set_challenge = auth_context_set_challenge;