s3: lib: messages: Don't use the result of sec_init() before calling sec_init().
[metze/samba/wip.git] / source3 / lib / messages.c
index 464233fda2c3d0b0e9b4af97ca025d8aa5484884..5a31f3414d74ecc3c4776f7e276905ec1257f84d 100644 (file)
@@ -457,6 +457,13 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
        const char *priv_path;
        bool ok;
 
+       /*
+        * sec_init() *must* be called before any other
+        * functions that use sec_XXX(). e.g. sec_initial_uid().
+        */
+
+       sec_init();
+
        lck_path = lock_path("msg.lock");
        if (lck_path == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -507,8 +514,6 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       sec_init();
-
        ctx->msg_dgm_ref = messaging_dgm_ref(ctx,
                                             ctx->event_ctx,
                                             &ctx->id.unique_id,