mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r14735: Use dcerpc_syntax_id rather then seperate GUID + if_version everywhere
This commit is contained in:
parent
b9a90ed763
commit
a316b33057
@ -97,14 +97,13 @@ static void add_epm_entry(TALLOC_CTX *mem_ctx, const char *annotation, struct ep
|
|||||||
|
|
||||||
for (i = 0; i < t->num_floors; i++) {
|
for (i = 0; i < t->num_floors; i++) {
|
||||||
const char *data;
|
const char *data;
|
||||||
struct GUID if_uuid;
|
struct dcerpc_syntax_id syntax;
|
||||||
uint16_t if_version;
|
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gtk_tree_store_append(store_eps, &iter, &toweriter);
|
gtk_tree_store_append(store_eps, &iter, &toweriter);
|
||||||
|
|
||||||
dcerpc_floor_get_lhs_data(&t->floors[i], &if_uuid, &if_version);
|
dcerpc_floor_get_lhs_data(&t->floors[i], &syntax);
|
||||||
if (t->floors[i].lhs.protocol == EPM_PROTOCOL_UUID) {
|
if (t->floors[i].lhs.protocol == EPM_PROTOCOL_UUID) {
|
||||||
data = GUID_string(mem_ctx, &if_uuid);
|
data = GUID_string(mem_ctx, &syntax.uuid);
|
||||||
} else {
|
} else {
|
||||||
data = dcerpc_floor_get_rhs_data(mem_ctx, &t->floors[i]);
|
data = dcerpc_floor_get_rhs_data(mem_ctx, &t->floors[i]);
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,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;
|
||||||
irpc->uuid = irpc->table->uuid;
|
irpc->uuid = irpc->table->syntax_id.uuid;
|
||||||
|
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ static void irpc_handler_request(struct messaging_context *msg_ctx,
|
|||||||
|
|
||||||
for (i=msg_ctx->irpc; i; i=i->next) {
|
for (i=msg_ctx->irpc; i; i=i->next) {
|
||||||
if (GUID_equal(&i->uuid, &m->header.uuid) &&
|
if (GUID_equal(&i->uuid, &m->header.uuid) &&
|
||||||
i->table->if_version == m->header.if_version &&
|
i->table->syntax_id.if_version == m->header.if_version &&
|
||||||
i->callnum == m->header.callnum) {
|
i->callnum == m->header.callnum) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -717,9 +717,9 @@ 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 */
|
||||||
header.uuid = table->uuid;
|
header.uuid = table->syntax_id.uuid;
|
||||||
|
|
||||||
header.if_version = table->if_version;
|
header.if_version = table->syntax_id.if_version;
|
||||||
header.callid = irpc->callid;
|
header.callid = irpc->callid;
|
||||||
header.callnum = callnum;
|
header.callnum = callnum;
|
||||||
header.flags = 0;
|
header.flags = 0;
|
||||||
|
@ -780,8 +780,8 @@ NTSTATUS dcerpc_init_syntaxes(const struct dcerpc_interface_table *table,
|
|||||||
struct dcerpc_syntax_id *syntax,
|
struct dcerpc_syntax_id *syntax,
|
||||||
struct dcerpc_syntax_id *transfer_syntax)
|
struct dcerpc_syntax_id *transfer_syntax)
|
||||||
{
|
{
|
||||||
syntax->uuid = table->uuid;
|
syntax->uuid = table->syntax_id.uuid;
|
||||||
syntax->if_version = table->if_version;
|
syntax->if_version = table->syntax_id.if_version;
|
||||||
|
|
||||||
*transfer_syntax = ndr_transfer_syntax;
|
*transfer_syntax = ndr_transfer_syntax;
|
||||||
|
|
||||||
|
@ -178,8 +178,7 @@ struct dcerpc_authservice_list {
|
|||||||
|
|
||||||
struct dcerpc_interface_table {
|
struct dcerpc_interface_table {
|
||||||
const char *name;
|
const char *name;
|
||||||
struct GUID uuid;
|
struct dcerpc_syntax_id syntax_id;
|
||||||
uint32_t if_version;
|
|
||||||
const char *helpstring;
|
const char *helpstring;
|
||||||
uint32_t num_calls;
|
uint32_t num_calls;
|
||||||
const struct dcerpc_interface_call *calls;
|
const struct dcerpc_interface_call *calls;
|
||||||
@ -195,8 +194,7 @@ struct dcerpc_interface_list {
|
|||||||
/* this describes a binding to a particular transport/pipe */
|
/* this describes a binding to a particular transport/pipe */
|
||||||
struct dcerpc_binding {
|
struct dcerpc_binding {
|
||||||
enum dcerpc_transport_t transport;
|
enum dcerpc_transport_t transport;
|
||||||
struct GUID object;
|
struct dcerpc_syntax_id object;
|
||||||
uint16_t object_version;
|
|
||||||
const char *host;
|
const char *host;
|
||||||
const char *endpoint;
|
const char *endpoint;
|
||||||
const char **options;
|
const char **options;
|
||||||
|
@ -151,28 +151,27 @@ static const struct {
|
|||||||
|
|
||||||
const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
|
const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
|
||||||
{
|
{
|
||||||
struct GUID uuid;
|
struct dcerpc_syntax_id syntax;
|
||||||
uint16_t if_version;
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
switch(epm_floor->lhs.protocol) {
|
switch(epm_floor->lhs.protocol) {
|
||||||
case EPM_PROTOCOL_UUID:
|
case EPM_PROTOCOL_UUID:
|
||||||
status = dcerpc_floor_get_lhs_data(epm_floor, &uuid, &if_version);
|
status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
|
||||||
if (NT_STATUS_IS_OK(status)) {
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
/* lhs is used: UUID */
|
/* lhs is used: UUID */
|
||||||
char *uuidstr;
|
char *uuidstr;
|
||||||
|
|
||||||
if (GUID_equal(&uuid, &ndr_transfer_syntax.uuid)) {
|
if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
|
||||||
return "NDR";
|
return "NDR";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GUID_equal(&uuid, &ndr64_transfer_syntax.uuid)) {
|
if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
|
||||||
return "NDR64";
|
return "NDR64";
|
||||||
}
|
}
|
||||||
|
|
||||||
uuidstr = GUID_string(mem_ctx, &uuid);
|
uuidstr = GUID_string(mem_ctx, &syntax.uuid);
|
||||||
|
|
||||||
return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, if_version);
|
return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
|
||||||
} else { /* IPX */
|
} else { /* IPX */
|
||||||
return talloc_asprintf(mem_ctx, "IPX:%s",
|
return talloc_asprintf(mem_ctx, "IPX:%s",
|
||||||
data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
|
data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
|
||||||
@ -247,9 +246,9 @@ const char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_bindi
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GUID_all_zero(&b->object)) {
|
if (!GUID_all_zero(&b->object.uuid)) {
|
||||||
s = talloc_asprintf(s, "%s@",
|
s = talloc_asprintf(s, "%s@",
|
||||||
GUID_string(mem_ctx, &b->object));
|
GUID_string(mem_ctx, &b->object.uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
s = talloc_asprintf_append(s, "%s:", t_name);
|
s = talloc_asprintf_append(s, "%s:", t_name);
|
||||||
@ -309,7 +308,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
|
|||||||
if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
|
if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
status = GUID_from_string(s, &b->object);
|
status = GUID_from_string(s, &b->object.uuid);
|
||||||
|
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
DEBUG(0, ("Failed parsing UUID\n"));
|
DEBUG(0, ("Failed parsing UUID\n"));
|
||||||
@ -321,7 +320,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
|
|||||||
ZERO_STRUCT(b->object);
|
ZERO_STRUCT(b->object);
|
||||||
}
|
}
|
||||||
|
|
||||||
b->object_version = 0;
|
b->object.if_version = 0;
|
||||||
|
|
||||||
p = strchr(s, ':');
|
p = strchr(s, ':');
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@ -421,7 +420,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
|
|||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct GUID *uuid, uint16_t *if_version)
|
NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct dcerpc_syntax_id *syntax)
|
||||||
{
|
{
|
||||||
TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
|
TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
|
||||||
struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
|
struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
|
||||||
@ -429,27 +428,27 @@ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct GUID *uui
|
|||||||
|
|
||||||
ndr->flags |= LIBNDR_FLAG_NOALIGN;
|
ndr->flags |= LIBNDR_FLAG_NOALIGN;
|
||||||
|
|
||||||
status = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, uuid);
|
status = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
talloc_free(mem_ctx);
|
talloc_free(mem_ctx);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = ndr_pull_uint16(ndr, NDR_SCALARS, if_version);
|
status = ndr_pull_uint16(ndr, NDR_SCALARS, &syntax->if_version);
|
||||||
|
|
||||||
talloc_free(mem_ctx);
|
talloc_free(mem_ctx);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct GUID *uuid, uint32_t if_version)
|
static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct dcerpc_syntax_id *syntax)
|
||||||
{
|
{
|
||||||
struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
|
struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
|
||||||
|
|
||||||
ndr->flags |= LIBNDR_FLAG_NOALIGN;
|
ndr->flags |= LIBNDR_FLAG_NOALIGN;
|
||||||
|
|
||||||
ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, uuid);
|
ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
|
||||||
ndr_push_uint16(ndr, NDR_SCALARS, if_version);
|
ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
|
||||||
|
|
||||||
return ndr_push_blob(ndr);
|
return ndr_push_blob(ndr);
|
||||||
}
|
}
|
||||||
@ -658,7 +657,7 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set object uuid */
|
/* Set object uuid */
|
||||||
status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object, &binding->object_version);
|
status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
|
||||||
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
|
DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
|
||||||
@ -710,7 +709,7 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *
|
|||||||
/* Floor 0 */
|
/* Floor 0 */
|
||||||
tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
|
tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
|
||||||
|
|
||||||
tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object, binding->object_version);
|
tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
|
||||||
|
|
||||||
tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
|
tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
|
||||||
|
|
||||||
@ -718,8 +717,7 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *
|
|||||||
tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
|
tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
|
||||||
|
|
||||||
tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
|
tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
|
||||||
&ndr_transfer_syntax.uuid,
|
&ndr_transfer_syntax);
|
||||||
ndr_transfer_syntax.if_version);
|
|
||||||
|
|
||||||
tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
|
tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
|
||||||
|
|
||||||
@ -796,8 +794,7 @@ static void continue_epm_recv_binding(struct composite_context *ctx)
|
|||||||
if (!composite_is_ok(c)) return;
|
if (!composite_is_ok(c)) return;
|
||||||
|
|
||||||
/* prepare requested binding parameters */
|
/* prepare requested binding parameters */
|
||||||
s->binding->object = s->table->uuid;
|
s->binding->object = s->table->syntax_id;
|
||||||
s->binding->object_version = s->table->if_version;
|
|
||||||
|
|
||||||
c->status = dcerpc_binding_build_tower(s->pipe, s->binding, &s->twr.tower);
|
c->status = dcerpc_binding_build_tower(s->pipe, s->binding, &s->twr.tower);
|
||||||
if (!composite_is_ok(c)) return;
|
if (!composite_is_ok(c)) return;
|
||||||
@ -1147,7 +1144,7 @@ NTSTATUS dcerpc_pipe_auth_recv(struct composite_context *c)
|
|||||||
struct pipe_auth_state);
|
struct pipe_auth_state);
|
||||||
status = composite_wait(c);
|
status = composite_wait(c);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
char *uuid_str = GUID_string(s->pipe, &s->table->uuid);
|
char *uuid_str = GUID_string(s->pipe, &s->table->syntax_id.uuid);
|
||||||
DEBUG(0, ("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
|
DEBUG(0, ("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
|
||||||
talloc_free(uuid_str);
|
talloc_free(uuid_str);
|
||||||
}
|
}
|
||||||
@ -1247,8 +1244,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;
|
||||||
|
|
||||||
p2->syntax.uuid = table->uuid;
|
p2->syntax = table->syntax_id;
|
||||||
p2->syntax.if_version = table->if_version;
|
|
||||||
|
|
||||||
p2->transfer_syntax = ndr_transfer_syntax;
|
p2->transfer_syntax = ndr_transfer_syntax;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ NTSTATUS librpc_register_interface(const struct dcerpc_interface_table *interfac
|
|||||||
struct dcerpc_interface_list *l;
|
struct dcerpc_interface_list *l;
|
||||||
|
|
||||||
for (l = dcerpc_pipes; l; l = l->next) {
|
for (l = dcerpc_pipes; l; l = l->next) {
|
||||||
if (GUID_equal(&interface->uuid, &l->table->uuid)) {
|
if (GUID_equal(&interface->syntax_id.uuid, &l->table->syntax_id.uuid)) {
|
||||||
DEBUG(0, ("Attempt to register interface %s which has the "
|
DEBUG(0, ("Attempt to register interface %s which has the "
|
||||||
"same UUID as already registered interface %s\n",
|
"same UUID as already registered interface %s\n",
|
||||||
interface->name, l->table->name));
|
interface->name, l->table->name));
|
||||||
@ -59,8 +59,8 @@ 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 (GUID_equal(&l->table->uuid, uuid) &&
|
if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
|
||||||
l->table->if_version == if_version) {
|
l->table->syntax_id.if_version == if_version) {
|
||||||
return l->table->name;
|
return l->table->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,8 +74,8 @@ 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 (GUID_equal(&l->table->uuid, uuid) &&
|
if (GUID_equal(&l->table->syntax_id.uuid, uuid) &&
|
||||||
l->table->if_version == if_version) {
|
l->table->syntax_id.if_version == if_version) {
|
||||||
return l->table->num_calls;
|
return l->table->num_calls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ 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 (GUID_equal(&l->table->uuid, uuid)) {
|
if (GUID_equal(&l->table->syntax_id.uuid, uuid)) {
|
||||||
return l->table;
|
return l->table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2200,8 +2200,10 @@ 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= ". print_uuid($interface->{UUID}) .",";
|
pidl "\t.syntax_id\t= {";
|
||||||
pidl "\t.if_version\t= DCERPC_$uname\_VERSION,";
|
pidl "\t\t" . print_uuid($interface->{UUID}) .",";
|
||||||
|
pidl "\t\tDCERPC_$uname\_VERSION";
|
||||||
|
pidl "\t},";
|
||||||
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,";
|
||||||
pidl "\t.calls\t\t= $interface->{NAME}\_calls,";
|
pidl "\t.calls\t\t= $interface->{NAME}\_calls,";
|
||||||
|
@ -188,8 +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 = ".print_uuid($uuid).",
|
.syntax_id = {".print_uuid($uuid).",$if_version},
|
||||||
.if_version = $if_version,
|
|
||||||
.bind = $name\__op_bind,
|
.bind = $name\__op_bind,
|
||||||
.unbind = $name\__op_unbind,
|
.unbind = $name\__op_unbind,
|
||||||
.ndr_pull = $name\__op_ndr_pull,
|
.ndr_pull = $name\__op_ndr_pull,
|
||||||
@ -230,8 +229,8 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str
|
|||||||
|
|
||||||
static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *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.syntax_id.if_version == if_version &&
|
||||||
GUID_equal(\&$name\_interface.uuid, uuid)) {
|
GUID_equal(\&$name\_interface.syntax_id.uuid, uuid)) {
|
||||||
memcpy(iface,&$name\_interface, sizeof(*iface));
|
memcpy(iface,&$name\_interface, sizeof(*iface));
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,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)
|
||||||
{
|
{
|
||||||
return (if1->if_version == if2->if_version &&
|
return (if1->syntax_id.if_version == if2->syntax_id.if_version &&
|
||||||
GUID_equal(&if1->uuid, &if2->uuid));
|
GUID_equal(&if1->syntax_id.uuid, &if2->syntax_id.uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -113,7 +113,8 @@ static const struct dcesrv_interface *find_interface(const struct dcesrv_endpoin
|
|||||||
static BOOL interface_match_by_uuid(const struct dcesrv_interface *iface,
|
static BOOL interface_match_by_uuid(const struct dcesrv_interface *iface,
|
||||||
const struct GUID *uuid, uint32_t if_version)
|
const struct GUID *uuid, uint32_t if_version)
|
||||||
{
|
{
|
||||||
return (iface->if_version == if_version && GUID_equal(&iface->uuid, uuid));
|
return (iface->syntax_id.if_version == if_version &&
|
||||||
|
GUID_equal(&iface->syntax_id.uuid, uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,8 +43,7 @@ struct dcesrv_connection_context;
|
|||||||
|
|
||||||
struct dcesrv_interface {
|
struct dcesrv_interface {
|
||||||
const char *name;
|
const char *name;
|
||||||
struct GUID uuid;
|
struct dcerpc_syntax_id syntax_id;
|
||||||
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 */
|
||||||
NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *);
|
NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *);
|
||||||
|
@ -65,8 +65,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;
|
||||||
description->object = iface->iface.uuid;
|
description->object = iface->iface.syntax_id;
|
||||||
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);
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
@ -175,8 +174,7 @@ static error_status_t epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
|
|||||||
struct dcesrv_ep_iface *eps;
|
struct dcesrv_ep_iface *eps;
|
||||||
struct epm_floor *floors;
|
struct epm_floor *floors;
|
||||||
enum dcerpc_transport_t transport;
|
enum dcerpc_transport_t transport;
|
||||||
struct GUID ndr_uuid;
|
struct dcerpc_syntax_id ndr_syntax;
|
||||||
uint16_t ndr_version;
|
|
||||||
|
|
||||||
count = build_ep_list(mem_ctx, dce_call->conn->dce_ctx->endpoint_list, &eps);
|
count = build_ep_list(mem_ctx, dce_call->conn->dce_ctx->endpoint_list, &eps);
|
||||||
|
|
||||||
@ -198,11 +196,11 @@ static error_status_t epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
|
|||||||
|
|
||||||
floors = r->in.map_tower->tower.floors;
|
floors = r->in.map_tower->tower.floors;
|
||||||
|
|
||||||
dcerpc_floor_get_lhs_data(&r->in.map_tower->tower.floors[1], &ndr_uuid, &ndr_version);
|
dcerpc_floor_get_lhs_data(&r->in.map_tower->tower.floors[1], &ndr_syntax);
|
||||||
|
|
||||||
if (floors[1].lhs.protocol != EPM_PROTOCOL_UUID ||
|
if (floors[1].lhs.protocol != EPM_PROTOCOL_UUID ||
|
||||||
!GUID_equal(&ndr_uuid, &ndr_transfer_syntax.uuid) ||
|
!GUID_equal(&ndr_syntax.uuid, &ndr_transfer_syntax.uuid) ||
|
||||||
ndr_version != ndr_transfer_syntax.if_version) {
|
ndr_syntax.if_version != ndr_transfer_syntax.if_version) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,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->syntax_id.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;
|
||||||
@ -248,8 +248,7 @@ static NTSTATUS remote_op_init_server(struct dcesrv_context *dce_ctx, const stru
|
|||||||
static BOOL remote_fill_interface(struct dcesrv_interface *iface, const struct dcerpc_interface_table *if_tabl)
|
static BOOL remote_fill_interface(struct dcesrv_interface *iface, const struct dcerpc_interface_table *if_tabl)
|
||||||
{
|
{
|
||||||
iface->name = if_tabl->name;
|
iface->name = if_tabl->name;
|
||||||
iface->uuid = if_tabl->uuid;
|
iface->syntax_id = if_tabl->syntax_id;
|
||||||
iface->if_version = if_tabl->if_version;
|
|
||||||
|
|
||||||
iface->bind = remote_op_bind;
|
iface->bind = remote_op_bind;
|
||||||
iface->unbind = remote_op_unbind;
|
iface->unbind = remote_op_unbind;
|
||||||
@ -268,8 +267,8 @@ static BOOL remote_op_interface_by_uuid(struct dcesrv_interface *iface, const st
|
|||||||
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->syntax_id.if_version == if_version &&
|
||||||
GUID_equal(&l->table->uuid, uuid)==0) {
|
GUID_equal(&l->table->syntax_id.uuid, uuid)==0) {
|
||||||
return remote_fill_interface(iface, l->table);
|
return remote_fill_interface(iface, l->table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ static BOOL test_readwrite(TALLOC_CTX *mem_ctx, const char *host)
|
|||||||
com_init_ctx(&ctx, NULL);
|
com_init_ctx(&ctx, NULL);
|
||||||
dcom_client_init(ctx, cmdline_credentials);
|
dcom_client_init(ctx, cmdline_credentials);
|
||||||
|
|
||||||
IID[0] = dcerpc_table_IStream.uuid;
|
IID[0] = dcerpc_table_IStream.syntax_id.uuid;
|
||||||
IID[1] = dcerpc_table_IUnknown.uuid;
|
IID[1] = dcerpc_table_IUnknown.syntax_id.uuid;
|
||||||
GUID_from_string(CLSID_SIMPLE, &clsid);
|
GUID_from_string(CLSID_SIMPLE, &clsid);
|
||||||
|
|
||||||
if (host) {
|
if (host) {
|
||||||
|
@ -60,7 +60,7 @@ BOOL torture_rpc_alter_context(struct torture_context *torture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmptbl = dcerpc_table_dssetup;
|
tmptbl = dcerpc_table_dssetup;
|
||||||
tmptbl.if_version += 100;
|
tmptbl.syntax_id.if_version += 100;
|
||||||
printf("Opening bad secondary connection\n");
|
printf("Opening bad secondary connection\n");
|
||||||
status = dcerpc_secondary_context(p, &p2, &tmptbl);
|
status = dcerpc_secondary_context(p, &p2, &tmptbl);
|
||||||
if (NT_STATUS_IS_OK(status)) {
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
|
@ -67,7 +67,7 @@ BOOL torture_multi_bind(struct torture_context *torture)
|
|||||||
|
|
||||||
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",
|
||||||
GUID_string(mem_ctx, &dcerpc_table_lsarpc.uuid), nt_errstr(status));
|
GUID_string(mem_ctx, &dcerpc_table_lsarpc.syntax_id.uuid), nt_errstr(status));
|
||||||
ret = False;
|
ret = False;
|
||||||
} else {
|
} else {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -48,8 +48,7 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
struct GUID uuid;
|
struct GUID uuid;
|
||||||
struct policy_handle handle;
|
struct policy_handle handle;
|
||||||
int i;
|
int i;
|
||||||
struct GUID if_uuid;
|
struct dcerpc_syntax_id syntax;
|
||||||
uint16_t if_version;
|
|
||||||
|
|
||||||
ZERO_STRUCT(uuid);
|
ZERO_STRUCT(uuid);
|
||||||
ZERO_STRUCT(handle);
|
ZERO_STRUCT(handle);
|
||||||
@ -60,10 +59,10 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
r.out.entry_handle = &handle;
|
r.out.entry_handle = &handle;
|
||||||
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], &syntax);
|
||||||
|
|
||||||
printf("epm_Map results for '%s':\n",
|
printf("epm_Map results for '%s':\n",
|
||||||
idl_pipe_name(&if_uuid, if_version));
|
idl_pipe_name(&syntax.uuid, syntax.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);
|
||||||
@ -261,7 +260,7 @@ static BOOL test_InqObject(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
|
|||||||
struct epm_InqObject r;
|
struct epm_InqObject r;
|
||||||
|
|
||||||
r.in.epm_object = talloc(mem_ctx, struct GUID);
|
r.in.epm_object = talloc(mem_ctx, struct GUID);
|
||||||
*r.in.epm_object = dcerpc_table_epmapper.uuid;
|
*r.in.epm_object = dcerpc_table_epmapper.syntax_id.uuid;
|
||||||
|
|
||||||
status = dcerpc_epm_InqObject(p, mem_ctx, &r);
|
status = dcerpc_epm_InqObject(p, mem_ctx, &r);
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
|
@ -214,7 +214,7 @@ BOOL torture_rpc_mgmt(struct torture_context *torture)
|
|||||||
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",
|
printf("Failed to map port for uuid %s\n",
|
||||||
GUID_string(loop_ctx, &l->table->uuid));
|
GUID_string(loop_ctx, &l->table->syntax_id.uuid));
|
||||||
talloc_free(loop_ctx);
|
talloc_free(loop_ctx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uin
|
|||||||
r.in.num_protseqs = 3;
|
r.in.num_protseqs = 3;
|
||||||
r.in.protseq = protseq;
|
r.in.protseq = protseq;
|
||||||
r.in.Interfaces = 1;
|
r.in.Interfaces = 1;
|
||||||
iids[0] = dcerpc_table_IUnknown.uuid;
|
iids[0] = dcerpc_table_IUnknown.syntax_id.uuid;
|
||||||
r.in.pIIDs = iids;
|
r.in.pIIDs = iids;
|
||||||
|
|
||||||
status = dcerpc_RemoteActivation(p, mem_ctx, &r);
|
status = dcerpc_RemoteActivation(p, mem_ctx, &r);
|
||||||
|
@ -43,8 +43,7 @@ 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 = id->uuid;
|
tbl.syntax_id = *id;
|
||||||
tbl.if_version = id->if_version;
|
|
||||||
|
|
||||||
status = torture_rpc_connection(mem_ctx, &p, iface);
|
status = torture_rpc_connection(mem_ctx, &p, iface);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
@ -177,7 +176,7 @@ BOOL torture_rpc_scanner(struct torture_context *torture)
|
|||||||
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",
|
printf("Failed to map port for uuid %s\n",
|
||||||
GUID_string(loop_ctx, &l->table->uuid));
|
GUID_string(loop_ctx, &l->table->syntax_id.uuid));
|
||||||
talloc_free(loop_ctx);
|
talloc_free(loop_ctx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user