r19392: Use torture_setting_* rather than lp_parm_* where possible.
[gd/samba-autobuild/.git] / source4 / torture / rpc / mgmt.c
index be9cf649d3af3ef0fdb58bd112eb1e8ad00ecbea..0da7fcb8d3778c19e07aba497273808dfe835868 100644 (file)
 */
 
 #include "includes.h"
-#include "librpc/gen_ndr/ndr_mgmt.h"
+#include "torture/torture.h"
+#include "librpc/gen_ndr/ndr_mgmt_c.h"
+#include "auth/gensec/gensec.h"
+#include "librpc/rpc/dcerpc_table.h"
+#include "torture/rpc/rpc.h"
 
 
 /*
@@ -50,15 +54,12 @@ static BOOL test_inq_if_ids(struct dcerpc_pipe *p,
        }
 
        for (i=0;i<r.out.if_id_vector->count;i++) {
-               const char *uuid;
                struct dcerpc_syntax_id *id = r.out.if_id_vector->if_id[i].id;
                if (!id) continue;
 
-               uuid = GUID_string(mem_ctx, &id->uuid);
-
                printf("\tuuid %s  version 0x%08x  '%s'\n",
-                      uuid,
-                      id->if_version, idl_pipe_name(uuid, id->if_version));
+                      GUID_string(mem_ctx, &id->uuid),
+                      id->if_version, idl_pipe_name(&id->uuid, id->if_version));
        }
 
        return True;
@@ -173,13 +174,13 @@ static BOOL test_stop_server_listening(struct dcerpc_pipe *p,
 }
 
 
-BOOL torture_rpc_mgmt(void)
+BOOL torture_rpc_mgmt(struct torture_context *torture)
 {
         NTSTATUS status;
         struct dcerpc_pipe *p;
        TALLOC_CTX *mem_ctx, *loop_ctx;
        BOOL ret = True;
-       const char *binding = lp_parm_string(-1, "torture", "binding");
+       const char *binding = torture_setting_string(torture, "binding", NULL);
        const struct dcerpc_interface_list *l;
        struct dcerpc_binding *b;
 
@@ -210,12 +211,11 @@ BOOL torture_rpc_mgmt(void)
                printf("\nTesting pipe '%s'\n", l->table->name);
 
                if (b->transport == NCACN_IP_TCP) {
-                       status = dcerpc_epm_map_binding(loop_ctx, b, 
-                                                       l->table->uuid,
-                                                       l->table->if_version);
+                       status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL);
                        if (!NT_STATUS_IS_OK(status)) {
+                               printf("Failed to map port for uuid %s\n", 
+                                          GUID_string(loop_ctx, &l->table->syntax_id.uuid));
                                talloc_free(loop_ctx);
-                               printf("Failed to map port for uuid %s\n", l->table->uuid);
                                continue;
                        }
                } else {
@@ -224,11 +224,7 @@ BOOL torture_rpc_mgmt(void)
 
                lp_set_cmdline("torture:binding", dcerpc_binding_string(loop_ctx, b));
 
-               status = torture_rpc_connection(loop_ctx, 
-                                               &p, 
-                                               l->table->name,
-                                               DCERPC_MGMT_UUID,
-                                               DCERPC_MGMT_VERSION);
+               status = torture_rpc_connection(loop_ctx, &p, &dcerpc_table_mgmt);
                if (!NT_STATUS_IS_OK(status)) {
                        talloc_free(loop_ctx);
                        ret = False;