s3:smbd: prepare the usage of per_thread_cwd_*() functions
authorStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 12:13:04 +0000 (13:13 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 22:11:11 +0000 (23:11 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/lib/util.c
source3/smbd/server.c

index 8ff330bcd26eee67f79bceecb20ad880f8cb56ef..5dbd67349faf8f45abeb82c5d8ca91500cd24b66 100644 (file)
@@ -453,6 +453,13 @@ NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
        NTSTATUS status = NT_STATUS_OK;
        int ret;
 
+       /*
+        * The main process thread should never
+        * allow per_thread_cwd_enable() to be
+        * called.
+        */
+       per_thread_cwd_disable();
+
        if (reinit_after_fork_pipe[1] != -1) {
                close(reinit_after_fork_pipe[1]);
                reinit_after_fork_pipe[1] = -1;
index 871bb9234491c6866f2a794010db418f0ca5a200..c59759fed9858c2ef8ef9aa0967789df544f483a 100644 (file)
@@ -1798,6 +1798,13 @@ extern void build_options(bool screen);
                exit(1);
        }
 
+       /*
+        * This calls unshare(CLONE_FS); on linux
+        * in order to check if the running kernel/container
+        * environment supports it.
+        */
+       per_thread_cwd_check();
+
        if (!cluster_probe_ok()) {
                exit(1);
        }