auth4: Remove sync check_password from auth_operations
authorVolker Lendecke <vl@samba.org>
Wed, 14 Apr 2021 20:24:44 +0000 (22:24 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 16 Apr 2021 09:38:35 +0000 (09:38 +0000)
Remove complexity in the data structures, and pushes the async-ness
one level down.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/auth.h
source4/auth/ntlm/auth.c

index 51895c9259f366e2d0a0d74c676943effd81ea1c..3f9fb1ae3cbc9f4fa09dc57cad81273998d4d74c 100644 (file)
@@ -61,10 +61,6 @@ struct auth_operations {
 
        /* Given the user supplied info, check a password */
 
-       NTSTATUS (*check_password)(struct auth_method_context *ctx, TALLOC_CTX *mem_ctx,
-                                  const struct auth_usersupplied_info *user_info,
-                                  struct auth_user_info_dc **interim_info,
-                                  bool *authoritative);
        struct tevent_req *(*check_password_send)(TALLOC_CTX *mem_ctx,
                                struct tevent_context *ev,
                                struct auth_method_context *ctx,
index 75cf12c57429ba74d05829283717ba082aaff1b8..e54eb7719f5793a8fe7246fb5a0659c8f30f6f3b 100644 (file)
@@ -332,7 +332,6 @@ static void auth_check_password_next(struct tevent_req *req)
        struct auth_check_password_state *state =
                tevent_req_data(req, struct auth_check_password_state);
        struct tevent_req *subreq = NULL;
-       bool authoritative = true;
        NTSTATUS status;
 
        if (state->method == NULL) {
@@ -357,47 +356,12 @@ static void auth_check_password_next(struct tevent_req *req)
                return;
        }
 
-       if (state->method->ops->check_password_send != NULL) {
-               subreq = state->method->ops->check_password_send(state,
-                                                                state->ev,
-                                                                state->method,
-                                                                state->user_info);
-               if (tevent_req_nomem(subreq, req)) {
-                       return;
-               }
-               tevent_req_set_callback(subreq,
-                                       auth_check_password_done,
-                                       req);
-               return;
-       }
-
-       if (state->method->ops->check_password == NULL) {
-               tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
-               return;
-       }
-
-       status = state->method->ops->check_password(state->method,
-                                                   state,
-                                                   state->user_info,
-                                                   &state->user_info_dc,
-                                                   &authoritative);
-       if (!authoritative ||
-           NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
-               DEBUG(11,("auth_check_password_send: "
-                         "%s passes to the next method\n",
-                         state->method->ops->name));
-               state->method = state->method->next;
-               auth_check_password_next(req);
-               return;
-       }
-
-       /* the backend has handled the request */
-
-       if (tevent_req_nterror(req, status)) {
+       subreq = state->method->ops->check_password_send(
+               state, state->ev, state->method, state->user_info);
+       if (tevent_req_nomem(subreq, req)) {
                return;
        }
-
-       tevent_req_done(req);
+       tevent_req_set_callback(subreq, auth_check_password_done, req);
 }
 
 static void auth_check_password_done(struct tevent_req *subreq)