From: Stefan Metzmacher Date: Sat, 14 Sep 2024 07:55:20 +0000 (+0200) Subject: librpc/rpc: add dcerpc_binding_handle_transport_{encrypted,session_key}() X-Git-Tag: samba-4.21.7~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4990ed56f750d64732dab2cd3b6672a48a4da6c;p=thirdparty%2Fsamba.git librpc/rpc: add dcerpc_binding_handle_transport_{encrypted,session_key}() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme (cherry picked from commit 3dc3f9cf1b6fc47baea329863e31ff140cf89550) --- diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c index 41675e10360..f165b47451d 100644 --- a/librpc/rpc/binding_handle.c +++ b/librpc/rpc/binding_handle.c @@ -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) diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index 76557101dcd..7faeb5f00b3 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -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);