summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-29 02:01:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:03:06 -0500
commit64e98b032431fbbfe76b48dd193af6ff43d510ed (patch)
treea330577c4c1c1eab7d7737d05395a1d420e43dc2
parent4e1d0cc8e3b7bfb51845fbe836812f7558c30c10 (diff)
downloadsamba-64e98b032431fbbfe76b48dd193af6ff43d510ed.tar.gz
samba-64e98b032431fbbfe76b48dd193af6ff43d510ed.tar.bz2
samba-64e98b032431fbbfe76b48dd193af6ff43d510ed.zip
r24763: Allow users to leave out the transport in DCE/RPC binding strings. If the transport is not specified, it will be retrieved from the remote endpoint mapper or the IDL file.
This means that 'smbtorture localhost RPC-WINREG' works now. (This used to be commit b7fa0859d2e4236112075604281410ba037b1076)
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c8
-rw-r--r--source4/librpc/rpc/dcerpc_util.c18
2 files changed, 21 insertions, 5 deletions
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index 710474ce3b..be95f21594 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -733,6 +733,14 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx,
dcerpc_connect_timeout_handler, c);
switch (s->binding->transport) {
+ case NCA_UNKNOWN: {
+ struct composite_context *binding_req;
+ binding_req = dcerpc_epm_map_binding_send(c, s->binding, s->table,
+ s->pipe->conn->event_ctx);
+ composite_continue(c, binding_req, continue_map_binding, c);
+ return c;
+ }
+
case NCACN_NP:
case NCACN_IP_TCP:
case NCALRPC:
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index f097e53f20..11f5451891 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -531,7 +531,9 @@ const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm
return NULL;
}
-static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor, const char *data)
+static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx,
+ struct epm_floor *epm_floor,
+ const char *data)
{
switch (epm_floor->lhs.protocol) {
case EPM_PROTOCOL_TCP:
@@ -648,7 +650,9 @@ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
return (unsigned int)-1;
}
-NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, struct dcerpc_binding **b_out)
+NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
+ struct epm_tower *tower,
+ struct dcerpc_binding **b_out)
{
NTSTATUS status;
struct dcerpc_binding *binding;
@@ -932,7 +936,7 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
/*
First, check if there is a default endpoint specified in the IDL
*/
- if (table) {
+ if (table != NULL) {
struct dcerpc_binding *default_binding;
/* Find one of the default pipes for this interface */
@@ -940,7 +944,10 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
if (NT_STATUS_IS_OK(status)) {
- if (default_binding->transport == binding->transport && default_binding->endpoint) {
+ if (binding->transport == NCA_UNKNOWN)
+ binding->transport = default_binding->transport;
+ if (default_binding->transport == binding->transport &&
+ default_binding->endpoint) {
binding->endpoint = talloc_reference(binding, default_binding->endpoint);
talloc_free(default_binding);
@@ -967,7 +974,8 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
epmapper_binding->endpoint = NULL;
/* initiate rpc pipe connection */
- pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding, &ndr_table_epmapper,
+ pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding,
+ &ndr_table_epmapper,
anon_creds, c->event_ctx);
if (composite_nomem(pipe_connect_req, c)) return c;