STEP01: librpc/rpc/dcerpc_connection.c dcerpc_presentation_test_copy
authorStefan Metzmacher <metze@samba.org>
Wed, 22 Jan 2014 08:36:05 +0000 (09:36 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 10:45:39 +0000 (12:45 +0200)
librpc/rpc/dcerpc_connection.c
librpc/rpc/dcerpc_connection.h

index 32ee03fda1f97bc95bdf080ecdcf664464d537c2..598c0ef6cc4b8844561ed0e85256cc5d41eb4dea 100644 (file)
@@ -220,6 +220,43 @@ struct dcerpc_presentation *dcerpc_presentation_allocate(
        return pres;
 }
 
+struct dcerpc_presentation *dcerpc_presentation_test_copy(
+                                       TALLOC_CTX *mem_ctx,
+                                       const struct dcerpc_presentation *pres1,
+                                       const uint32_t *context_id,
+                                       const struct ndr_interface_table *table,
+                                       const struct ndr_syntax_id *transfer)
+{
+       struct dcerpc_presentation *pres2;
+
+       pres2 = talloc_zero(mem_ctx, struct dcerpc_presentation);
+       if (pres2 == NULL) {
+               return NULL;
+       }
+       *pres2 = *pres1;
+
+       if (context_id != NULL) {
+               pres2->context_id = *context_id;
+       }
+       if (table != NULL) {
+               pres2->table = table;
+       }
+       if (transfer != NULL) {
+               pres2->transfer = *transfer;
+       }
+
+       pres2->negotiate.req.abstract_syntax = pres2->table->syntax_id;
+       pres2->negotiate.req.context_id = pres2->context_id;
+       pres2->negotiate.req.num_transfer_syntaxes = 1;
+       pres2->negotiate.req.transfer_syntaxes = &pres2->transfer;
+
+       pres2->negotiate.ack.result = DCERPC_BIND_ACK_RESULT_PROVIDER_REJECTION;
+       pres2->negotiate.ack.reason.value =
+               DCERPC_BIND_ACK_REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED;
+
+       return pres2;
+}
+
 struct dcerpc_call *dcerpc_call_allocate(TALLOC_CTX *mem_ctx,
                                         struct dcerpc_association *assoc,
                                         struct dcerpc_security *sec,
index 1e8b096b8959a97943570df5d24b48b71ed1e633..b9e7159ecc01d7fdfa0df13858f826d37f5febd4 100644 (file)
@@ -51,6 +51,12 @@ struct dcerpc_presentation *dcerpc_presentation_allocate(
                                        struct dcerpc_connection *conn,
                                        const struct ndr_interface_table *table,
                                        const struct ndr_syntax_id *transfer);
+struct dcerpc_presentation *dcerpc_presentation_test_copy(
+                                       TALLOC_CTX *mem_ctx,
+                                       const struct dcerpc_presentation *pres1,
+                                       const uint32_t *context_id,
+                                       const struct ndr_interface_table *table,
+                                       const struct ndr_syntax_id *transfer);
 struct dcerpc_call *dcerpc_call_allocate(TALLOC_CTX *mem_ctx,
                                         struct dcerpc_association *assoc,
                                         struct dcerpc_security *sec,