summaryrefslogtreecommitdiffstats
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-04-27 16:18:47 +0200
committerMichael Adam <obnox@samba.org>2012-04-27 17:44:06 +0200
commit5629eb78028cfcd9fc183d5e4950878e135ed2c8 (patch)
tree377be266a3737a2487192603a8f3e25981e6b631 /source4/librpc/rpc
parent2f35c246fccd2157ccc06ee13a49c7ae854737fa (diff)
downloadsamba-5629eb78028cfcd9fc183d5e4950878e135ed2c8.tar.gz
samba-5629eb78028cfcd9fc183d5e4950878e135ed2c8.tar.xz
samba-5629eb78028cfcd9fc183d5e4950878e135ed2c8.zip
s4:librpc: create a binding on the pipe if necessary in dcerpc_pipe_open_smb2_send()
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc_smb2.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/librpc/rpc/dcerpc_smb2.c b/source4/librpc/rpc/dcerpc_smb2.c
index b822c44fda..30f94a45c4 100644
--- a/source4/librpc/rpc/dcerpc_smb2.c
+++ b/source4/librpc/rpc/dcerpc_smb2.c
@@ -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;