mirror of
https://github.com/samba-team/samba.git
synced 2025-12-12 12:23:50 +03:00
r3516: dcerpc_epm_map_binding now checks the endpoints it nows first
and then possibly does a epm_Map call(). ncacn_np now also uses dcerpc_epm_map_binding()
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
1104667190
commit
77eec3fa18
@@ -239,7 +239,6 @@ sub type_align($)
|
|||||||
return 4, if ($type eq "DATA_BLOB");
|
return 4, if ($type eq "DATA_BLOB");
|
||||||
return 4, if ($type eq "int32");
|
return 4, if ($type eq "int32");
|
||||||
|
|
||||||
print STDERR "Had to guess align width for type $type\n";
|
|
||||||
# it must be an external type - all we can do is guess
|
# it must be an external type - all we can do is guess
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ interface epmapper
|
|||||||
const string NDR_GUID = "8a885d04-1ceb-11c9-9fe8-08002b104860";
|
const string NDR_GUID = "8a885d04-1ceb-11c9-9fe8-08002b104860";
|
||||||
const string NDR_GUID_VERSION = 2;
|
const string NDR_GUID_VERSION = 2;
|
||||||
|
|
||||||
const uint32 EPMAPPER_PORT = 135;
|
|
||||||
const string EPMAPPER_IDENTIFIER = "EPMAPPER";
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GUID uuid;
|
GUID uuid;
|
||||||
uint16 version;
|
uint16 version;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
[
|
[
|
||||||
uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"),
|
uuid("afa8bd80-7d8a-11c9-bef4-08002b102989"),
|
||||||
version(1.0),
|
version(1.0),
|
||||||
|
endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
|
||||||
helpstring("DCE/RPC Remote Management")
|
helpstring("DCE/RPC Remote Management")
|
||||||
]
|
]
|
||||||
interface mgmt
|
interface mgmt
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
[
|
[
|
||||||
uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"),
|
uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"),
|
||||||
pointer_default(unique),
|
pointer_default(unique),
|
||||||
endpoint("ncalrpc:", "ncacn_ip_tcp:[135]"),
|
endpoint("ncalrpc:", "ncacn_ip_tcp:[135]", "ncacn_np:[\\pipe\\epmapper]"),
|
||||||
depends(dcom)
|
depends(dcom)
|
||||||
]
|
]
|
||||||
interface IRemoteActivation
|
interface IRemoteActivation
|
||||||
|
|||||||
@@ -24,9 +24,6 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
#include "librpc/gen_ndr/ndr_epmapper.h"
|
#include "librpc/gen_ndr/ndr_epmapper.h"
|
||||||
#include "librpc/gen_ndr/ndr_remact.h"
|
|
||||||
#include "librpc/gen_ndr/ndr_oxidresolver.h"
|
|
||||||
#include "librpc/gen_ndr/ndr_mgmt.h"
|
|
||||||
#include "librpc/gen_ndr/tables.h"
|
#include "librpc/gen_ndr/tables.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -660,16 +657,22 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
|
|||||||
struct GUID guid;
|
struct GUID guid;
|
||||||
struct epm_twr_t twr, *twr_r;
|
struct epm_twr_t twr, *twr_r;
|
||||||
struct dcerpc_binding epmapper_binding;
|
struct dcerpc_binding epmapper_binding;
|
||||||
|
const struct dcerpc_interface_table *table = idl_iface_by_uuid(uuid);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* First, check if there is a default endpoint specified in the IDL */
|
||||||
|
|
||||||
if (!strcmp(uuid, DCERPC_EPMAPPER_UUID) ||
|
if (table) {
|
||||||
!strcmp(uuid, DCERPC_MGMT_UUID) ||
|
struct dcerpc_binding default_binding;
|
||||||
!strcmp(uuid, DCERPC_IREMOTEACTIVATION_UUID) ||
|
|
||||||
!strcmp(uuid, DCERPC_IOXIDRESOLVER_UUID)) {
|
/* Find one of the default pipes for this interface */
|
||||||
switch(binding->transport) {
|
for (i = 0; i < table->endpoints->count; i++) {
|
||||||
case NCACN_IP_TCP: binding->endpoint = talloc_asprintf(mem_ctx, "%d", EPMAPPER_PORT); return NT_STATUS_OK;
|
status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
|
||||||
case NCALRPC: binding->endpoint = EPMAPPER_IDENTIFIER; return NT_STATUS_OK;
|
|
||||||
default: return NT_STATUS_NOT_SUPPORTED;
|
if (NT_STATUS_IS_OK(status) && default_binding.transport == binding->transport && default_binding.endpoint) {
|
||||||
|
binding->endpoint = talloc_strdup(mem_ctx, default_binding.endpoint);
|
||||||
|
return NT_STATUS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,35 +762,19 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
|
|||||||
const char *pipe_name = NULL;
|
const char *pipe_name = NULL;
|
||||||
TALLOC_CTX *mem_ctx = talloc_init("dcerpc_pipe_connect_ncacn_np");
|
TALLOC_CTX *mem_ctx = talloc_init("dcerpc_pipe_connect_ncacn_np");
|
||||||
|
|
||||||
|
/* Look up identifier using the epmapper */
|
||||||
if (!binding->endpoint) {
|
if (!binding->endpoint) {
|
||||||
const struct dcerpc_interface_table *table = idl_iface_by_uuid(pipe_uuid);
|
status = dcerpc_epm_map_binding(mem_ctx, binding, pipe_uuid, pipe_version);
|
||||||
struct dcerpc_binding default_binding;
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
int i;
|
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
|
||||||
|
pipe_uuid, nt_errstr(status)));
|
||||||
if (!table) {
|
|
||||||
DEBUG(0,("Unknown interface endpoint '%s'\n", pipe_uuid));
|
|
||||||
talloc_destroy(mem_ctx);
|
talloc_destroy(mem_ctx);
|
||||||
return NT_STATUS_INVALID_PARAMETER;
|
return status;
|
||||||
|
}
|
||||||
|
DEBUG(1,("Mapped to DCERPC/TCP pipe %s\n", binding->endpoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find one of the default pipes for this interface */
|
|
||||||
for (i = 0; i < table->endpoints->count; i++) {
|
|
||||||
status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
|
|
||||||
|
|
||||||
if (NT_STATUS_IS_OK(status) && default_binding.transport == NCACN_NP) {
|
|
||||||
pipe_name = default_binding.endpoint;
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pipe_name == NULL) {
|
|
||||||
DEBUG(0, ("No default named pipe specified for interface with UUID %s\n", pipe_uuid));
|
|
||||||
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pipe_name = binding->endpoint;
|
pipe_name = binding->endpoint;
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncasecmp(pipe_name, "/pipe/", 6) ||
|
if (!strncasecmp(pipe_name, "/pipe/", 6) ||
|
||||||
!strncasecmp(pipe_name, "\\pipe\\", 6)) {
|
!strncasecmp(pipe_name, "\\pipe\\", 6)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user