]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:rpc_client: the transport_session_key is per connection!
authorStefan Metzmacher <metze@samba.org>
Sat, 14 Sep 2024 13:59:29 +0000 (15:59 +0200)
committerJule Anger <janger@samba.org>
Thu, 12 Jun 2025 11:27:14 +0000 (11:27 +0000)
It's not per auth_context_id, currently there's no difference
but that will change in future...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 1a311df3d61d3f3dbb986cc35470df6445802ff6)

source3/librpc/rpc/dcerpc.h
source3/rpc_client/cli_pipe.c
source3/rpc_client/rpc_client.h

index 4b76c5c6d554abf902c3887e2bc0ab1d5f2f7920..76f2fa05ae079c63640855e03f258f39caefd44f 100644 (file)
@@ -44,9 +44,6 @@ struct pipe_auth_data {
        bool verified_bitmask1;
 
        struct gensec_security *auth_ctx;
-
-       /* Only the client code uses this for now */
-       DATA_BLOB transport_session_key;
 };
 
 /* The following definitions come from librpc/rpc/dcerpc_helpers.c  */
index 5be23b99054229e5195b4fed69f2b4674a17c400..1e02f53efe949eff178d2377fd44278b206ace2a 100644 (file)
@@ -2168,24 +2168,17 @@ static NTSTATUS rpccli_bh_transport_session_key(struct dcerpc_binding_handle *h,
 {
        struct rpccli_bh_state *hs = dcerpc_binding_handle_data(h,
                                     struct rpccli_bh_state);
-       struct pipe_auth_data *auth = NULL;
        DATA_BLOB sk = { .length = 0, };
 
        if (hs->rpc_cli == NULL) {
                return NT_STATUS_NO_USER_SESSION_KEY;
        }
 
-       if (hs->rpc_cli->auth == NULL) {
-               return NT_STATUS_NO_USER_SESSION_KEY;
-       }
-
-       auth = hs->rpc_cli->auth;
-
-       if (auth->transport_session_key.length == 0) {
+       if (hs->rpc_cli->transport_session_key.length == 0) {
                return NT_STATUS_NO_USER_SESSION_KEY;
        }
 
-       sk = auth->transport_session_key;
+       sk = hs->rpc_cli->transport_session_key;
        sk.length = MIN(sk.length, 16);
 
        *session_key = data_blob_dup_talloc(mem_ctx, sk);
@@ -3479,10 +3472,10 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
                        session = cli->smb1.session;
                }
 
-               status = smbXcli_session_application_key(session, auth,
-                                               &auth->transport_session_key);
+               status = smbXcli_session_application_key(session, result,
+                                               &result->transport_session_key);
                if (!NT_STATUS_IS_OK(status)) {
-                       auth->transport_session_key = data_blob_null;
+                       result->transport_session_key = data_blob_null;
                }
        }
 
index 55eb4dec90bbe8e2701c8de1887dd25f0f7c36c2..9ba783518516c1011b4b465f34cde7daf93fc957 100644 (file)
@@ -34,6 +34,7 @@ struct dcerpc_binding_handle;
 struct rpc_pipe_client {
        struct rpc_pipe_client *prev, *next;
 
+       DATA_BLOB transport_session_key;
        struct rpc_cli_transport *transport;
        struct dcerpc_binding_handle *binding_handle;