Install public header files again and include required prototypes.
[sfrench/samba-autobuild/.git] / source4 / torture / rpc / scanner.c
index e8203061e7fc3362bc757d03affcd59740cb590e..b761f406ec2c5d45d6ace07927d1707a4407758d 100644 (file)
@@ -24,6 +24,8 @@
 #include "librpc/gen_ndr/ndr_mgmt_c.h"
 #include "librpc/ndr/ndr_table.h"
 #include "torture/rpc/rpc.h"
+#include "param/param.h"
+#include "librpc/rpc/dcerpc_proto.h"
 
 /*
   work out how many calls there are for an interface
@@ -51,7 +53,7 @@ static bool test_num_calls(struct torture_context *tctx,
                printf("Failed to connect to '%s' on '%s' - %s\n", 
                       uuid_str, iface->name, nt_errstr(status));
                talloc_free(uuid_str);
-               return True;
+               return true;
        }
 
        /* make null calls */
@@ -59,7 +61,7 @@ static bool test_num_calls(struct torture_context *tctx,
        memset(stub_in.data, 0xFF, stub_in.length);
 
        for (i=0;i<200;i++) {
-               status = dcerpc_request(p, NULL, i, False, mem_ctx, &stub_in, &stub_out);
+               status = dcerpc_request(p, NULL, i, false, mem_ctx, &stub_in, &stub_out);
                if (!NT_STATUS_IS_OK(status) &&
                    p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) {
                        break;
@@ -97,21 +99,18 @@ bool torture_rpc_scanner(struct torture_context *torture)
 {
         NTSTATUS status;
         struct dcerpc_pipe *p;
-       TALLOC_CTX *mem_ctx, *loop_ctx;
-       BOOL ret = True;
+       TALLOC_CTX *loop_ctx;
+       bool ret = true;
        const struct ndr_interface_list *l;
        struct dcerpc_binding *b;
 
-       mem_ctx = talloc_init("torture_rpc_scanner");
-
        status = torture_rpc_binding(torture, &b);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(mem_ctx);
-               return False;
+               return false;
        }
 
        for (l=ndr_table_list();l;l=l->next) {          
-               loop_ctx = talloc_named(mem_ctx, 0, "torture_rpc_scanner loop context");
+               loop_ctx = talloc_named(torture, 0, "torture_rpc_scanner loop context");
                /* some interfaces are not mappable */
                if (l->table->num_calls == 0 ||
                    strcmp(l->table->name, "mgmt") == 0) {
@@ -122,7 +121,7 @@ bool torture_rpc_scanner(struct torture_context *torture)
                printf("\nTesting pipe '%s'\n", l->table->name);
 
                if (b->transport == NCACN_IP_TCP) {
-                       status = dcerpc_epm_map_binding(mem_ctx, b, l->table, NULL);
+                       status = dcerpc_epm_map_binding(torture, b, l->table, NULL, torture->lp_ctx);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Failed to map port for uuid %s\n", 
                                           GUID_string(loop_ctx, &l->table->syntax_id.uuid));
@@ -133,17 +132,17 @@ bool torture_rpc_scanner(struct torture_context *torture)
                        b->endpoint = talloc_strdup(b, l->table->name);
                }
 
-               lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, b));
+               lp_set_cmdline(torture->lp_ctx, "torture:binding", dcerpc_binding_string(torture, b));
 
                status = torture_rpc_connection(torture, &p, &ndr_table_mgmt);
                if (!NT_STATUS_IS_OK(status)) {
                        talloc_free(loop_ctx);
-                       ret = False;
+                       ret = false;
                        continue;
                }
        
-               if (!test_inq_if_ids(torture, p, mem_ctx, test_num_calls, l->table)) {
-                       ret = False;
+               if (!test_inq_if_ids(torture, p, torture, test_num_calls, l->table)) {
+                       ret = false;
                }
        }