s4-smbd: initialise process models in smbtorture before use
authorAndrew Tridgell <tridge@samba.org>
Sat, 30 Oct 2010 12:42:27 +0000 (23:42 +1100)
committerAndrew Tridgell <tridge@samba.org>
Sat, 30 Oct 2010 13:32:09 +0000 (13:32 +0000)
the spoolss notify test needs to setup the process models before use

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Sat Oct 30 13:32:09 UTC 2010 on sn-devel-104

source4/smbd/process_model.c
source4/torture/rpc/spoolss_notify.c

index 0e636054609ffcb0e1f9d8493632fabd540e5491..3d5e2ce229634124058359e99f99efdf26405d63 100644 (file)
@@ -108,13 +108,19 @@ _PUBLIC_ NTSTATUS process_model_init(struct loadparm_context *lp_ctx)
        extern NTSTATUS process_model_prefork_init(void);
        extern NTSTATUS process_model_onefork_init(void);
        extern NTSTATUS process_model_single_init(void);
-       init_module_fn static_init[] = { STATIC_process_model_MODULES };
-       init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "process_model");
+       static bool initialised;
 
-       run_init_functions(static_init);
-       run_init_functions(shared_init);
+       if (!initialised) {
+               init_module_fn static_init[] = { STATIC_process_model_MODULES };
+               init_module_fn *shared_init;
+               initialised = true;
+               shared_init = load_samba_modules(NULL, lp_ctx, "process_model");
 
-       talloc_free(shared_init);
+               run_init_functions(static_init);
+               run_init_functions(shared_init);
+
+               talloc_free(shared_init);
+       }
        
        return NT_STATUS_OK;
 }
index 4608f1f09db8547c75e797c3143c0a67bf67189e..facfd3e52aab8bbc572937ad5f99d4e68d22dd15 100644 (file)
@@ -460,6 +460,10 @@ static bool test_start_dcerpc_server(struct torture_context *tctx,
 
        torture_comment(tctx, "Listening for callbacks on %s\n", address);
 
+       status = process_model_init(tctx->lp_ctx);
+       torture_assert_ntstatus_ok(tctx, status,
+                                  "unable to initialize process models");
+
        status = smbsrv_add_socket(event_ctx, tctx->lp_ctx, process_model_startup("single"), address);
        torture_assert_ntstatus_ok(tctx, status, "starting smb server");