summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/dcerpc_server.c58
-rw-r--r--source4/rpc_server/dcerpc_server.h4
-rw-r--r--source4/rpc_server/epmapper/rpc_epmapper.c2
-rw-r--r--source4/rpc_server/remote/dcesrv_remote.c6
4 files changed, 29 insertions, 41 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index a8724b5bb8..facf6bc0af 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -87,15 +87,8 @@ static struct dcesrv_connection_context *dcesrv_find_context(struct dcesrv_conne
static BOOL interface_match(const struct dcesrv_interface *if1,
const struct dcesrv_interface *if2)
{
- if (if1->if_version != if2->if_version) {
- return False;
- }
-
- if (strcmp(if1->uuid, if2->uuid)==0) {
- return True;
- }
-
- return False;
+ return (if1->if_version == if2->if_version &&
+ GUID_equal(&if1->uuid, &if2->uuid));
}
/*
@@ -117,24 +110,16 @@ static const struct dcesrv_interface *find_interface(const struct dcesrv_endpoin
see if a uuid and if_version match to an interface
*/
static BOOL interface_match_by_uuid(const struct dcesrv_interface *iface,
- const char *uuid, uint32_t if_version)
+ const struct GUID *uuid, uint32_t if_version)
{
- if (iface->if_version != if_version) {
- return False;
- }
-
- if (strcmp(iface->uuid, uuid)==0) {
- return True;
- }
-
- return False;
+ return (iface->if_version == if_version && GUID_equal(&iface->uuid, uuid));
}
/*
find the interface operations on an endpoint by uuid
*/
static const struct dcesrv_interface *find_interface_by_uuid(const struct dcesrv_endpoint *endpoint,
- const char *uuid, uint32_t if_version)
+ const struct GUID *uuid, uint32_t if_version)
{
struct dcesrv_if_list *ifl;
for (ifl=endpoint->interface_list; ifl; ifl=ifl->next) {
@@ -462,8 +447,9 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason)
*/
static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
{
- const char *uuid, *transfer_syntax;
+ const char *transfer_syntax;
uint32_t if_version, transfer_syntax_version;
+ struct GUID uuid;
struct ncacn_packet pkt;
struct data_blob_list_item *rep;
NTSTATUS status;
@@ -484,10 +470,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
}
if_version = call->pkt.u.bind.ctx_list[0].abstract_syntax.if_version;
- uuid = GUID_string(call, &call->pkt.u.bind.ctx_list[0].abstract_syntax.uuid);
- if (!uuid) {
- return dcesrv_bind_nak(call, 0);
- }
+ uuid = call->pkt.u.bind.ctx_list[0].abstract_syntax.uuid;
transfer_syntax_version = call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].if_version;
transfer_syntax = GUID_string(call,
@@ -500,9 +483,12 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
return dcesrv_bind_nak(call, 0);
}
- iface = find_interface_by_uuid(call->conn->endpoint, uuid, if_version);
+ iface = find_interface_by_uuid(call->conn->endpoint, &uuid, if_version);
if (iface == NULL) {
- DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid, if_version));
+ char *uuid_str = GUID_string(call, &uuid);
+ DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid_str, if_version));
+ talloc_free(uuid_str);
+
/* we don't know about that interface */
result = DCERPC_BIND_PROVIDER_REJECT;
reason = DCERPC_BIND_REASON_ASYNTAX;
@@ -567,8 +553,10 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
if (iface) {
status = iface->bind(call, iface);
if (!NT_STATUS_IS_OK(status)) {
+ char *uuid_str = GUID_string(call, &uuid);
DEBUG(2,("Request for dcerpc interface %s/%d rejected: %s\n",
- uuid, if_version, nt_errstr(status)));
+ uuid_str, if_version, nt_errstr(status)));
+ talloc_free(uuid_str);
return dcesrv_bind_nak(call, 0);
}
}
@@ -617,15 +605,13 @@ static NTSTATUS dcesrv_auth3(struct dcesrv_call_state *call)
static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_t context_id)
{
uint32_t if_version, transfer_syntax_version;
- const char *uuid, *transfer_syntax;
+ const char *transfer_syntax;
struct dcesrv_connection_context *context;
const struct dcesrv_interface *iface;
+ struct GUID uuid;
if_version = call->pkt.u.alter.ctx_list[0].abstract_syntax.if_version;
- uuid = GUID_string(call, &call->pkt.u.alter.ctx_list[0].abstract_syntax.uuid);
- if (!uuid) {
- return NT_STATUS_NO_MEMORY;
- }
+ uuid = call->pkt.u.alter.ctx_list[0].abstract_syntax.uuid;
transfer_syntax_version = call->pkt.u.alter.ctx_list[0].transfer_syntaxes[0].if_version;
transfer_syntax = GUID_string(call,
@@ -637,9 +623,11 @@ static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_
return NT_STATUS_NO_MEMORY;
}
- iface = find_interface_by_uuid(call->conn->endpoint, uuid, if_version);
+ iface = find_interface_by_uuid(call->conn->endpoint, &uuid, if_version);
if (iface == NULL) {
- DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid, if_version));
+ char *uuid_str = GUID_string(call, &uuid);
+ DEBUG(2,("Request for unknown dcerpc interface %s/%d\n", uuid_str, if_version));
+ talloc_free(uuid_str);
return NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED;
}
diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h
index 9b82b2edcc..e831b70060 100644
--- a/source4/rpc_server/dcerpc_server.h
+++ b/source4/rpc_server/dcerpc_server.h
@@ -37,7 +37,7 @@ struct dcesrv_auth;
struct dcesrv_interface {
const char *name;
- const char *uuid;
+ struct GUID uuid;
uint32_t if_version;
/* this function is called when the client binds to this interface */
@@ -192,7 +192,7 @@ struct dcesrv_endpoint_server {
* ask for a dcesrv_interface implementation
* - iface must be reference to an already existing struct !
*/
- BOOL (*interface_by_uuid)(struct dcesrv_interface *iface, const char *, uint32_t);
+ BOOL (*interface_by_uuid)(struct dcesrv_interface *iface, const struct GUID *, uint32_t);
/* this function can be used by other endpoint servers to
* ask for a dcesrv_interface implementation
diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c
index d7d447f852..e7371a632f 100644
--- a/source4/rpc_server/epmapper/rpc_epmapper.c
+++ b/source4/rpc_server/epmapper/rpc_epmapper.c
@@ -77,7 +77,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
(*eps)[total].name = iface->iface.name;
description = d->ep_description;
- GUID_from_string(iface->iface.uuid, &description->object);
+ description->object = iface->iface.uuid;
description->object_version = iface->iface.if_version;
status = dcerpc_binding_build_tower(mem_ctx, description, &(*eps)[total].ep);
diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c
index b4f45614f1..4cd4b2b507 100644
--- a/source4/rpc_server/remote/dcesrv_remote.c
+++ b/source4/rpc_server/remote/dcesrv_remote.c
@@ -57,7 +57,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
pass = lp_parm_string(-1, "dcerpc_remote", "password");
domain = lp_parm_string(-1, "dceprc_remote", "domain");
- table = idl_iface_by_uuid(iface->uuid); /* FIXME: What about if_version ? */
+ table = idl_iface_by_uuid(&iface->uuid); /* FIXME: What about if_version ? */
if (!table) {
dce_call->fault_code = DCERPC_FAULT_UNK_IF;
return NT_STATUS_NET_WRITE_FAULT;
@@ -262,13 +262,13 @@ static BOOL remote_fill_interface(struct dcesrv_interface *iface, const struct d
return True;
}
-static BOOL remote_op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version)
+static BOOL remote_op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
{
const struct dcerpc_interface_list *l;
for (l=librpc_dcerpc_pipes();l;l=l->next) {
if (l->table->if_version == if_version &&
- strcmp(l->table->uuid, uuid)==0) {
+ GUID_equal(&l->table->uuid, uuid)==0) {
return remote_fill_interface(iface, l->table);
}
}