summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-02-26 05:37:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:54 -0500
commit60fd088c480e474c3db8870f1288462a8452cea3 (patch)
tree0dca322c8fa84e0c0a34603a5c62f7cc5a21a92e /source4/librpc
parentb8c219a270e50f165a326c3657618c78e2ff58c5 (diff)
downloadsamba-60fd088c480e474c3db8870f1288462a8452cea3.tar.gz
samba-60fd088c480e474c3db8870f1288462a8452cea3.tar.bz2
samba-60fd088c480e474c3db8870f1288462a8452cea3.zip
r21535: - fixed a crash in the RAW-ACLS test. When a dcerpc_pipe is created
using the pattern in the clilsa code, it didn't fill in the p->binding structure. This affects nearly all users of dcerpc_pipe_open_smb(), so the simplest fix is to ensure that dcerpc_pipe_open_smb() initialises the binding if its not already there. - re-enable the RAW-ACLS test (This used to be commit d8875c286d2be49c01703d8fd58bbc1842054bd9)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/rpc/dcerpc.c1
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c6
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c19
-rw-r--r--source4/librpc/rpc/dcerpc_smb2.c7
4 files changed, 24 insertions, 9 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 0a7417a13f..328ddf445e 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -110,6 +110,7 @@ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *
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);
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index 38a707725d..38610c0c21 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -78,7 +78,7 @@ static void continue_smb_connect(struct composite_context *ctx)
s->io.pipe_name = s->io.binding->endpoint;
/* send named pipe open request */
- open_ctx = dcerpc_pipe_open_smb_send(s->io.pipe->conn, s->tree, s->io.pipe_name);
+ open_ctx = dcerpc_pipe_open_smb_send(s->io.pipe, s->tree, s->io.pipe_name);
if (composite_nomem(open_ctx, c)) return;
composite_continue(c, open_ctx, continue_pipe_open_smb, c);
@@ -192,7 +192,7 @@ static void continue_smb2_connect(struct composite_context *ctx)
s->io.pipe_name = s->io.binding->endpoint;
/* send named pipe open request */
- open_req = dcerpc_pipe_open_smb2_send(s->io.pipe->conn, s->tree, s->io.pipe_name);
+ open_req = dcerpc_pipe_open_smb2_send(s->io.pipe, s->tree, s->io.pipe_name);
if (composite_nomem(open_req, c)) return;
composite_continue(c, open_req, continue_pipe_open_smb2, c);
@@ -969,7 +969,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p
return c;
}
- pipe_smb_req = dcerpc_pipe_open_smb_send(s->pipe2->conn, s->tree,
+ pipe_smb_req = dcerpc_pipe_open_smb_send(s->pipe2, s->tree,
s->binding->endpoint);
composite_continue(c, pipe_smb_req, continue_open_smb, c);
return c;
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index 1a80de75a8..d6d2cf0dfb 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -390,13 +390,26 @@ struct pipe_open_smb_state {
static void pipe_open_recv(struct smbcli_request *req);
-struct composite_context *dcerpc_pipe_open_smb_send(struct dcerpc_connection *c,
+struct composite_context *dcerpc_pipe_open_smb_send(struct dcerpc_pipe *p,
struct smbcli_tree *tree,
const char *pipe_name)
{
struct composite_context *ctx;
struct pipe_open_smb_state *state;
struct smbcli_request *req;
+ struct dcerpc_connection *c = p->conn;
+
+ /* if we don't have a binding on this pipe yet, then create one */
+ if (p->binding == NULL) {
+ NTSTATUS status;
+ char *s = talloc_asprintf(p, "ncacn_np:%s", tree->session->transport->socket->hostname);
+ 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;
@@ -494,11 +507,11 @@ NTSTATUS dcerpc_pipe_open_smb_recv(struct composite_context *c)
return status;
}
-NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_connection *c,
+NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe *p,
struct smbcli_tree *tree,
const char *pipe_name)
{
- struct composite_context *ctx = dcerpc_pipe_open_smb_send(c, tree,
+ struct composite_context *ctx = dcerpc_pipe_open_smb_send(p, tree,
pipe_name);
return dcerpc_pipe_open_smb_recv(ctx);
}
diff --git a/source4/librpc/rpc/dcerpc_smb2.c b/source4/librpc/rpc/dcerpc_smb2.c
index 845884115c..20d1c7c211 100644
--- a/source4/librpc/rpc/dcerpc_smb2.c
+++ b/source4/librpc/rpc/dcerpc_smb2.c
@@ -362,7 +362,7 @@ struct pipe_open_smb2_state {
static void pipe_open_recv(struct smb2_request *req);
-struct composite_context *dcerpc_pipe_open_smb2_send(struct dcerpc_connection *c,
+struct composite_context *dcerpc_pipe_open_smb2_send(struct dcerpc_pipe *p,
struct smb2_tree *tree,
const char *pipe_name)
{
@@ -370,6 +370,7 @@ struct composite_context *dcerpc_pipe_open_smb2_send(struct dcerpc_connection *c
struct pipe_open_smb2_state *state;
struct smb2_create io;
struct smb2_request *req;
+ struct dcerpc_connection *c = p->conn;
ctx = composite_create(c, c->event_ctx);
if (ctx == NULL) return NULL;
@@ -463,11 +464,11 @@ NTSTATUS dcerpc_pipe_open_smb2_recv(struct composite_context *c)
return status;
}
-NTSTATUS dcerpc_pipe_open_smb2(struct dcerpc_connection *c,
+NTSTATUS dcerpc_pipe_open_smb2(struct dcerpc_pipe *p,
struct smb2_tree *tree,
const char *pipe_name)
{
- struct composite_context *ctx = dcerpc_pipe_open_smb2_send(c, tree, pipe_name);
+ struct composite_context *ctx = dcerpc_pipe_open_smb2_send(p, tree, pipe_name);
return dcerpc_pipe_open_smb2_recv(ctx);
}