s4:librpc/rpc: pass the object guid to the binding handle if required
[samba.git] / source4 / librpc / rpc / dcerpc_auth.c
index c902d6e52599f476b9a4e55953f07cde148b5ba7..08578c9adcfffc1317eb81242974c0399a5dcebf 100644 (file)
 /*
   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;