summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-24 01:24:29 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-24 01:24:29 +0000
commitc7fd83d0b280810f16f7ef99ba58efb007f93920 (patch)
tree4a3cb1b009b6a4ed5980a4bc1cd30376c003f0b1 /source4/librpc
parent27b1dbaea64e02eccf07ff6643bffc2991264533 (diff)
downloadsamba-c7fd83d0b280810f16f7ef99ba58efb007f93920.tar.gz
samba-c7fd83d0b280810f16f7ef99ba58efb007f93920.tar.bz2
samba-c7fd83d0b280810f16f7ef99ba58efb007f93920.zip
added the dcerpc remote management interfaces as mgmt.idl, and wrote a
test suite. The test suite dumps all of the interfaces available on all pipes. There sure are a lot more interfaces on w2k3 than w2k ! (This used to be commit f94bc079902d725b63155d8d2de5bf408c6e7335)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/idl/dcerpc.idl3
-rw-r--r--source4/librpc/idl/epmapper.idl14
-rw-r--r--source4/librpc/idl/idl_types.h9
-rw-r--r--source4/librpc/idl/mgmt.idl63
-rw-r--r--source4/librpc/ndr/libndr.h6
-rw-r--r--source4/librpc/ndr/ndr.c19
-rw-r--r--source4/librpc/ndr/ndr_basic.c19
-rw-r--r--source4/librpc/rpc/dcerpc.c7
8 files changed, 124 insertions, 16 deletions
diff --git a/source4/librpc/idl/dcerpc.idl b/source4/librpc/idl/dcerpc.idl
index f24e6ffc45..c45309ba68 100644
--- a/source4/librpc/idl/dcerpc.idl
+++ b/source4/librpc/idl/dcerpc.idl
@@ -10,7 +10,8 @@ interface dcerpc
{
typedef struct {
GUID uuid;
- uint32 if_version;
+ uint16 major_version;
+ uint16 minor_version;
} dcerpc_syntax_id;
typedef struct {
diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl
index d2e34e4c31..f542d5f42a 100644
--- a/source4/librpc/idl/epmapper.idl
+++ b/source4/librpc/idl/epmapper.idl
@@ -77,7 +77,7 @@ interface epmapper
[in] uint32 num_ents,
[in,size_is(num_ents)] epm_entry_t entries[],
[in] uint32 replace,
- [out] uint32 *status
+ [out] error_status_t *status
);
/**********************/
@@ -85,7 +85,7 @@ interface epmapper
void epm_Delete(
[in] uint32 num_ents,
[in, size_is(num_ents)] epm_entry_t entries[],
- [out] uint32 *status
+ [out] error_status_t *status
);
/**********************/
@@ -99,7 +99,7 @@ interface epmapper
[in] uint32 max_ents,
[out] uint32 num_ents,
[out, length_is(num_ents), size_is(max_ents)] epm_entry_t entries[],
- [out] uint32 status
+ [out] error_status_t status
);
@@ -117,7 +117,7 @@ interface epmapper
[in] uint32 max_towers,
[out] uint32 *num_towers,
[out, length_is(*num_towers), size_is(max_towers)] twr_p_t towers[],
- [out] uint32 *status
+ [out] error_status_t *status
);
@@ -125,14 +125,14 @@ interface epmapper
/* Function 0x04 */
void epm_LookupHandleFree(
[in, out] policy_handle *entry_handle,
- [out] uint32 *status
+ [out] error_status_t *status
);
/**********************/
/* Function 0x05 */
void epm_InqObject(
[out] GUID *epm_object,
- [out] uint32 *status
+ [out] error_status_t *status
);
@@ -142,6 +142,6 @@ interface epmapper
[in] uint32 object_speced,
[in] GUID *object,
[in] twr_t *tower,
- [out] uint32 *status
+ [out] error_status_t *status
);
}
diff --git a/source4/librpc/idl/idl_types.h b/source4/librpc/idl/idl_types.h
index d2bbe1ab45..06794d0243 100644
--- a/source4/librpc/idl/idl_types.h
+++ b/source4/librpc/idl/idl_types.h
@@ -50,3 +50,12 @@
#define NDR_ALIGN2 LIBNDR_FLAG_ALIGN2
#define NDR_ALIGN4 LIBNDR_FLAG_ALIGN4
#define NDR_ALIGN8 LIBNDR_FLAG_ALIGN8
+
+
+/*
+ these are used by the epmapper and mgmt interfaces
+*/
+#define error_status_t uint32
+#define boolean32 uint32
+#define unsigned32 uint32
+
diff --git a/source4/librpc/idl/mgmt.idl b/source4/librpc/idl/mgmt.idl
new file mode 100644
index 0000000000..94439bdea3
--- /dev/null
+++ b/source4/librpc/idl/mgmt.idl
@@ -0,0 +1,63 @@
+#include "idl_types.h"
+
+/*
+ dcerpc remote management interface
+*/
+
+
+[
+ uuid(afa8bd80-7d8a-11c9-bef4-08002b102989),
+ version(1)
+]
+interface mgmt
+{
+ typedef struct {
+ dcerpc_syntax_id *id;
+ } dcerpc_syntax_id_p;
+
+ typedef struct {
+ unsigned32 count;
+ [size_is(count)] dcerpc_syntax_id_p if_id[*];
+ } rpc_if_id_vector_t;
+
+
+ /***********************/
+ /* Function 0x00 */
+ void mgmt_inq_if_ids (
+ [out] rpc_if_id_vector_t *if_id_vector,
+ [out] error_status_t status
+ );
+
+
+
+ /***********************/
+ /* Function 0x01 */
+ void mgmt_inq_stats (
+ [in, out] unsigned32 *count,
+ [out, size_is(*count)] unsigned32 *statistics,
+ [out] error_status_t *status
+ );
+
+ /***********************/
+ /* Function 0x02 */
+ boolean32 mgmt_is_server_listening (
+ [out] error_status_t status
+ );
+
+
+ /***********************/
+ /* Function 0x03 */
+ void mgmt_stop_server_listening (
+ [out] error_status_t status
+ );
+
+
+ /***********************/
+ /* Function 0x04 */
+ void mgmt_inq_princ_name (
+ [in] unsigned32 authn_proto,
+ [in] unsigned32 princ_name_size,
+ [out] ascstr2 princ_name,
+ [out] error_status_t status
+ );
+}
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index 5c51113874..42238fd17b 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -247,3 +247,9 @@ typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32, v
#include "librpc/gen_ndr/ndr_eventlog.h"
#include "librpc/gen_ndr/ndr_epmapper.h"
#include "librpc/gen_ndr/ndr_winreg.h"
+#include "librpc/gen_ndr/ndr_mgmt.h"
+
+/* this can be used to loop over all pipes - please extend the table
+ in librpc/ndr/ndr.c
+*/
+extern const struct dcerpc_interface_table *dcerpc_pipes[];
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 00f8eaed46..6116150cea 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -31,6 +31,23 @@
#define NDR_BASE_MARSHALL_SIZE 1024
+const struct dcerpc_interface_table *dcerpc_pipes[] = {
+ &dcerpc_table_samr,
+ &dcerpc_table_lsarpc,
+ &dcerpc_table_netdfs,
+ &dcerpc_table_atsvc,
+ &dcerpc_table_dcerpc,
+ &dcerpc_table_rpcecho,
+ &dcerpc_table_epmapper,
+ &dcerpc_table_eventlog,
+ &dcerpc_table_spoolss,
+ &dcerpc_table_srvsvc,
+ &dcerpc_table_winreg,
+ &dcerpc_table_wkssvc,
+ &dcerpc_table_mgmt,
+ NULL
+};
+
/*
work out the number of bytes needed to align on a n byte boundary
@@ -772,3 +789,5 @@ NTSTATUS ndr_pull_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
}
return fn(ndr, NDR_SCALARS|NDR_BUFFERS, p);
}
+
+
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 081d9ff87a..5f59899133 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -730,14 +730,21 @@ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
+const char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid)
+{
+ return talloc_asprintf(mem_ctx,
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ IVAL(guid->info, 0), SVAL(guid->info, 4),
+ SVAL(guid->info, 6),
+ guid->info[8], guid->info[9],
+ guid->info[10], guid->info[11],
+ guid->info[12], guid->info[13],
+ guid->info[14], guid->info[15]);
+}
+
void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid)
{
- ndr->print(ndr, "%-25s: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- name,
- IVAL(guid->info, 0), SVAL(guid->info, 4), SVAL(guid->info, 6),
- guid->info[8], guid->info[9],
- guid->info[10], guid->info[11], guid->info[12], guid->info[13],
- guid->info[14], guid->info[15]);
+ ndr->print(ndr, "%-25s: %s", GUID_string(ndr->mem_ctx, guid));
}
void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r)
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 6a8b867136..6322123279 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -237,14 +237,17 @@ NTSTATUS dcerpc_bind_byuuid(struct dcerpc_pipe *p,
DEBUG(2,("Invalid uuid string in dcerpc_bind_byuuid\n"));
return status;
}
- syntax.if_version = version;
+ syntax.major_version = version;
+ syntax.minor_version = 0;
status = guid_from_string("8a885d04-1ceb-11c9-9fe8-08002b104860",
&transfer_syntax.uuid);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- transfer_syntax.if_version = 2;
+
+ transfer_syntax.major_version = 2;
+ transfer_syntax.minor_version = 0;
return dcerpc_bind(p, &syntax, &transfer_syntax);
}