diff options
author | Jim McDonough <jmcd@samba.org> | 2003-10-20 18:35:12 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2003-10-20 18:35:12 +0000 |
commit | 2cfb3e9b7046fe2db330a292aed71f1c27688a16 (patch) | |
tree | ca25dec3cf9b20a690ee22b9f8701e45ab306906 /source3 | |
parent | f3121b19e4a4951350342a1882c9017686a995b1 (diff) | |
download | samba-2cfb3e9b7046fe2db330a292aed71f1c27688a16.tar.gz samba-2cfb3e9b7046fe2db330a292aed71f1c27688a16.tar.bz2 samba-2cfb3e9b7046fe2db330a292aed71f1c27688a16.zip |
Several updates:
- add support for named pipe and netbios queries in parse code
- fix map request structure...unknown byte was alignment
- add sample of named pipe over netbios query in rpcclient (comment only)
(This used to be commit 71dcdf54e60204d6b499d25d8759ed20fc7a021a)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/rpc_epmapper.h | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_epmapper.c | 45 | ||||
-rw-r--r-- | source3/rpcclient/cmd_epmapper.c | 5 |
3 files changed, 50 insertions, 4 deletions
diff --git a/source3/include/rpc_epmapper.h b/source3/include/rpc_epmapper.h index 57ac8e2522..1b5b6b1876 100644 --- a/source3/include/rpc_epmapper.h +++ b/source3/include/rpc_epmapper.h @@ -30,7 +30,8 @@ #define EPM_FLOOR_RPC 0x0b /* tower is for connection-oriented rpc */ #define EPM_FLOOR_TCP 0x07 /* floor contains tcp port number */ #define EPM_FLOOR_IP 0x09 /* floor contains IP address */ -#define EPM_FLOOR_NMPIPES 0x10 /* floor contains remote named pipe name */ +#define EPM_FLOOR_NMPIPES 0x0f /* floor contains remote named pipe name */ +#define EPM_FLOOR_LRPC 0x10 /* floor contains local named pipe name */ #define EPM_FLOOR_NETBIOS 0x11 /* floor contains netbios address */ #define EPM_FLOOR_NETBEUI 0x12 /* floor contains netbeui address */ #define EPM_FLOOR_SOCKET 0x20 @@ -63,6 +64,7 @@ typedef struct struct { uint8 addr[4]; } ip; + char string[MAXHOSTNAMELEN+3]; /* hostname + \\ + null term */ } rhs; } EPM_FLOOR; diff --git a/source3/rpc_parse/parse_epmapper.c b/source3/rpc_parse/parse_epmapper.c index 368ea319bd..2bdb755deb 100644 --- a/source3/rpc_parse/parse_epmapper.c +++ b/source3/rpc_parse/parse_epmapper.c @@ -29,6 +29,8 @@ BOOL epm_io_handle(const char *desc, EPM_HANDLE *handle, prs_struct *ps, int depth) { + if (!prs_align(ps)) + return False; if (!prs_uint8s(False, "data", ps, depth, handle->data, sizeof(handle->data))) @@ -67,6 +69,11 @@ NTSTATUS init_epm_floor(EPM_FLOOR *floor, uint8 protocol) case EPM_FLOOR_IP: floor->rhs.length = sizeof(floor->rhs.ip.addr); break; + case EPM_FLOOR_NMPIPES: + case EPM_FLOOR_LRPC: + case EPM_FLOOR_NETBIOS: + floor->rhs.length = strlen(floor->rhs.string) + 1; + break; default: break; } @@ -114,6 +121,33 @@ NTSTATUS init_epm_floor_ip(EPM_FLOOR *floor, uint8 addr[4]) } /******************************************************************* + inits an EPM_FLOOR structure for named pipe +********************************************************************/ +NTSTATUS init_epm_floor_np(EPM_FLOOR *floor, const char *pipe_name) +{ + safe_strcpy(floor->rhs.string, pipe_name, sizeof(floor->rhs.string)-1); + return init_epm_floor(floor, EPM_FLOOR_NMPIPES); +} + +/******************************************************************* + inits an EPM_FLOOR structure for named pipe +********************************************************************/ +NTSTATUS init_epm_floor_lrpc(EPM_FLOOR *floor, const char *pipe_name) +{ + safe_strcpy(floor->rhs.string, pipe_name, sizeof(floor->rhs.string)-1); + return init_epm_floor(floor, EPM_FLOOR_LRPC); +} + +/******************************************************************* + inits an EPM_FLOOR structure for named pipe +********************************************************************/ +NTSTATUS init_epm_floor_nb(EPM_FLOOR *floor, char *host_name) +{ + safe_strcpy(floor->rhs.string, host_name, sizeof(floor->rhs.string)-1); + return init_epm_floor(floor, EPM_FLOOR_NETBIOS); +} + +/******************************************************************* reads and writes EPM_FLOOR. ********************************************************************/ BOOL epm_io_floor(const char *desc, EPM_FLOOR *floor, @@ -156,6 +190,14 @@ BOOL epm_io_floor(const char *desc, EPM_FLOOR *floor, sizeof(floor->rhs.ip.addr))) return False; break; + case EPM_FLOOR_NMPIPES: + case EPM_FLOOR_LRPC: + case EPM_FLOOR_NETBIOS: + if (!prs_uint8s(False, "string", ps, depth, + floor->rhs.string, + floor->rhs.length)) + return False; + break; default: break; } @@ -227,9 +269,6 @@ BOOL epm_io_tower(const char *desc, EPM_TOWER *tower, return False; } - if (!prs_uint8("unknown", ps, depth, &tower->unknown)) - return False; - return True; } diff --git a/source3/rpcclient/cmd_epmapper.c b/source3/rpcclient/cmd_epmapper.c index 280188d875..e2eecb6f04 100644 --- a/source3/rpcclient/cmd_epmapper.c +++ b/source3/rpcclient/cmd_epmapper.c @@ -48,6 +48,11 @@ static NTSTATUS cmd_epm_map(struct cli_state *cli, init_epm_floor_uuid(&floors[0], &if_uuid, 4); init_epm_floor_uuid(&floors[1], &syn_uuid, 2); init_epm_floor_rpc(&floors[2]); + + /* sample for netbios named pipe query + init_epm_floor_np(&floors[3], "\\PIPE\\lsass"); + init_epm_floor_nb(&floors[4], "\\\\psflinux"); + */ init_epm_floor_tcp(&floors[3], 135); init_epm_floor_ip(&floors[4], addr); towers = talloc(mem_ctx, sizeof(EPM_TOWER)); |