]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/tstream_binding_handle: implement get_binding()
authorStefan Metzmacher <metze@samba.org>
Tue, 17 Sep 2024 18:43:28 +0000 (20:43 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 26 Sep 2024 15:22:45 +0000 (15:22 +0000)
We just create an dummy binding handle here
as it's not really dcerpc...

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

index 76f54a7f338af494a5626ee6f2a897985a72f912..672fd3b89c680d4bfb91a1d22e3f71d2f7d46d17 100644 (file)
@@ -35,8 +35,17 @@ struct tstream_bh_state {
        size_t call_initial_read_size;
        tstream_read_pdu_blob_full_fn_t *complete_pdu_fn;
        void *complete_pdu_fn_private;
+       const struct dcerpc_binding *binding;
 };
 
+static const struct dcerpc_binding *tstream_bh_get_binding(struct dcerpc_binding_handle *h)
+{
+       struct tstream_bh_state *hs = dcerpc_binding_handle_data(
+               h, struct tstream_bh_state);
+
+       return hs->binding;
+}
+
 static bool tstream_bh_is_connected(struct dcerpc_binding_handle *h)
 {
        struct tstream_bh_state *hs = dcerpc_binding_handle_data(
@@ -290,6 +299,7 @@ static NTSTATUS tstream_bh_call_recv(struct tevent_req *req,
 
 static const struct dcerpc_binding_handle_ops tstream_bh_ops = {
        .name                   = "tstream_binding_handle",
+       .get_binding            = tstream_bh_get_binding,
        .is_connected           = tstream_bh_is_connected,
        .set_timeout            = tstream_bh_set_timeout,
        .raw_call_send          = tstream_bh_call_send,
@@ -309,6 +319,8 @@ struct dcerpc_binding_handle *tstream_binding_handle_create(
 {
        struct dcerpc_binding_handle *h = NULL;
        struct tstream_bh_state *hs = NULL;
+       struct dcerpc_binding *b = NULL;
+       NTSTATUS status;
 
        h = dcerpc_binding_handle_create(mem_ctx,
                                         &tstream_bh_ops,
@@ -333,6 +345,13 @@ struct dcerpc_binding_handle *tstream_binding_handle_create(
                return NULL;
        }
 
+       status = dcerpc_parse_binding(hs, "", &b);
+       if (!NT_STATUS_IS_OK(status)) {
+               TALLOC_FREE(h);
+               return NULL;
+       }
+       hs->binding = b;
+
        if (max_data > 0) {
                tstream_smbXcli_np_set_max_data(hs->stream, max_data);
        }