mirror of
https://github.com/samba-team/samba.git
synced 2025-12-02 00:23:50 +03:00
r12512: Use GUID structs in API functions everywhere rather then converting back and
forth between GUID structs and strings in several places.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
2188168209
commit
3564e2f967
@@ -262,7 +262,6 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp)
|
|||||||
int i;
|
int i;
|
||||||
struct dcerpc_pipe *p;
|
struct dcerpc_pipe *p;
|
||||||
TALLOC_CTX *tmp_ctx;
|
TALLOC_CTX *tmp_ctx;
|
||||||
const char *uuid;
|
|
||||||
struct dcom_object_exporter *ox;
|
struct dcom_object_exporter *ox;
|
||||||
|
|
||||||
ox = object_exporter_by_ip(iface->ctx, iface);
|
ox = object_exporter_by_ip(iface->ctx, iface);
|
||||||
@@ -273,8 +272,6 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp)
|
|||||||
|
|
||||||
iid = iface->vtable->iid;
|
iid = iface->vtable->iid;
|
||||||
|
|
||||||
uuid = GUID_string(tmp_ctx, &iid);
|
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
if (!GUID_equal(&p->syntax.uuid, &iid)) {
|
if (!GUID_equal(&p->syntax.uuid, &iid)) {
|
||||||
struct dcerpc_pipe *p2;
|
struct dcerpc_pipe *p2;
|
||||||
@@ -282,7 +279,7 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp)
|
|||||||
|
|
||||||
/* interface will always be present, so
|
/* interface will always be present, so
|
||||||
* idl_iface_by_uuid can't return NULL */
|
* idl_iface_by_uuid can't return NULL */
|
||||||
status = dcerpc_secondary_context(p, &p2, idl_iface_by_uuid(uuid));
|
status = dcerpc_secondary_context(p, &p2, idl_iface_by_uuid(&iid));
|
||||||
|
|
||||||
if (NT_STATUS_IS_OK(status)) {
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
p = p2;
|
p = p2;
|
||||||
@@ -303,7 +300,7 @@ NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp)
|
|||||||
DEBUG(1, ("Error parsing string binding"));
|
DEBUG(1, ("Error parsing string binding"));
|
||||||
} else {
|
} else {
|
||||||
status = dcerpc_pipe_connect_b(NULL, &p, binding,
|
status = dcerpc_pipe_connect_b(NULL, &p, binding,
|
||||||
idl_iface_by_uuid(uuid),
|
idl_iface_by_uuid(&iid),
|
||||||
iface->ctx->dcom->credentials,
|
iface->ctx->dcom->credentials,
|
||||||
iface->ctx->event_ctx);
|
iface->ctx->event_ctx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx,
|
|||||||
irpc->callnum = callnum;
|
irpc->callnum = callnum;
|
||||||
irpc->fn = fn;
|
irpc->fn = fn;
|
||||||
irpc->private = private;
|
irpc->private = private;
|
||||||
GUID_from_string(irpc->table->uuid, &irpc->uuid);
|
irpc->uuid = irpc->table->uuid;
|
||||||
|
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
@@ -689,8 +689,7 @@ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx,
|
|||||||
talloc_set_destructor(irpc, irpc_destructor);
|
talloc_set_destructor(irpc, irpc_destructor);
|
||||||
|
|
||||||
/* setup the header */
|
/* setup the header */
|
||||||
status = GUID_from_string(table->uuid, &header.uuid);
|
header.uuid = table->uuid;
|
||||||
if (!NT_STATUS_IS_OK(status)) goto failed;
|
|
||||||
|
|
||||||
header.if_version = table->if_version;
|
header.if_version = table->if_version;
|
||||||
header.callid = irpc->callid;
|
header.callid = irpc->callid;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "idl_types.h"
|
#include "idl_types.h"
|
||||||
|
|
||||||
[
|
[
|
||||||
uuid("1-2-3-4"),
|
|
||||||
version(0.0),
|
version(0.0),
|
||||||
pointer_default(unique),
|
pointer_default(unique),
|
||||||
depends(security,netlogon)
|
depends(security,netlogon)
|
||||||
|
|||||||
@@ -796,9 +796,7 @@ NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table,
|
|||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
status = GUID_from_string(table->uuid, &syntax->uuid);
|
syntax->uuid = table->uuid;
|
||||||
if (!NT_STATUS_IS_OK(status)) return status;
|
|
||||||
|
|
||||||
syntax->if_version = table->if_version;
|
syntax->if_version = table->if_version;
|
||||||
|
|
||||||
status = GUID_from_string(NDR_GUID, &transfer_syntax->uuid);
|
status = GUID_from_string(NDR_GUID, &transfer_syntax->uuid);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ struct dcerpc_authservice_list {
|
|||||||
|
|
||||||
struct dcerpc_interface_table {
|
struct dcerpc_interface_table {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *uuid;
|
struct GUID uuid;
|
||||||
uint32_t if_version;
|
uint32_t if_version;
|
||||||
const char *helpstring;
|
const char *helpstring;
|
||||||
uint32_t num_calls;
|
uint32_t num_calls;
|
||||||
|
|||||||
@@ -34,11 +34,11 @@
|
|||||||
/*
|
/*
|
||||||
find the pipe name for a local IDL interface
|
find the pipe name for a local IDL interface
|
||||||
*/
|
*/
|
||||||
const char *idl_pipe_name(const char *uuid, uint32_t if_version)
|
const char *idl_pipe_name(const struct GUID *uuid, uint32_t if_version)
|
||||||
{
|
{
|
||||||
const struct dcerpc_interface_list *l;
|
const struct dcerpc_interface_list *l;
|
||||||
for (l=librpc_dcerpc_pipes();l;l=l->next) {
|
for (l=librpc_dcerpc_pipes();l;l=l->next) {
|
||||||
if (strcasecmp(l->table->uuid, uuid) == 0 &&
|
if (GUID_equal(&l->table->uuid, uuid) &&
|
||||||
l->table->if_version == if_version) {
|
l->table->if_version == if_version) {
|
||||||
return l->table->name;
|
return l->table->name;
|
||||||
}
|
}
|
||||||
@@ -49,11 +49,11 @@ const char *idl_pipe_name(const char *uuid, uint32_t if_version)
|
|||||||
/*
|
/*
|
||||||
find the number of calls defined by local IDL
|
find the number of calls defined by local IDL
|
||||||
*/
|
*/
|
||||||
int idl_num_calls(const char *uuid, uint32_t if_version)
|
int idl_num_calls(const struct GUID *uuid, uint32_t if_version)
|
||||||
{
|
{
|
||||||
const struct dcerpc_interface_list *l;
|
const struct dcerpc_interface_list *l;
|
||||||
for (l=librpc_dcerpc_pipes();l;l=l->next){
|
for (l=librpc_dcerpc_pipes();l;l=l->next){
|
||||||
if (strcasecmp(l->table->uuid, uuid) == 0 &&
|
if (GUID_equal(&l->table->uuid, uuid) &&
|
||||||
l->table->if_version == if_version) {
|
l->table->if_version == if_version) {
|
||||||
return l->table->num_calls;
|
return l->table->num_calls;
|
||||||
}
|
}
|
||||||
@@ -79,11 +79,11 @@ const struct dcerpc_interface_table *idl_iface_by_name(const char *name)
|
|||||||
/*
|
/*
|
||||||
find a dcerpc interface by uuid
|
find a dcerpc interface by uuid
|
||||||
*/
|
*/
|
||||||
const struct dcerpc_interface_table *idl_iface_by_uuid(const char *uuid)
|
const struct dcerpc_interface_table *idl_iface_by_uuid(const struct GUID *uuid)
|
||||||
{
|
{
|
||||||
const struct dcerpc_interface_list *l;
|
const struct dcerpc_interface_list *l;
|
||||||
for (l=librpc_dcerpc_pipes();l;l=l->next) {
|
for (l=librpc_dcerpc_pipes();l;l=l->next) {
|
||||||
if (strcasecmp(l->table->uuid, uuid) == 0) {
|
if (GUID_equal(&l->table->uuid, uuid)) {
|
||||||
return l->table;
|
return l->table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -883,11 +883,7 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
|
|||||||
ZERO_STRUCT(handle);
|
ZERO_STRUCT(handle);
|
||||||
ZERO_STRUCT(guid);
|
ZERO_STRUCT(guid);
|
||||||
|
|
||||||
status = GUID_from_string(table->uuid, &binding->object);
|
binding->object = table->uuid;
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
binding->object_version = table->if_version;
|
binding->object_version = table->if_version;
|
||||||
|
|
||||||
status = dcerpc_binding_build_tower(p, binding, &twr.tower);
|
status = dcerpc_binding_build_tower(p, binding, &twr.tower);
|
||||||
@@ -998,7 +994,9 @@ NTSTATUS dcerpc_pipe_auth(struct dcerpc_pipe *p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
DEBUG(0,("Failed to bind to uuid %s - %s\n", table->uuid, nt_errstr(status)));
|
char *uuid_str = GUID_string(p, &table->uuid);
|
||||||
|
DEBUG(0,("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
|
||||||
|
talloc_free(uuid_str);
|
||||||
}
|
}
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return status;
|
return status;
|
||||||
@@ -1119,7 +1117,8 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
|
|||||||
p->conn->event_ctx);
|
p->conn->event_ctx);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
DEBUG(0,("Failed to map DCERPC endpoint for '%s' - %s\n",
|
DEBUG(0,("Failed to map DCERPC endpoint for '%s' - %s\n",
|
||||||
table->uuid, nt_errstr(status)));
|
GUID_string(tmp_ctx, &table->uuid), nt_errstr(status)));
|
||||||
|
talloc_free(tmp_ctx);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
DEBUG(2,("Mapped to DCERPC endpoint %s\n", binding->endpoint));
|
DEBUG(2,("Mapped to DCERPC endpoint %s\n", binding->endpoint));
|
||||||
@@ -1338,11 +1337,7 @@ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
|
|||||||
|
|
||||||
p2->context_id = ++p->conn->next_context_id;
|
p2->context_id = ++p->conn->next_context_id;
|
||||||
|
|
||||||
status = GUID_from_string(table->uuid, &p2->syntax.uuid);
|
p2->syntax.uuid = table->uuid;
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
talloc_free(p2);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
p2->syntax.if_version = table->if_version;
|
p2->syntax.if_version = table->if_version;
|
||||||
|
|
||||||
status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid);
|
status = GUID_from_string(NDR_GUID, &p2->transfer_syntax.uuid);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba4::NDR::Parser;
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Parse::Pidl::Typelist qw(hasType getType mapType);
|
use Parse::Pidl::Typelist qw(hasType getType mapType);
|
||||||
use Parse::Pidl::Util qw(has_property ParseExpr);
|
use Parse::Pidl::Util qw(has_property ParseExpr print_uuid);
|
||||||
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
|
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
|
||||||
|
|
||||||
use vars qw($VERSION);
|
use vars qw($VERSION);
|
||||||
@@ -2218,7 +2218,7 @@ sub FunctionTable($)
|
|||||||
|
|
||||||
pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {";
|
pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {";
|
||||||
pidl "\t.name\t\t= \"$interface->{NAME}\",";
|
pidl "\t.name\t\t= \"$interface->{NAME}\",";
|
||||||
pidl "\t.uuid\t\t= DCERPC_$uname\_UUID,";
|
pidl "\t.uuid\t\t= ". print_uuid($interface->{UUID}) .",";
|
||||||
pidl "\t.if_version\t= DCERPC_$uname\_VERSION,";
|
pidl "\t.if_version\t= DCERPC_$uname\_VERSION,";
|
||||||
pidl "\t.helpstring\t= DCERPC_$uname\_HELPSTRING,";
|
pidl "\t.helpstring\t= DCERPC_$uname\_HELPSTRING,";
|
||||||
pidl "\t.num_calls\t= $count,";
|
pidl "\t.num_calls\t= $count,";
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
package Parse::Pidl::Samba4::NDR::Server;
|
package Parse::Pidl::Samba4::NDR::Server;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use Parse::Pidl::Util;
|
||||||
|
|
||||||
use vars qw($VERSION);
|
use vars qw($VERSION);
|
||||||
$VERSION = '0.01';
|
$VERSION = '0.01';
|
||||||
@@ -76,7 +77,7 @@ sub Boilerplate_Iface($)
|
|||||||
my($interface) = shift;
|
my($interface) = shift;
|
||||||
my $name = $interface->{NAME};
|
my $name = $interface->{NAME};
|
||||||
my $uname = uc $name;
|
my $uname = uc $name;
|
||||||
my $uuid = Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid}));
|
my $uuid = lc($interface->{PROPERTIES}->{uuid});
|
||||||
my $if_version = $interface->{PROPERTIES}->{version};
|
my $if_version = $interface->{PROPERTIES}->{version};
|
||||||
|
|
||||||
pidl "
|
pidl "
|
||||||
@@ -187,7 +188,7 @@ static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_C
|
|||||||
|
|
||||||
static const struct dcesrv_interface $name\_interface = {
|
static const struct dcesrv_interface $name\_interface = {
|
||||||
.name = \"$name\",
|
.name = \"$name\",
|
||||||
.uuid = $uuid,
|
.uuid = ".print_uuid($uuid).",
|
||||||
.if_version = $if_version,
|
.if_version = $if_version,
|
||||||
.bind = $name\__op_bind,
|
.bind = $name\__op_bind,
|
||||||
.unbind = $name\__op_unbind,
|
.unbind = $name\__op_unbind,
|
||||||
@@ -227,10 +228,10 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str
|
|||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version)
|
static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
|
||||||
{
|
{
|
||||||
if ($name\_interface.if_version == if_version &&
|
if ($name\_interface.if_version == if_version &&
|
||||||
strcmp($name\_interface.uuid, uuid)==0) {
|
GUID_equal(\&$name\_interface.uuid, uuid)) {
|
||||||
memcpy(iface,&$name\_interface, sizeof(*iface));
|
memcpy(iface,&$name\_interface, sizeof(*iface));
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package Parse::Pidl::Util;
|
|||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
@ISA = qw(Exporter);
|
@ISA = qw(Exporter);
|
||||||
@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str);
|
@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str print_uuid);
|
||||||
use vars qw($VERSION);
|
use vars qw($VERSION);
|
||||||
$VERSION = '0.01';
|
$VERSION = '0.01';
|
||||||
|
|
||||||
@@ -75,6 +75,20 @@ sub make_str($)
|
|||||||
return "\"" . $str . "\"";
|
return "\"" . $str . "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub print_uuid($)
|
||||||
|
{
|
||||||
|
my ($uuid) = @_;
|
||||||
|
$uuid =~ s/"//g;
|
||||||
|
my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid;
|
||||||
|
|
||||||
|
my @clock_seq = $clock_seq =~ /(..)/g;
|
||||||
|
my @node = $node =~ /(..)/g;
|
||||||
|
|
||||||
|
return "{0x$time_low,0x$time_mid,0x$time_hi," .
|
||||||
|
"{".join(',', map {"0x$_"} @clock_seq)."}," .
|
||||||
|
"{".join(',', map {"0x$_"} @node)."}}";
|
||||||
|
}
|
||||||
|
|
||||||
# a hack to build on platforms that don't like negative enum values
|
# a hack to build on platforms that don't like negative enum values
|
||||||
my $useUintEnums = 0;
|
my $useUintEnums = 0;
|
||||||
sub setUseUintEnums($)
|
sub setUseUintEnums($)
|
||||||
|
|||||||
@@ -87,15 +87,8 @@ static struct dcesrv_connection_context *dcesrv_find_context(struct dcesrv_conne
|
|||||||
static BOOL interface_match(const struct dcesrv_interface *if1,
|
static BOOL interface_match(const struct dcesrv_interface *if1,
|
||||||
const struct dcesrv_interface *if2)
|
const struct dcesrv_interface *if2)
|
||||||
{
|
{
|
||||||
if (if1->if_version != if2->if_version) {
|
return (if1->if_version == if2->if_version &&
|
||||||
return False;
|
GUID_equal(&if1->uuid, &if2->uuid));
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(if1->uuid, if2->uuid)==0) {
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -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
|
see if a uuid and if_version match to an interface
|
||||||
*/
|
*/
|
||||||
static BOOL interface_match_by_uuid(const struct dcesrv_interface *iface,
|
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 (iface->if_version == if_version && GUID_equal(&iface->uuid, uuid));
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(iface->uuid, uuid)==0) {
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
|
|
||||||
return False;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
find the interface operations on an endpoint by uuid
|
find the interface operations on an endpoint by uuid
|
||||||
*/
|
*/
|
||||||
static const struct dcesrv_interface *find_interface_by_uuid(const struct dcesrv_endpoint *endpoint,
|
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;
|
struct dcesrv_if_list *ifl;
|
||||||
for (ifl=endpoint->interface_list; ifl; ifl=ifl->next) {
|
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)
|
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;
|
uint32_t if_version, transfer_syntax_version;
|
||||||
|
struct GUID uuid;
|
||||||
struct ncacn_packet pkt;
|
struct ncacn_packet pkt;
|
||||||
struct data_blob_list_item *rep;
|
struct data_blob_list_item *rep;
|
||||||
NTSTATUS status;
|
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;
|
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);
|
uuid = call->pkt.u.bind.ctx_list[0].abstract_syntax.uuid;
|
||||||
if (!uuid) {
|
|
||||||
return dcesrv_bind_nak(call, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
transfer_syntax_version = call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].if_version;
|
transfer_syntax_version = call->pkt.u.bind.ctx_list[0].transfer_syntaxes[0].if_version;
|
||||||
transfer_syntax = GUID_string(call,
|
transfer_syntax = GUID_string(call,
|
||||||
@@ -500,9 +483,12 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
|
|||||||
return dcesrv_bind_nak(call, 0);
|
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) {
|
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 */
|
/* we don't know about that interface */
|
||||||
result = DCERPC_BIND_PROVIDER_REJECT;
|
result = DCERPC_BIND_PROVIDER_REJECT;
|
||||||
reason = DCERPC_BIND_REASON_ASYNTAX;
|
reason = DCERPC_BIND_REASON_ASYNTAX;
|
||||||
@@ -567,8 +553,10 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
|
|||||||
if (iface) {
|
if (iface) {
|
||||||
status = iface->bind(call, iface);
|
status = iface->bind(call, iface);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
char *uuid_str = GUID_string(call, &uuid);
|
||||||
DEBUG(2,("Request for dcerpc interface %s/%d rejected: %s\n",
|
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);
|
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)
|
static NTSTATUS dcesrv_alter_new_context(struct dcesrv_call_state *call, uint32_t context_id)
|
||||||
{
|
{
|
||||||
uint32_t if_version, transfer_syntax_version;
|
uint32_t if_version, transfer_syntax_version;
|
||||||
const char *uuid, *transfer_syntax;
|
const char *transfer_syntax;
|
||||||
struct dcesrv_connection_context *context;
|
struct dcesrv_connection_context *context;
|
||||||
const struct dcesrv_interface *iface;
|
const struct dcesrv_interface *iface;
|
||||||
|
struct GUID uuid;
|
||||||
|
|
||||||
if_version = call->pkt.u.alter.ctx_list[0].abstract_syntax.if_version;
|
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);
|
uuid = call->pkt.u.alter.ctx_list[0].abstract_syntax.uuid;
|
||||||
if (!uuid) {
|
|
||||||
return NT_STATUS_NO_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
transfer_syntax_version = call->pkt.u.alter.ctx_list[0].transfer_syntaxes[0].if_version;
|
transfer_syntax_version = call->pkt.u.alter.ctx_list[0].transfer_syntaxes[0].if_version;
|
||||||
transfer_syntax = GUID_string(call,
|
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;
|
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) {
|
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;
|
return NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ struct dcesrv_auth;
|
|||||||
|
|
||||||
struct dcesrv_interface {
|
struct dcesrv_interface {
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *uuid;
|
struct GUID uuid;
|
||||||
uint32_t if_version;
|
uint32_t if_version;
|
||||||
|
|
||||||
/* this function is called when the client binds to this interface */
|
/* 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
|
* ask for a dcesrv_interface implementation
|
||||||
* - iface must be reference to an already existing struct !
|
* - 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
|
/* this function can be used by other endpoint servers to
|
||||||
* ask for a dcesrv_interface implementation
|
* ask for a dcesrv_interface implementation
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
|
|||||||
(*eps)[total].name = iface->iface.name;
|
(*eps)[total].name = iface->iface.name;
|
||||||
|
|
||||||
description = d->ep_description;
|
description = d->ep_description;
|
||||||
GUID_from_string(iface->iface.uuid, &description->object);
|
description->object = iface->iface.uuid;
|
||||||
description->object_version = iface->iface.if_version;
|
description->object_version = iface->iface.if_version;
|
||||||
|
|
||||||
status = dcerpc_binding_build_tower(mem_ctx, description, &(*eps)[total].ep);
|
status = dcerpc_binding_build_tower(mem_ctx, description, &(*eps)[total].ep);
|
||||||
|
|||||||
@@ -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");
|
pass = lp_parm_string(-1, "dcerpc_remote", "password");
|
||||||
domain = lp_parm_string(-1, "dceprc_remote", "domain");
|
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) {
|
if (!table) {
|
||||||
dce_call->fault_code = DCERPC_FAULT_UNK_IF;
|
dce_call->fault_code = DCERPC_FAULT_UNK_IF;
|
||||||
return NT_STATUS_NET_WRITE_FAULT;
|
return NT_STATUS_NET_WRITE_FAULT;
|
||||||
@@ -262,13 +262,13 @@ static BOOL remote_fill_interface(struct dcesrv_interface *iface, const struct d
|
|||||||
return True;
|
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;
|
const struct dcerpc_interface_list *l;
|
||||||
|
|
||||||
for (l=librpc_dcerpc_pipes();l;l=l->next) {
|
for (l=librpc_dcerpc_pipes();l;l=l->next) {
|
||||||
if (l->table->if_version == if_version &&
|
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);
|
return remote_fill_interface(iface, l->table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ BOOL torture_multi_bind(void)
|
|||||||
|
|
||||||
if (NT_STATUS_IS_OK(status)) {
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
printf("(incorrectly) allowed re-bind to uuid %s - %s\n",
|
printf("(incorrectly) allowed re-bind to uuid %s - %s\n",
|
||||||
dcerpc_table_lsarpc.uuid, nt_errstr(status));
|
GUID_string(mem_ctx, &dcerpc_table_lsarpc.uuid), nt_errstr(status));
|
||||||
ret = False;
|
ret = False;
|
||||||
} else {
|
} else {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
struct epm_Map r;
|
struct epm_Map r;
|
||||||
struct GUID uuid;
|
struct GUID uuid;
|
||||||
const char *uuid_str;
|
|
||||||
struct policy_handle handle;
|
struct policy_handle handle;
|
||||||
int i;
|
int i;
|
||||||
struct GUID if_uuid;
|
struct GUID if_uuid;
|
||||||
@@ -60,10 +59,9 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
r.in.max_towers = 100;
|
r.in.max_towers = 100;
|
||||||
|
|
||||||
dcerpc_floor_get_lhs_data(&twr->tower.floors[0], &if_uuid, &if_version);
|
dcerpc_floor_get_lhs_data(&twr->tower.floors[0], &if_uuid, &if_version);
|
||||||
uuid_str = GUID_string(mem_ctx, &if_uuid);
|
|
||||||
|
|
||||||
printf("epm_Map results for '%s':\n",
|
printf("epm_Map results for '%s':\n",
|
||||||
idl_pipe_name(uuid_str, if_version));
|
idl_pipe_name(&if_uuid, if_version));
|
||||||
|
|
||||||
twr->tower.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN;
|
twr->tower.floors[2].lhs.protocol = EPM_PROTOCOL_NCACN;
|
||||||
twr->tower.floors[2].lhs.lhs_data = data_blob(NULL, 0);
|
twr->tower.floors[2].lhs.lhs_data = data_blob(NULL, 0);
|
||||||
|
|||||||
@@ -50,15 +50,12 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<r.out.if_id_vector->count;i++) {
|
for (i=0;i<r.out.if_id_vector->count;i++) {
|
||||||
const char *uuid;
|
|
||||||
struct dcerpc_syntax_id *id = r.out.if_id_vector->if_id[i].id;
|
struct dcerpc_syntax_id *id = r.out.if_id_vector->if_id[i].id;
|
||||||
if (!id) continue;
|
if (!id) continue;
|
||||||
|
|
||||||
uuid = GUID_string(mem_ctx, &id->uuid);
|
|
||||||
|
|
||||||
printf("\tuuid %s version 0x%08x '%s'\n",
|
printf("\tuuid %s version 0x%08x '%s'\n",
|
||||||
uuid,
|
GUID_string(mem_ctx, &id->uuid),
|
||||||
id->if_version, idl_pipe_name(uuid, id->if_version));
|
id->if_version, idl_pipe_name(&id->uuid, id->if_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
@@ -212,8 +209,9 @@ BOOL torture_rpc_mgmt(void)
|
|||||||
if (b->transport == NCACN_IP_TCP) {
|
if (b->transport == NCACN_IP_TCP) {
|
||||||
status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL);
|
status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
printf("Failed to map port for uuid %s\n",
|
||||||
|
GUID_string(loop_ctx, &l->table->uuid));
|
||||||
talloc_free(loop_ctx);
|
talloc_free(loop_ctx);
|
||||||
printf("Failed to map port for uuid %s\n", l->table->uuid);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface,
|
|||||||
{
|
{
|
||||||
struct dcerpc_pipe *p;
|
struct dcerpc_pipe *p;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
const char *uuid;
|
|
||||||
int i;
|
int i;
|
||||||
DATA_BLOB stub_in, stub_out;
|
DATA_BLOB stub_in, stub_out;
|
||||||
int idl_calls;
|
int idl_calls;
|
||||||
@@ -41,14 +40,15 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface,
|
|||||||
/* FIXME: This should be fixed when torture_rpc_connection
|
/* FIXME: This should be fixed when torture_rpc_connection
|
||||||
* takes a dcerpc_syntax_id */
|
* takes a dcerpc_syntax_id */
|
||||||
tbl.name = iface->name;
|
tbl.name = iface->name;
|
||||||
tbl.uuid = GUID_string(mem_ctx, &id->uuid);
|
tbl.uuid = id->uuid;
|
||||||
tbl.if_version = id->if_version;
|
tbl.if_version = id->if_version;
|
||||||
|
|
||||||
status = torture_rpc_connection(mem_ctx,
|
status = torture_rpc_connection(mem_ctx, &p, iface);
|
||||||
&p, iface);
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
char *uuid_str = GUID_string(mem_ctx, &id->uuid);
|
||||||
printf("Failed to connect to '%s' on '%s' - %s\n",
|
printf("Failed to connect to '%s' on '%s' - %s\n",
|
||||||
uuid, iface->name, nt_errstr(status));
|
uuid_str, iface->name, nt_errstr(status));
|
||||||
|
talloc_free(uuid_str);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("\t%d calls available\n", i);
|
printf("\t%d calls available\n", i);
|
||||||
idl_calls = idl_num_calls(uuid, id->if_version);
|
idl_calls = idl_num_calls(&id->uuid, id->if_version);
|
||||||
if (idl_calls == -1) {
|
if (idl_calls == -1) {
|
||||||
printf("\tinterface not known in local IDL\n");
|
printf("\tinterface not known in local IDL\n");
|
||||||
} else if (i != idl_calls) {
|
} else if (i != idl_calls) {
|
||||||
@@ -125,7 +125,8 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p,
|
|||||||
|
|
||||||
printf("\n\tuuid %s version 0x%08x '%s'\n",
|
printf("\n\tuuid %s version 0x%08x '%s'\n",
|
||||||
uuid,
|
uuid,
|
||||||
id->if_version, idl_pipe_name(uuid, id->if_version));
|
id->if_version, idl_pipe_name(&id->uuid, id->if_version));
|
||||||
|
|
||||||
test_num_calls(iface, mem_ctx, id);
|
test_num_calls(iface, mem_ctx, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,8 +173,9 @@ BOOL torture_rpc_scanner(void)
|
|||||||
if (b->transport == NCACN_IP_TCP) {
|
if (b->transport == NCACN_IP_TCP) {
|
||||||
status = dcerpc_epm_map_binding(mem_ctx, b, l->table, NULL);
|
status = dcerpc_epm_map_binding(mem_ctx, b, l->table, NULL);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
printf("Failed to map port for uuid %s\n",
|
||||||
|
GUID_string(loop_ctx, &l->table->uuid));
|
||||||
talloc_free(loop_ctx);
|
talloc_free(loop_ctx);
|
||||||
printf("Failed to map port for uuid %s\n", l->table->uuid);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -148,8 +148,13 @@ static char *stdin_load(TALLOC_CTX *mem_ctx, size_t *size)
|
|||||||
p = idl_iface_by_name(pipe_name);
|
p = idl_iface_by_name(pipe_name);
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
|
struct GUID uuid;
|
||||||
|
|
||||||
p = idl_iface_by_uuid(pipe_name);
|
status = GUID_from_string(pipe_name, &uuid);
|
||||||
|
|
||||||
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
|
p = idl_iface_by_uuid(&uuid);
|
||||||
|
}
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
printf("Unknown pipe or UUID '%s'\n", pipe_name);
|
printf("Unknown pipe or UUID '%s'\n", pipe_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user