summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc/dcerpc_util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-09 09:38:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:34 -0500
commitab9ca559269f9ef921eb3e6ec3007d2e249c6cfe (patch)
tree60e60ed25dab4c5049cb2e648e1bd35a6d6f34fb /source4/librpc/rpc/dcerpc_util.c
parent6836f5d0b167027908da9a08b9b219520997b563 (diff)
downloadsamba-ab9ca559269f9ef921eb3e6ec3007d2e249c6cfe.tar.gz
samba-ab9ca559269f9ef921eb3e6ec3007d2e249c6cfe.tar.bz2
samba-ab9ca559269f9ef921eb3e6ec3007d2e249c6cfe.zip
r4617: basic alter_context requests now work in our client library. The test
just does a simple LSA/DSSETUP combo, which is what w2k does in the ACL editor rpc calls that triggered this work (This used to be commit 0129ec947aa1fa5a7104dc3a666af3cb9bd104f1)
Diffstat (limited to 'source4/librpc/rpc/dcerpc_util.c')
-rw-r--r--source4/librpc/rpc/dcerpc_util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 67b0c530bf..702a1f6ecf 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -1265,3 +1265,50 @@ void dcerpc_log_packet(const struct dcerpc_interface_table *ndr,
}
}
+
+
+/*
+ create a secondary context from a primary connection
+
+ this uses dcerpc_alter_context() to create a new dcerpc context_id
+*/
+NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p, struct dcerpc_pipe **pp2,
+ uint32_t context_id,
+ const char *pipe_uuid,
+ uint32_t pipe_version)
+{
+ NTSTATUS status;
+ struct dcerpc_pipe *p2;
+
+ p2 = talloc_zero(p, struct dcerpc_pipe);
+ if (p2 == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ p2->conn = talloc_reference(p2, p->conn);
+
+ p2->context_id = context_id;
+
+ status = GUID_from_string(pipe_uuid, &p2->syntax.uuid);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(p2);
+ return status;
+ }
+ p2->syntax.if_version = pipe_version;
+
+ status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(p2);
+ return status;
+ }
+ p2->transfer_syntax.if_version = NDR_GUID_VERSION;
+
+ status = dcerpc_alter_context(p2, p2, &p2->syntax, &p2->transfer_syntax);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(p2);
+ return status;
+ }
+
+ *pp2 = p2;
+
+ return status;
+}