auth_sam: Make auth_sam_trigger_repl_secret more generic
authorGarming Sam <garming@catalyst.net.nz>
Mon, 3 Apr 2017 03:49:45 +0000 (15:49 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 30 May 2017 06:06:06 +0000 (08:06 +0200)
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/ntlm/auth_sam.c

index 0b175b5ecc748444dacb056b80c016bbe8930586..fed5dd3f3086e694b4b1fefdc954fcabacab3c6a 100644 (file)
@@ -108,7 +108,9 @@ static NTSTATUS authsam_password_ok(struct auth4_context *auth_context,
   send a message to the drepl server telling it to initiate a
   REPL_SECRET getncchanges extended op to fetch the users secrets
  */
-static void auth_sam_trigger_repl_secret(struct auth4_context *auth_context,
+static void auth_sam_trigger_repl_secret(TALLOC_CTX *mem_ctx,
+                                        struct imessaging_context *msg_ctx,
+                                        struct tevent_context *event_ctx,
                                         struct ldb_dn *user_dn)
 {
        struct dcerpc_binding_handle *irpc_handle;
@@ -116,12 +118,12 @@ static void auth_sam_trigger_repl_secret(struct auth4_context *auth_context,
        struct tevent_req *req;
        TALLOC_CTX *tmp_ctx;
 
-       tmp_ctx = talloc_new(auth_context);
+       tmp_ctx = talloc_new(mem_ctx);
        if (tmp_ctx == NULL) {
                return;
        }
 
-       irpc_handle = irpc_binding_handle_by_name(tmp_ctx, auth_context->msg_ctx,
+       irpc_handle = irpc_binding_handle_by_name(tmp_ctx, msg_ctx,
                                                  "dreplsrv",
                                                  &ndr_table_irpc);
        if (irpc_handle == NULL) {
@@ -140,7 +142,7 @@ static void auth_sam_trigger_repl_secret(struct auth4_context *auth_context,
         * a callback and wait for it to be triggered!
         */
        req = dcerpc_drepl_trigger_repl_secret_r_send(tmp_ctx,
-                                                     auth_context->event_ctx,
+                                                     event_ctx,
                                                      irpc_handle,
                                                      &r);
 
@@ -215,7 +217,10 @@ static NTSTATUS authsam_password_check_and_record(struct auth4_context *auth_con
                         * replicated, we should be able to detect this
                         * based on msDS-NeverRevealGroup.
                         */
-                       auth_sam_trigger_repl_secret(auth_context, msg->dn);
+                       auth_sam_trigger_repl_secret(auth_context,
+                                                    auth_context->msg_ctx,
+                                                    auth_context->event_ctx,
+                                                    msg->dn);
                        TALLOC_FREE(tmp_ctx);
                        return NT_STATUS_NOT_IMPLEMENTED;
                }