1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

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>
This commit is contained in:
Stefan Metzmacher 2016-09-24 00:22:41 +02:00 committed by Andreas Schneider
parent 47d89002a4
commit b5abc7cadc
4 changed files with 30 additions and 21 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;