mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
rpcdump.exe now works fine against a Samba4 server
for some reason the epm_Lookup replies can't be parsed by ethereal, although w2k parses then fine as does the Samba4 NDR code.
This commit is contained in:
parent
fbdcf9ef54
commit
097e7ca99d
@ -20,6 +20,9 @@ interface epmapper
|
||||
with.
|
||||
*/
|
||||
|
||||
const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6;
|
||||
|
||||
|
||||
/* this guid indicates NDR encoding in a protocol tower */
|
||||
const string NDR_GUID = "8a885d04-1ceb-11c9-9fe8-08002b104860";
|
||||
const string NDR_GUID_VERSION = 2;
|
||||
@ -123,8 +126,6 @@ interface epmapper
|
||||
/**********************/
|
||||
/* Function 0x03 */
|
||||
|
||||
const int EPMAPPER_MAP_FAILED = 0x16c9a0d6;
|
||||
|
||||
typedef struct {
|
||||
epm_twr_t *twr;
|
||||
} epm_twr_p_t;
|
||||
|
@ -40,6 +40,7 @@ struct ipc_private {
|
||||
const char *pipe_name;
|
||||
uint16 fnum;
|
||||
struct dcesrv_state *pipe_state;
|
||||
uint16 ipc_state;
|
||||
} *pipe_list;
|
||||
|
||||
};
|
||||
@ -223,6 +224,7 @@ static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi)
|
||||
while (p->pipe_name[0] == '\\') {
|
||||
p->pipe_name++;
|
||||
}
|
||||
p->ipc_state = 0x5ff;
|
||||
|
||||
/*
|
||||
we're all set, now ask the dcerpc server subsystem to open the
|
||||
@ -250,6 +252,7 @@ static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi)
|
||||
|
||||
ZERO_STRUCT(oi->ntcreatex.out);
|
||||
oi->ntcreatex.out.fnum = p->fnum;
|
||||
oi->ntcreatex.out.ipc_state = p->ipc_state;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -508,18 +511,13 @@ NTSTATUS ipc_search_close(struct request_context *req, union smb_search_close *i
|
||||
}
|
||||
|
||||
|
||||
/* SMBtrans - used to provide access to SMB pipes */
|
||||
static NTSTATUS ipc_trans(struct request_context *req, struct smb_trans2 *trans)
|
||||
/* SMBtrans - handle a DCERPC command */
|
||||
static NTSTATUS ipc_dcerpc_cmd(struct request_context *req, struct smb_trans2 *trans)
|
||||
{
|
||||
struct pipe_state *p;
|
||||
struct ipc_private *private = req->conn->ntvfs_private;
|
||||
NTSTATUS status;
|
||||
|
||||
if (trans->in.setup_count != 2 ||
|
||||
trans->in.setup[0] != TRANSACT_DCERPCCMD) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/* the fnum is in setup[1] */
|
||||
p = pipe_state_find(private, trans->in.setup[1]);
|
||||
if (!p) {
|
||||
@ -558,6 +556,57 @@ static NTSTATUS ipc_trans(struct request_context *req, struct smb_trans2 *trans)
|
||||
}
|
||||
|
||||
|
||||
/* SMBtrans - set named pipe state */
|
||||
static NTSTATUS ipc_set_nm_pipe_state(struct request_context *req, struct smb_trans2 *trans)
|
||||
{
|
||||
struct pipe_state *p;
|
||||
struct ipc_private *private = req->conn->ntvfs_private;
|
||||
|
||||
/* the fnum is in setup[1] */
|
||||
p = pipe_state_find(private, trans->in.setup[1]);
|
||||
if (!p) {
|
||||
return NT_STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (trans->in.params.length != 2) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
p->ipc_state = SVAL(trans->in.params.data, 0);
|
||||
|
||||
trans->out.setup_count = 0;
|
||||
trans->out.setup = NULL;
|
||||
trans->out.params = data_blob(NULL, 0);
|
||||
trans->out.data = data_blob(NULL, 0);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* SMBtrans - used to provide access to SMB pipes */
|
||||
static NTSTATUS ipc_trans(struct request_context *req, struct smb_trans2 *trans)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
if (trans->in.setup_count != 2) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
switch (trans->in.setup[0]) {
|
||||
case TRANSACT_SETNAMEDPIPEHANDLESTATE:
|
||||
status = ipc_set_nm_pipe_state(req, trans);
|
||||
break;
|
||||
case TRANSACT_DCERPCCMD:
|
||||
status = ipc_dcerpc_cmd(req, trans);
|
||||
break;
|
||||
default:
|
||||
status = NT_STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
initialialise the IPC backend, registering ourselves with the ntvfs subsystem
|
||||
|
@ -651,6 +651,7 @@ int dcesrv_lookup_endpoints(const struct dcerpc_interface_table *table,
|
||||
return -1;
|
||||
}
|
||||
|
||||
(*e)->name = table->name;
|
||||
(*e)->uuid = table->uuid;
|
||||
(*e)->if_version = table->if_version;
|
||||
(*e)->endpoint.type = ENDPOINT_SMB;
|
||||
|
@ -35,6 +35,7 @@ struct dcesrv_endpoint {
|
||||
|
||||
/* a endpoint combined with an interface description */
|
||||
struct dcesrv_ep_iface {
|
||||
const char *name;
|
||||
struct dcesrv_endpoint endpoint;
|
||||
const char *uuid;
|
||||
uint32 if_version;
|
||||
|
@ -72,14 +72,14 @@ static BOOL fill_protocol_tower(TALLOC_CTX *mem_ctx, struct epm_towers *twr,
|
||||
twr->floors[3].lhs.info.lhs_data = data_blob(NULL, 0);
|
||||
twr->floors[3].rhs.rhs_data.data = talloc_asprintf(mem_ctx, "\\PIPE\\%s",
|
||||
e->endpoint.info.smb_pipe);
|
||||
twr->floors[3].rhs.rhs_data.length = strlen(twr->floors[3].rhs.rhs_data.data);
|
||||
twr->floors[3].rhs.rhs_data.length = strlen(twr->floors[3].rhs.rhs_data.data)+1;
|
||||
|
||||
/* on an NetBIOS link ... */
|
||||
twr->floors[4].lhs.protocol = EPM_PROTOCOL_NETBIOS;
|
||||
twr->floors[4].lhs.info.lhs_data = data_blob(NULL, 0);
|
||||
twr->floors[4].rhs.rhs_data.data = talloc_asprintf(mem_ctx, "\\\\%s",
|
||||
lp_netbios_name());
|
||||
twr->floors[4].rhs.rhs_data.length = strlen(twr->floors[4].rhs.rhs_data.data);
|
||||
twr->floors[4].rhs.rhs_data.length = strlen(twr->floors[4].rhs.rhs_data.data)+1;
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -175,6 +175,9 @@ static NTSTATUS epm_Lookup(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx,
|
||||
|
||||
if (num_ents == 0) {
|
||||
r->out.entries = NULL;
|
||||
r->out.status = EPMAPPER_STATUS_NO_MORE_ENTRIES;
|
||||
ZERO_STRUCTP(r->out.entry_handle);
|
||||
dcesrv_handle_destroy(dce, h);
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
@ -185,7 +188,7 @@ static NTSTATUS epm_Lookup(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx,
|
||||
|
||||
for (i=0;i<num_ents;i++) {
|
||||
ZERO_STRUCT(r->out.entries[i].object);
|
||||
r->out.entries[i].annotation = "";
|
||||
r->out.entries[i].annotation = eps->e[i].name;
|
||||
r->out.entries[i].tower = talloc_p(mem_ctx, struct epm_twr_t);
|
||||
if (!r->out.entries[i].tower) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
@ -270,7 +273,7 @@ static NTSTATUS epm_Map(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx,
|
||||
|
||||
failed:
|
||||
r->out.num_towers = 0;
|
||||
r->out.status = EPMAPPER_MAP_FAILED;
|
||||
r->out.status = EPMAPPER_STATUS_NO_MORE_ENTRIES;
|
||||
r->out.towers->twr = NULL;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user