]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_client: allow rpccli_setup_netlogon_creds_locked() to return netlogon_pipe
authorStefan Metzmacher <metze@samba.org>
Tue, 17 Sep 2024 03:35:01 +0000 (05:35 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 26 Sep 2024 15:22:46 +0000 (15:22 +0000)
Let the caller decide if it wants to keep the netlogon connection...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/rpc_client/cli_netlogon.c

index 20cccf19292609723e176d225a3c491b7a33e006..1553e68c00ba96d369ec522250e4db518dec5efd 100644 (file)
@@ -159,6 +159,8 @@ static NTSTATUS rpccli_setup_netlogon_creds_locked(
        struct netlogon_creds_cli_context *creds_ctx,
        bool force_reauth,
        struct cli_credentials *cli_creds,
+       TALLOC_CTX *mem_ctx,
+       struct rpc_pipe_client **_netlogon_pipe,
        uint32_t *negotiate_flags)
 {
        TALLOC_CTX *frame = talloc_stackframe();
@@ -249,6 +251,10 @@ static NTSTATUS rpccli_setup_netlogon_creds_locked(
                 remote_name));
 
 done:
+       if (_netlogon_pipe != NULL) {
+               *_netlogon_pipe = talloc_move(mem_ctx, &netlogon_pipe);
+       }
+
        if (negotiate_flags != NULL) {
                *negotiate_flags = creds->negotiate_flags;
        }
@@ -278,8 +284,14 @@ NTSTATUS rpccli_setup_netlogon_creds(
                return status;
        }
 
-       status = rpccli_setup_netlogon_creds_locked(
-               cli, transport, creds_ctx, force_reauth, cli_creds, NULL);
+       status = rpccli_setup_netlogon_creds_locked(cli,
+                                                   transport,
+                                                   creds_ctx,
+                                                   force_reauth,
+                                                   cli_creds,
+                                                   NULL,
+                                                   NULL,
+                                                   NULL);
 
        TALLOC_FREE(frame);
 
@@ -407,9 +419,14 @@ again:
                goto fail;
        }
 
-       status = rpccli_setup_netlogon_creds_locked(
-               cli, transport, creds_ctx, true, trust_creds,
-               &negotiate_flags);
+       status = rpccli_setup_netlogon_creds_locked(cli,
+                                                   transport,
+                                                   creds_ctx,
+                                                   true,
+                                                   trust_creds,
+                                                   NULL,
+                                                   NULL,
+                                                   &negotiate_flags);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_DEBUG("rpccli_setup_netlogon_creds failed for %s, "
                          "unable to setup NETLOGON credentials: %s\n",