summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-09-24 00:22:41 +0200
committerAndreas Schneider <asn@cryptomilk.org>2016-10-26 11:20:18 +0200
commitb5abc7cadc48146576da3187437ca3486da05c3d (patch)
tree4b1ca83a20017e4b064507f95febcbc4dfc6a438 /source4/librpc
parent47d89002a4c30e50e3efaced689dd87edbbafa9a (diff)
downloadsamba-b5abc7cadc48146576da3187437ca3486da05c3d.tar.gz
s4:librpc/rpc: pass the object guid to the binding handle if required
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/rpc/dcerpc.c20
-rw-r--r--source4/librpc/rpc/dcerpc.h1
-rw-r--r--source4/librpc/rpc/dcerpc_auth.c22
-rw-r--r--source4/librpc/rpc/dcerpc_util.c8
4 files changed, 30 insertions, 21 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 7816aca3220..bdebf798198 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -615,15 +615,17 @@ static const struct dcerpc_binding_handle_ops dcerpc_bh_ops = {
};
/* initialise a dcerpc pipe. */
-struct dcerpc_binding_handle *dcerpc_pipe_binding_handle(struct dcerpc_pipe *p)
+struct dcerpc_binding_handle *dcerpc_pipe_binding_handle(struct dcerpc_pipe *p,
+ const struct GUID *object,
+ const struct ndr_interface_table *table)
{
struct dcerpc_binding_handle *h;
struct dcerpc_bh_state *hs;
h = dcerpc_binding_handle_create(p,
&dcerpc_bh_ops,
- NULL,
- NULL, /* TODO */
+ object,
+ table,
&hs,
struct dcerpc_bh_state,
__location__);
@@ -653,24 +655,12 @@ _PUBLIC_ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent
return NULL;
}
- p->last_fault_code = 0;
- p->context_id = 0;
p->request_timeout = DCERPC_REQUEST_TIMEOUT;
- p->binding = NULL;
-
- ZERO_STRUCT(p->syntax);
- ZERO_STRUCT(p->transfer_syntax);
if (DEBUGLVL(100)) {
p->conn->flags |= DCERPC_DEBUG_PRINT_BOTH;
}
- p->binding_handle = dcerpc_pipe_binding_handle(p);
- if (p->binding_handle == NULL) {
- talloc_free(p);
- return NULL;
- }
-
return p;
}
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index f89fea0741d..3223948cf9d 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -123,6 +123,7 @@ struct dcerpc_pipe {
uint32_t context_id;
+ struct GUID object;
struct ndr_syntax_id syntax;
struct ndr_syntax_id transfer_syntax;
diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c
index c902d6e5259..08578c9adcf 100644
--- a/source4/librpc/rpc/dcerpc_auth.c
+++ b/source4/librpc/rpc/dcerpc_auth.c
@@ -32,15 +32,27 @@
/*
return the rpc syntax and transfer syntax given the pipe uuid and version
*/
-static NTSTATUS dcerpc_init_syntaxes(const struct ndr_interface_table *table,
- uint32_t pipe_flags,
+static NTSTATUS dcerpc_init_syntaxes(struct dcerpc_pipe *p,
+ const struct ndr_interface_table *table,
struct ndr_syntax_id *syntax,
struct ndr_syntax_id *transfer_syntax)
{
+ struct GUID *object = NULL;
+
+ p->object = dcerpc_binding_get_object(p->binding);
+ if (!GUID_all_zero(&p->object)) {
+ object = &p->object;
+ }
+
+ p->binding_handle = dcerpc_pipe_binding_handle(p, object, table);
+ if (p->binding_handle == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
syntax->uuid = table->syntax_id.uuid;
syntax->if_version = table->syntax_id.if_version;
- if (pipe_flags & DCERPC_NDR64) {
+ if (p->conn->flags & DCERPC_NDR64) {
*transfer_syntax = ndr_transfer_syntax_ndr64;
} else {
*transfer_syntax = ndr_transfer_syntax_ndr;
@@ -68,7 +80,7 @@ struct composite_context *dcerpc_bind_auth_none_send(TALLOC_CTX *mem_ctx,
c = composite_create(mem_ctx, p->conn->event_ctx);
if (c == NULL) return NULL;
- c->status = dcerpc_init_syntaxes(table, p->conn->flags,
+ c->status = dcerpc_init_syntaxes(p, table,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(2,("Invalid uuid string in "
@@ -311,7 +323,7 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
state->pipe = p;
- c->status = dcerpc_init_syntaxes(table, p->conn->flags,
+ c->status = dcerpc_init_syntaxes(p, table,
&syntax,
&transfer_syntax);
if (!composite_is_ok(c)) return c;
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 5c4e4b6d706..85356cfc6e7 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -853,6 +853,7 @@ _PUBLIC_ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
{
NTSTATUS status;
struct dcerpc_pipe *p2;
+ struct GUID *object = NULL;
p2 = talloc_zero(p, struct dcerpc_pipe);
if (p2 == NULL) {
@@ -873,7 +874,12 @@ _PUBLIC_ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
return NT_STATUS_NO_MEMORY;
}
- p2->binding_handle = dcerpc_pipe_binding_handle(p2);
+ p2->object = dcerpc_binding_get_object(p2->binding);
+ if (!GUID_all_zero(&p2->object)) {
+ object = &p2->object;
+ }
+
+ p2->binding_handle = dcerpc_pipe_binding_handle(p2, object, table);
if (p2->binding_handle == NULL) {
talloc_free(p2);
return NT_STATUS_NO_MEMORY;