s4:librpc: create a binding on the pipe if necessary in dcerpc_pipe_open_smb2_send()
authorStefan Metzmacher <metze@samba.org>
Fri, 27 Apr 2012 14:18:47 +0000 (16:18 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 27 Apr 2012 15:44:06 +0000 (17:44 +0200)
Pair-Programmed-With: Michael Adam <obnox@samba.org>

source4/librpc/rpc/dcerpc_smb2.c

index b822c44fdaf8290672070ba8292f3a1ead91a7de..30f94a45c4c296dcd1ef5fea139ea2265a4ab421 100644 (file)
@@ -415,6 +415,21 @@ struct composite_context *dcerpc_pipe_open_smb2_send(struct dcerpc_pipe *p,
        struct smb2_request *req;
        struct dcecli_connection *c = p->conn;
 
+       /* if we don't have a binding on this pipe yet, then create one */
+       if (p->binding == NULL) {
+               NTSTATUS status;
+               const char *r = smbXcli_conn_remote_name(tree->session->transport->conn);
+               char *s;
+               SMB_ASSERT(r != NULL);
+               s = talloc_asprintf(p, "ncacn_np:%s", r);
+               if (s == NULL) return NULL;
+               status = dcerpc_parse_binding(p, s, &p->binding);
+               talloc_free(s);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return NULL;
+               }
+       }
+
        ctx = composite_create(c, c->event_ctx);
        if (ctx == NULL) return NULL;