]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
librpc/rpc: add dcerpc_binding_handle_transport_{encrypted,session_key}()
authorStefan Metzmacher <metze@samba.org>
Sat, 14 Sep 2024 07:55:20 +0000 (09:55 +0200)
committerJule Anger <janger@samba.org>
Thu, 12 Jun 2025 11:27:14 +0000 (11:27 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 3dc3f9cf1b6fc47baea329863e31ff140cf89550)

librpc/rpc/binding_handle.c
librpc/rpc/rpc_common.h

index 41675e103607b2502a8424ed794bda9f9a653fb1..f165b47451d6409c073c53716b95a2b7c1e5cffb 100644 (file)
@@ -98,6 +98,27 @@ uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
        return h->ops->set_timeout(h, timeout);
 }
 
+bool dcerpc_binding_handle_transport_encrypted(struct dcerpc_binding_handle *h)
+{
+       if (h->ops->transport_encrypted == NULL) {
+               return false;
+       }
+
+       return h->ops->transport_encrypted(h);
+}
+
+NTSTATUS dcerpc_binding_handle_transport_session_key(
+               struct dcerpc_binding_handle *h,
+               TALLOC_CTX *mem_ctx,
+               DATA_BLOB *session_key)
+{
+       if (h->ops->transport_session_key == NULL) {
+               return NT_STATUS_NO_USER_SESSION_KEY;
+       }
+
+       return h->ops->transport_session_key(h, mem_ctx, session_key);
+}
+
 void dcerpc_binding_handle_auth_info(struct dcerpc_binding_handle *h,
                                     enum dcerpc_AuthType *auth_type,
                                     enum dcerpc_AuthLevel *auth_level)
index 76557101dcda162029310be3b545f968c5fd3c94..7faeb5f00b3d0978340edd70d52796b0b5f9c089 100644 (file)
@@ -176,6 +176,11 @@ struct dcerpc_binding_handle_ops {
        uint32_t (*set_timeout)(struct dcerpc_binding_handle *h,
                                uint32_t timeout);
 
+       bool (*transport_encrypted)(struct dcerpc_binding_handle *h);
+       NTSTATUS (*transport_session_key)(struct dcerpc_binding_handle *h,
+                                         TALLOC_CTX *mem_ctx,
+                                         DATA_BLOB *session_key);
+
        void (*auth_info)(struct dcerpc_binding_handle *h,
                          enum dcerpc_AuthType *auth_type,
                          enum dcerpc_AuthLevel *auth_level);
@@ -250,6 +255,13 @@ bool dcerpc_binding_handle_is_connected(struct dcerpc_binding_handle *h);
 uint32_t dcerpc_binding_handle_set_timeout(struct dcerpc_binding_handle *h,
                                           uint32_t timeout);
 
+bool dcerpc_binding_handle_transport_encrypted(struct dcerpc_binding_handle *h);
+
+NTSTATUS dcerpc_binding_handle_transport_session_key(
+               struct dcerpc_binding_handle *h,
+               TALLOC_CTX *mem_ctx,
+               DATA_BLOB *session_key);
+
 void dcerpc_binding_handle_auth_info(struct dcerpc_binding_handle *h,
                                     enum dcerpc_AuthType *auth_type,
                                     enum dcerpc_AuthLevel *auth_level);