summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-24 03:21:49 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-24 03:21:49 +0000
commite4773b184cd6ccf1e46ec151afbfd9fb9ad3ede8 (patch)
tree980d9a236b4800aa018d7cc3a2b615919b69f7f5 /source4/torture/rpc
parentc7fd83d0b280810f16f7ef99ba58efb007f93920 (diff)
downloadsamba-e4773b184cd6ccf1e46ec151afbfd9fb9ad3ede8.tar.gz
samba-e4773b184cd6ccf1e46ec151afbfd9fb9ad3ede8.tar.bz2
samba-e4773b184cd6ccf1e46ec151afbfd9fb9ad3ede8.zip
added tests for the remaining calls on the rpc management interface
(This used to be commit 00f9b0e12061c175334f96805ca8333f28f74d91)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/mgmt.c115
1 files changed, 114 insertions, 1 deletions
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c
index 5eb0a56a7d..693703eb82 100644
--- a/source4/torture/rpc/mgmt.c
+++ b/source4/torture/rpc/mgmt.c
@@ -28,7 +28,7 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p,
NTSTATUS status;
struct mgmt_inq_if_ids r;
int i;
-
+
status = dcerpc_mgmt_inq_if_ids(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("inq_if_ids failed - %s\n", nt_errstr(status));
@@ -56,6 +56,103 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p,
return True;
}
+static BOOL test_inq_stats(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct mgmt_inq_stats r;
+
+ r.in.max_count = mgmt_stats_array_max_size;
+ r.in.unknown = 0;
+
+ status = dcerpc_mgmt_inq_stats(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("inq_stats failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (r.out.statistics.count != mgmt_stats_array_max_size) {
+ printf("Unexpected array size %d\n", r.out.statistics.count);
+ return False;
+ }
+
+ printf("\tcalls_in %6d calls_out %6d\n\tpkts_in %6d pkts_out %6d\n",
+ r.out.statistics.statistics[mgmt_stats_calls_in],
+ r.out.statistics.statistics[mgmt_stats_calls_out],
+ r.out.statistics.statistics[mgmt_stats_pkts_in],
+ r.out.statistics.statistics[mgmt_stats_pkts_out]);
+
+ return True;
+}
+
+static BOOL test_inq_princ_name(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx)
+{
+#if 0
+ NTSTATUS status;
+ struct mgmt_inq_princ_name r;
+
+ r.in.authn_proto = 1;
+ r.in.princ_name_size = 1000;
+
+ status = dcerpc_mgmt_inq_princ_name(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("inq_princ_name failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ return True;
+#else
+ /* this is broken */
+ printf("\tnot doing inq_princ_name\n");
+ return True;
+#endif
+}
+
+static BOOL test_is_server_listening(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct mgmt_is_server_listening r;
+
+ status = dcerpc_mgmt_is_server_listening(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("is_server_listening failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (r.out.status != 0 || r.out.result == 0) {
+ printf("\tserver is NOT listening\n");
+ } else {
+ printf("\tserver is listening\n");
+ }
+
+ return True;
+}
+
+static BOOL test_stop_server_listening(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct mgmt_stop_server_listening r;
+
+ status = dcerpc_mgmt_stop_server_listening(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("stop_server_listening failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ if (r.out.status != 0) {
+ printf("\tserver refused to stop listening\n");
+ } else {
+ printf("\tserver allowed a stop_server_listening request\n");
+ return False;
+ }
+
+ return True;
+}
+
+
BOOL torture_rpc_mgmt(int dummy)
{
NTSTATUS status;
@@ -87,6 +184,22 @@ BOOL torture_rpc_mgmt(int dummy)
p->flags |= DCERPC_DEBUG_PRINT_BOTH;
+ if (!test_is_server_listening(p, mem_ctx)) {
+ ret = False;
+ }
+
+ if (!test_stop_server_listening(p, mem_ctx)) {
+ ret = False;
+ }
+
+ if (!test_inq_stats(p, mem_ctx)) {
+ ret = False;
+ }
+
+ if (!test_inq_princ_name(p, mem_ctx)) {
+ ret = False;
+ }
+
if (!test_inq_if_ids(p, mem_ctx)) {
ret = False;
}