summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-24 05:28:10 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-24 05:28:10 +0000
commit7d36545d33e73b46bf4e08f84548aea01c9f74c4 (patch)
tree36379a0162aaeb8b772203d7db4b0a2d5c88580d /source4
parent3114289c6434165a23996cb481dea619ee62d55f (diff)
downloadsamba-7d36545d33e73b46bf4e08f84548aea01c9f74c4.tar.gz
samba-7d36545d33e73b46bf4e08f84548aea01c9f74c4.tar.bz2
samba-7d36545d33e73b46bf4e08f84548aea01c9f74c4.zip
give far more detail in the EPMAPPER results
(This used to be commit 420301969820ffaa0a87b091c7a79372c99cb658)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/idl.gram6
-rw-r--r--source4/librpc/idl/epmapper.idl41
-rw-r--r--source4/torture/rpc/epmapper.c91
3 files changed, 107 insertions, 31 deletions
diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram
index b79c771f98..5cba06f014 100644
--- a/source4/build/pidl/idl.gram
+++ b/source4/build/pidl/idl.gram
@@ -30,12 +30,12 @@ definition : cpp_prefix
| function { $item[1] }
| const { $item[1] }
-const : 'const' <commit> identifier identifier '=' constant ';'
+const : 'const' <commit> identifier identifier '=' anytext ';'
{{
"TYPE" => "CONST",
"DTYPE" => $item[3],
"NAME" => $item[4],
- "VALUE" => $item{constant}
+ "VALUE" => $item{anytext}
}}
| <error?>
@@ -166,7 +166,7 @@ type :
text: /[\w\s\..?-]*/
-text2: /[\|\w\s,\*\>\/\..?-]*/
+text2: /[\|\w\s,\*\>"\/\..?-]*/
anytext: text2 '(' <commit> anytext ')' anytext
{{ "$item[1]($item[4])$item[6]" }}
diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl
index f542d5f42a..5c433dd2ca 100644
--- a/source4/librpc/idl/epmapper.idl
+++ b/source4/librpc/idl/epmapper.idl
@@ -20,6 +20,9 @@ interface epmapper
with.
*/
+ /* this guid indicates NDR encoding in a protocol tower */
+ const string NDR_GUID = "8a885d04-1ceb-11c9-9fe8-08002b104860";
+
typedef struct {
GUID uuid;
uint16 version;
@@ -36,7 +39,7 @@ interface epmapper
} epm_lhs;
typedef struct {
- uint16 unknown;
+ [flag(NDR_REMAINING)] DATA_BLOB data;
} epm_rhs;
typedef struct {
@@ -57,11 +60,11 @@ interface epmapper
typedef struct {
uint32 tower_length;
[subcontext(4)] epm_towers towers;
- } twr_t;
+ } epm_twr_t;
typedef struct {
GUID object;
- twr_t *tower;
+ epm_twr_t *tower;
ascstr2 annotation;
} epm_entry_t;
@@ -77,7 +80,7 @@ interface epmapper
[in] uint32 num_ents,
[in,size_is(num_ents)] epm_entry_t entries[],
[in] uint32 replace,
- [out] error_status_t *status
+ [out] error_status_t status
);
/**********************/
@@ -85,7 +88,7 @@ interface epmapper
void epm_Delete(
[in] uint32 num_ents,
[in, size_is(num_ents)] epm_entry_t entries[],
- [out] error_status_t *status
+ [out] error_status_t status
);
/**********************/
@@ -95,11 +98,11 @@ interface epmapper
[in] GUID *object,
[in] rpc_if_id_t *interface_id,
[in] uint32 vers_option,
- [in, out, ref] policy_handle *entry_handle,
+ [in,out,ref] policy_handle *entry_handle,
[in] uint32 max_ents,
[out] uint32 num_ents,
[out, length_is(num_ents), size_is(max_ents)] epm_entry_t entries[],
- [out] error_status_t status
+ [out] error_status_t status
);
@@ -107,32 +110,32 @@ interface epmapper
/* Function 0x03 */
typedef struct {
- twr_t *twr;
- } twr_p_t;
+ epm_twr_t *twr;
+ } epm_twr_p_t;
void epm_Map(
[in] GUID *object,
- [in] twr_t *map_tower,
- [in, out] policy_handle *entry_handle,
+ [in] epm_twr_t *map_tower,
+ [in,out,ref] policy_handle *entry_handle,
[in] uint32 max_towers,
- [out] uint32 *num_towers,
- [out, length_is(*num_towers), size_is(max_towers)] twr_p_t towers[],
- [out] error_status_t *status
+ [out] uint32 num_towers,
+ [out, length_is(num_towers), size_is(max_towers)] epm_twr_p_t towers[],
+ [out] error_status_t status
);
/**********************/
/* Function 0x04 */
void epm_LookupHandleFree(
- [in, out] policy_handle *entry_handle,
- [out] error_status_t *status
+ [in,out,ref] policy_handle *entry_handle,
+ [out] error_status_t status
);
/**********************/
/* Function 0x05 */
void epm_InqObject(
[out] GUID *epm_object,
- [out] error_status_t *status
+ [out] error_status_t status
);
@@ -141,7 +144,7 @@ interface epmapper
void epm_MgmtDelete(
[in] uint32 object_speced,
[in] GUID *object,
- [in] twr_t *tower,
- [out] error_status_t *status
+ [in] epm_twr_t *tower,
+ [out] error_status_t status
);
}
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index 7893813f56..d0f3181564 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -22,6 +22,80 @@
#include "includes.h"
+/*
+ display any protocol tower
+ */
+static void display_tower(TALLOC_CTX *mem_ctx, struct epm_towers *twr)
+{
+ int i;
+ const char *uuid;
+
+ for (i=0;i<twr->num_floors;i++) {
+ struct epm_lhs *lhs = &twr->floors[i].lhs;
+ struct epm_rhs *rhs = &twr->floors[i].rhs;
+ switch (lhs->protocol) {
+ case 0xd:
+ uuid = GUID_string(mem_ctx, &lhs->info.uuid.uuid);
+ if (strcasecmp(uuid, NDR_GUID) == 0) {
+ printf(" NDR");
+ } else {
+ printf(" uuid %s/0x%02x", uuid, lhs->info.uuid.version);
+ }
+ break;
+ case 0xb:
+ printf(" RPC-C");
+ break;
+
+ case 0x9:
+ printf(" IP:");
+ if (rhs->data.length == 4) {
+ struct in_addr in;
+ in.s_addr = RIVAL(rhs->data.data, 0);
+ printf("%s", inet_ntoa(in));
+ }
+ break;
+
+ case 0x10:
+ printf(" PIPE:%.*s", rhs->data.length, rhs->data.data);
+ break;
+
+ case 0x0f:
+ printf(" SMBNP:%.*s", rhs->data.length, rhs->data.data);
+ break;
+
+ case 0x11:
+ printf(" SMB:%.*s", rhs->data.length, rhs->data.data);
+ break;
+
+ case 0x01:
+ printf(" UNK(1):%.*s", rhs->data.length, rhs->data.data);
+ break;
+
+ case 0x1f:
+ printf(" TCP:");
+ if (rhs->data.length == 2) {
+ printf("%d", SVAL(rhs->data.data, 0));
+ }
+ break;
+
+ case 0x07:
+ printf(" XXX:");
+ if (rhs->data.length == 2) {
+ printf("%d", SVAL(rhs->data.data, 0));
+ }
+ break;
+
+ default:
+ printf(" UNK(%02x):", lhs->protocol);
+ if (rhs->data.length == 2) {
+ printf("%d", SVAL(rhs->data.data, 0));
+ }
+ break;
+ }
+ }
+ printf("\n");
+}
+
static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
@@ -29,7 +103,6 @@ static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
struct GUID uuid;
struct rpc_if_id_t iface;
struct policy_handle handle;
- int i;
ZERO_STRUCT(uuid);
ZERO_STRUCT(iface);
@@ -41,20 +114,20 @@ static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
r.in.vers_option = 0;
r.in.entry_handle = &handle;
r.out.entry_handle = &handle;
- r.in.max_ents = 1;
+ r.in.max_ents = 10;
do {
status = dcerpc_epm_Lookup(p, mem_ctx, &r);
if (NT_STATUS_IS_OK(status) && r.out.status == 0) {
- printf("Found '%s'\n", r.out.entries[0].annotation);
- for (i=0;i<r.out.entries[0].tower->towers.num_floors;i++) {
- struct epm_lhs *lhs = &r.out.entries[0].tower->towers.floors[i].lhs;
- if (lhs->protocol == 13) {
- NDR_PRINT_DEBUG(epm_prot_uuid, &lhs->info.uuid);
- }
+ int i;
+ for (i=0;i<r.out.num_ents;i++) {
+ printf("Found '%s'\n", r.out.entries[i].annotation);
+ display_tower(mem_ctx, &r.out.entries[i].tower->towers);
}
}
- } while (NT_STATUS_IS_OK(status) && r.out.status == 0);
+ } while (NT_STATUS_IS_OK(status) &&
+ r.out.status == 0 &&
+ r.out.num_ents == r.in.max_ents);
if (!NT_STATUS_IS_OK(status)) {
printf("Lookup failed - %s\n", nt_errstr(status));