summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-27 14:28:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:48 -0500
commitacd6a086b341096fcbea1775ce748587fcc8020a (patch)
tree202c9407be50a6fe215c4e6ab7ccaf843807b6c3 /source4/librpc
parent1f8bb5bd8552bb02204225e312ab36e7844920c1 (diff)
downloadsamba-acd6a086b341096fcbea1775ce748587fcc8020a.tar.gz
samba-acd6a086b341096fcbea1775ce748587fcc8020a.tar.bz2
samba-acd6a086b341096fcbea1775ce748587fcc8020a.zip
r12510: Change the DCE/RPC interfaces to take a pointer to a
dcerpc_interface_table struct rather then a tuple of interface name, UUID and version. This removes the requirement for having a global list of DCE/RPC interfaces, except for these parts of the code that use that list explicitly (ndrdump and the scanner torture test). This should also allow us to remove the hack that put the authservice parameter in the dcerpc_binding struct as it can now be read directly from dcerpc_interface_table. I will now modify some of these functions to take a dcerpc_syntax_id structure rather then a full dcerpc_interface_table. (This used to be commit 8aae0f168e54c01d0866ad6e0da141dbd828574f)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/rpc/dcerpc.c10
-rw-r--r--source4/librpc/rpc/dcerpc.h3
-rw-r--r--source4/librpc/rpc/dcerpc_auth.c17
-rw-r--r--source4/librpc/rpc/dcerpc_schannel.c10
-rw-r--r--source4/librpc/rpc/dcerpc_util.c69
5 files changed, 45 insertions, 64 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index d8fb3e4e6a..b947b4aa5c 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -790,16 +790,16 @@ NTSTATUS dcerpc_auth3(struct dcerpc_connection *c,
/*
return the rpc syntax and transfer syntax given the pipe uuid and version
*/
-NTSTATUS dcerpc_init_syntaxes(const char *uuid, uint_t version,
+NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table,
struct dcerpc_syntax_id *syntax,
struct dcerpc_syntax_id *transfer_syntax)
{
NTSTATUS status;
- status = GUID_from_string(uuid, &syntax->uuid);
+ status = GUID_from_string(table->uuid, &syntax->uuid);
if (!NT_STATUS_IS_OK(status)) return status;
- syntax->if_version = version;
+ syntax->if_version = table->if_version;
status = GUID_from_string(NDR_GUID, &transfer_syntax->uuid);
if (!NT_STATUS_IS_OK(status)) return status;
@@ -812,13 +812,13 @@ NTSTATUS dcerpc_init_syntaxes(const char *uuid, uint_t version,
/* perform a dcerpc bind, using the uuid as the key */
NTSTATUS dcerpc_bind_byuuid(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
- const char *uuid, uint_t version)
+ const struct dcerpc_interface_table *table)
{
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
NTSTATUS status;
- status = dcerpc_init_syntaxes(uuid, version,
+ status = dcerpc_init_syntaxes(table,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(2,("Invalid uuid string in dcerpc_bind_byuuid\n"));
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 142b2287b6..263121eaef 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -198,9 +198,8 @@ struct dcerpc_binding {
struct dcerpc_pipe_connect {
struct dcerpc_pipe *pipe;
struct dcerpc_binding *binding;
- const char *pipe_uuid;
const char *pipe_name;
- uint32_t pipe_version;
+ const struct dcerpc_interface_table *interface;
struct cli_credentials *creds;
};
diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c
index dcf3334212..c66384a3cf 100644
--- a/source4/librpc/rpc/dcerpc_auth.c
+++ b/source4/librpc/rpc/dcerpc_auth.c
@@ -31,8 +31,7 @@
struct composite_context *dcerpc_bind_auth_none_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
- const char *uuid,
- uint_t version)
+ const struct dcerpc_interface_table *table)
{
struct dcerpc_syntax_id syntax;
struct dcerpc_syntax_id transfer_syntax;
@@ -42,7 +41,7 @@ struct composite_context *dcerpc_bind_auth_none_send(TALLOC_CTX *mem_ctx,
c = talloc_zero(mem_ctx, struct composite_context);
if (c == NULL) return NULL;
- c->status = dcerpc_init_syntaxes(uuid, version,
+ c->status = dcerpc_init_syntaxes(table,
&syntax, &transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(2,("Invalid uuid string in "
@@ -63,10 +62,10 @@ NTSTATUS dcerpc_bind_auth_none_recv(struct composite_context *ctx)
}
NTSTATUS dcerpc_bind_auth_none(struct dcerpc_pipe *p,
- const char *uuid, uint_t version)
+ const struct dcerpc_interface_table *table)
{
struct composite_context *ctx;
- ctx = dcerpc_bind_auth_none_send(p, p, uuid, version);
+ ctx = dcerpc_bind_auth_none_send(p, p, table);
return dcerpc_bind_auth_none_recv(ctx);
}
@@ -166,7 +165,7 @@ static void bind_auth_recv_bindreply(struct composite_context *creq)
struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
struct dcerpc_pipe *p,
- const char *uuid, uint_t version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_type,
const char *service)
@@ -192,7 +191,7 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
state->pipe = p;
- c->status = dcerpc_init_syntaxes(uuid, version,
+ c->status = dcerpc_init_syntaxes(table,
&syntax,
&transfer_syntax);
if (!NT_STATUS_IS_OK(c->status)) goto failed;
@@ -321,13 +320,13 @@ NTSTATUS dcerpc_bind_auth_recv(struct composite_context *creq)
setup GENSEC on a DCE-RPC pipe
*/
NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p,
- const char *uuid, uint_t version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
uint8_t auth_type,
const char *service)
{
struct composite_context *creq;
- creq = dcerpc_bind_auth_send(p, p, uuid, version, credentials,
+ creq = dcerpc_bind_auth_send(p, p, table, credentials,
auth_type, service);
return dcerpc_bind_auth_recv(creq);
}
diff --git a/source4/librpc/rpc/dcerpc_schannel.c b/source4/librpc/rpc/dcerpc_schannel.c
index e9e31f294f..d6971612f2 100644
--- a/source4/librpc/rpc/dcerpc_schannel.c
+++ b/source4/librpc/rpc/dcerpc_schannel.c
@@ -65,7 +65,7 @@ static NTSTATUS dcerpc_schannel_key(TALLOC_CTX *tmp_ctx,
/* Make binding string for netlogon, not the other pipe */
status = dcerpc_epm_map_binding(tmp_ctx, b,
- DCERPC_NETLOGON_UUID, DCERPC_NETLOGON_VERSION,
+ &dcerpc_table_netlogon,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
@@ -78,8 +78,7 @@ static NTSTATUS dcerpc_schannel_key(TALLOC_CTX *tmp_ctx,
return status;
}
- status = dcerpc_bind_auth_none(p2, DCERPC_NETLOGON_UUID,
- DCERPC_NETLOGON_VERSION);
+ status = dcerpc_bind_auth_none(p2, &dcerpc_table_netlogon);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p2);
return status;
@@ -142,7 +141,7 @@ static NTSTATUS dcerpc_schannel_key(TALLOC_CTX *tmp_ctx,
NTSTATUS dcerpc_bind_auth_schannel(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
- const char *uuid, uint_t version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials)
{
NTSTATUS status;
@@ -158,8 +157,7 @@ NTSTATUS dcerpc_bind_auth_schannel(TALLOC_CTX *tmp_ctx,
return status;
}
- return dcerpc_bind_auth(p, uuid, version,
- credentials, DCERPC_AUTH_TYPE_SCHANNEL,
+ return dcerpc_bind_auth(p, table, credentials, DCERPC_AUTH_TYPE_SCHANNEL,
NULL);
}
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 72975461d0..039c3a6a45 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -823,7 +823,7 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *
}
NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding,
- const char *uuid, uint_t version, struct event_context *ev)
+ const struct dcerpc_interface_table *table, struct event_context *ev)
{
struct dcerpc_pipe *p;
NTSTATUS status;
@@ -832,7 +832,6 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
struct GUID guid;
struct epm_twr_t twr, *twr_r;
struct dcerpc_binding *epmapper_binding;
- const struct dcerpc_interface_table *table = idl_iface_by_uuid(uuid);
int i;
struct cli_credentials *anon_creds
@@ -879,8 +878,7 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
status = dcerpc_pipe_connect_b(mem_ctx,
&p,
epmapper_binding,
- DCERPC_EPMAPPER_UUID,
- DCERPC_EPMAPPER_VERSION,
+ &dcerpc_table_epmapper,
anon_creds, ev);
if (!NT_STATUS_IS_OK(status)) {
@@ -890,12 +888,12 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
ZERO_STRUCT(handle);
ZERO_STRUCT(guid);
- status = GUID_from_string(uuid, &binding->object);
+ status = GUID_from_string(table->uuid, &binding->object);
if (NT_STATUS_IS_ERR(status)) {
return status;
}
- binding->object_version = version;
+ binding->object_version = table->if_version;
status = dcerpc_binding_build_tower(p, binding, &twr.tower);
if (NT_STATUS_IS_ERR(status)) {
@@ -944,8 +942,7 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
*/
NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials)
{
NTSTATUS status;
@@ -964,9 +961,7 @@ NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p,
/* If we don't already have netlogon credentials for
* the schannel bind, then we have to get these
* first */
- status = dcerpc_bind_auth_schannel(tmp_ctx,
- p, pipe_uuid, pipe_version,
- credentials);
+ status = dcerpc_bind_auth_schannel(tmp_ctx, p, table, credentials);
} else if (!cli_credentials_is_anonymous(credentials) &&
!(binding->transport == NCACN_NP &&
!(binding->flags & DCERPC_SIGN) &&
@@ -1001,15 +996,15 @@ NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p,
auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
}
- status = dcerpc_bind_auth(p, pipe_uuid, pipe_version,
+ status = dcerpc_bind_auth(p, table,
credentials, auth_type,
binding->authservice);
} else {
- status = dcerpc_bind_auth_none(p, pipe_uuid, pipe_version);
+ status = dcerpc_bind_auth_none(p, table);
}
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to bind to uuid %s - %s\n", pipe_uuid, nt_errstr(status)));
+ DEBUG(0,("Failed to bind to uuid %s - %s\n", table->uuid, nt_errstr(status)));
}
talloc_free(tmp_ctx);
return status;
@@ -1034,8 +1029,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
static NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
@@ -1056,8 +1050,7 @@ static NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *tmp_ctx,
static NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
@@ -1071,7 +1064,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream(TALLOC_CTX *tmp_ctx,
DEBUG(0,("Failed to open unix socket %s - %s\n",
binding->endpoint, nt_errstr(status)));
talloc_free(p);
- return status;
+ return status;
}
return status;
@@ -1082,8 +1075,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_unix_stream(TALLOC_CTX *tmp_ctx,
static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(TALLOC_CTX *tmp_ctx,
struct dcerpc_pipe *p,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
uint32_t port = 0;
@@ -1106,8 +1098,7 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(TALLOC_CTX *tmp_ctx,
NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **pp,
struct dcerpc_binding *binding,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
struct event_context *ev)
{
@@ -1130,12 +1121,11 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
case NCACN_IP_TCP:
case NCALRPC:
if (!binding->endpoint) {
- status = dcerpc_epm_map_binding(tmp_ctx, binding,
- pipe_uuid, pipe_version,
+ status = dcerpc_epm_map_binding(tmp_ctx, binding, table,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC endpoint for '%s' - %s\n",
- pipe_uuid, nt_errstr(status)));
+ table->uuid, nt_errstr(status)));
return status;
}
DEBUG(2,("Mapped to DCERPC endpoint %s\n", binding->endpoint));
@@ -1150,8 +1140,7 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
pc.pipe = p;
pc.binding = binding;
- pc.pipe_uuid = pipe_uuid;
- pc.pipe_version = pipe_version;
+ pc.interface = table;
pc.creds = credentials;
switch (binding->transport) {
@@ -1161,15 +1150,15 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
case NCACN_IP_TCP:
status = dcerpc_pipe_connect_ncacn_ip_tcp(tmp_ctx,
- p, binding, pipe_uuid, pipe_version);
+ p, binding, table);
break;
case NCACN_UNIX_STREAM:
status = dcerpc_pipe_connect_ncacn_unix_stream(tmp_ctx,
- p, binding, pipe_uuid, pipe_version);
+ p, binding, table);
break;
case NCALRPC:
status = dcerpc_pipe_connect_ncalrpc(tmp_ctx,
- p, binding, pipe_uuid, pipe_version);
+ p, binding, table);
break;
default:
return NT_STATUS_NOT_SUPPORTED;
@@ -1180,7 +1169,7 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
return status;
}
- status = dcerpc_pipe_auth(p, binding, pipe_uuid, pipe_version, credentials);
+ status = dcerpc_pipe_auth(p, binding, table, credentials);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p);
return status;
@@ -1196,9 +1185,8 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
binding to determine the endpoint and options */
NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
struct dcerpc_pipe **pp,
- const char *binding,
- const char *pipe_uuid,
- uint32_t pipe_version,
+ const char *binding,
+ const struct dcerpc_interface_table *table,
struct cli_credentials *credentials,
struct event_context *ev)
{
@@ -1220,9 +1208,7 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
DEBUG(3,("Using binding %s\n", dcerpc_binding_string(tmp_ctx, b)));
- status = dcerpc_pipe_connect_b(tmp_ctx,
- pp, b, pipe_uuid, pipe_version,
- credentials, ev);
+ status = dcerpc_pipe_connect_b(tmp_ctx, pp, b, table, credentials, ev);
if (NT_STATUS_IS_OK(status)) {
*pp = talloc_steal(parent_ctx, *pp);
@@ -1344,8 +1330,7 @@ void dcerpc_log_packet(const struct dcerpc_interface_table *ndr,
*/
NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
struct dcerpc_pipe **pp2,
- const char *pipe_uuid,
- uint32_t pipe_version)
+ const struct dcerpc_interface_table *table)
{
NTSTATUS status;
struct dcerpc_pipe *p2;
@@ -1359,12 +1344,12 @@ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
p2->context_id = ++p->conn->next_context_id;
- status = GUID_from_string(pipe_uuid, &p2->syntax.uuid);
+ status = GUID_from_string(table->uuid, &p2->syntax.uuid);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(p2);
return status;
}
- p2->syntax.if_version = pipe_version;
+ p2->syntax.if_version = table->if_version;
status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid);
if (!NT_STATUS_IS_OK(status)) {