s3: Pass the new server_id through reinit_after_fork
authorVolker Lendecke <vl@samba.org>
Sun, 4 Jul 2010 14:28:13 +0000 (16:28 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 4 Jul 2010 15:29:23 +0000 (17:29 +0200)
source3/include/proto.h
source3/lib/util.c
source3/nmbd/asyncdns.c
source3/nmbd/nmbd.c
source3/printing/print_cups.c
source3/printing/printing.c
source3/smbd/process.c
source3/smbd/server.c
source3/winbindd/winbindd.c
source3/winbindd/winbindd_dual.c

index 135820f1ce98bb94546bea2a8ec53a65a2d2f8f9..30a432521f3a74c853af731b371876077beeb7ad 100644 (file)
@@ -1226,8 +1226,9 @@ ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos
 int set_blocking(int fd, bool set);
 void smb_msleep(unsigned int t);
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
-                      struct event_context *ev_ctx,
-                      bool parent_longlived);
+                          struct event_context *ev_ctx,
+                          struct server_id id,
+                          bool parent_longlived);
 void *malloc_(size_t size);
 void *memalign_array(size_t el_size, size_t align, unsigned int count);
 void *calloc_array(size_t size, size_t nmemb);
index 1467c5445da12b18060c51086878718e22aa698d..2a4d0501fe0c0fc869f9b8652da47964936911b6 100644 (file)
@@ -873,6 +873,7 @@ void smb_msleep(unsigned int t)
 
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
                           struct event_context *ev_ctx,
+                          struct server_id id,
                           bool parent_longlived)
 {
        NTSTATUS status = NT_STATUS_OK;
@@ -899,7 +900,7 @@ NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
                 * For clustering, we need to re-init our ctdbd connection after the
                 * fork
                 */
-               status = messaging_reinit(msg_ctx, procid_self());
+               status = messaging_reinit(msg_ctx, id);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("messaging_reinit() failed: %s\n",
                                 nt_errstr(status)));
index 21ac5a0ff44a8f86835fd1523f50faf4e0179bdc..2701c96dd7994bcd2635838fcb349599abbf61ab 100644 (file)
@@ -137,6 +137,7 @@ void kill_async_dns_child(void)
 void start_async_dns(void)
 {
        int fd1[2], fd2[2];
+       NTSTATUS status;
 
        CatchChild();
 
@@ -164,8 +165,11 @@ void start_async_dns(void)
        CatchSignal(SIGHUP, SIG_IGN);
         CatchSignal(SIGTERM, sig_term);
 
-       if (!NT_STATUS_IS_OK(reinit_after_fork(nmbd_messaging_context(),
-                                              nmbd_event_context(), true))) {
+       status = reinit_after_fork(nmbd_messaging_context(),
+                                  nmbd_event_context(),
+                                  procid_self(), true);
+
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
index d13607b1f54c1fb5fb6e988eea997fbf1d36293f..dd42675cc60107cbede0f399ea1cb4b3f83256b4 100644 (file)
@@ -779,6 +779,7 @@ static bool open_sockets(bool isdaemon, int port)
        { NULL }
        };
        TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+       NTSTATUS status;
 
        load_case_tables();
 
@@ -923,8 +924,11 @@ static bool open_sockets(bool isdaemon, int port)
 
        pidfile_create("nmbd");
 
-       if (!NT_STATUS_IS_OK(reinit_after_fork(nmbd_messaging_context(),
-                                              nmbd_event_context(), false))) {
+       status = reinit_after_fork(nmbd_messaging_context(),
+                                  nmbd_event_context(),
+                                  procid_self(), false);
+
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                exit(1);
        }
index 043cc96930ea00c78076fa0708a66ee54602d823..cbefa07a3363a6ba1ed1d15e63fbdf2b2a558e4e 100644 (file)
@@ -397,6 +397,7 @@ static bool cups_pcap_load_async(int *pfd)
 {
        int fds[2];
        pid_t pid;
+       NTSTATUS status;
 
        *pfd = -1;
 
@@ -434,8 +435,10 @@ static bool cups_pcap_load_async(int *pfd)
 
        close_all_print_db();
 
-       if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(),
-                                              server_event_context(), true))) {
+       status = reinit_after_fork(server_messaging_context(),
+                                  server_event_context(), procid_self(),
+                                  true);
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
                smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
        }
index 93624f0f787da981a266ca76a6a7fe87fce1df59..1b5decc696a9184cebb781b4d99af098306fee8c 100644 (file)
@@ -1430,6 +1430,7 @@ void start_background_queue(void)
        if(background_lpq_updater_pid == 0) {
                struct tevent_fd *fde;
                int ret;
+               NTSTATUS status;
 
                /* Child. */
                DEBUG(5,("start_background_queue: background LPQ thread started\n"));
@@ -1437,9 +1438,11 @@ void start_background_queue(void)
                close(pause_pipe[0]);
                pause_pipe[0] = -1;
 
-               if (!NT_STATUS_IS_OK(reinit_after_fork(server_messaging_context(),
-                                                      server_event_context(),
-                                                      true))) {
+               status = reinit_after_fork(server_messaging_context(),
+                                          server_event_context(),
+                                          procid_self(), true);
+
+               if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("reinit_after_fork() failed\n"));
                        smb_panic("reinit_after_fork() failed");
                }
index 8c2060df1adf6b9fb7d50d7014decd0fc2ed766e..b0bae927b9897b8e2b1e8d4cf104a6559b0c624b 100644 (file)
@@ -2807,7 +2807,8 @@ static bool fork_echo_handler(struct smbd_server_connection *sconn)
                close(listener_pipe[0]);
 
                status = reinit_after_fork(smbd_messaging_context(),
-                                          smbd_event_context(), false);
+                                          smbd_event_context(),
+                                          procid_self(), false);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("reinit_after_fork failed: %s\n",
                                  nt_errstr(status)));
index a1250790cee2109d012415d4f7fc2d73450d1e1a..f30d7618654ab1e868ffe086b43b5b790677a6ae 100644 (file)
@@ -409,7 +409,8 @@ static void smbd_accept_connection(struct tevent_context *ev,
                s = NULL;
 
                status = reinit_after_fork(smbd_messaging_context(),
-                                          smbd_event_context(), true);
+                                          smbd_event_context(), procid_self(),
+                                          true);
                if (!NT_STATUS_IS_OK(status)) {
                        if (NT_STATUS_EQUAL(status,
                                            NT_STATUS_TOO_MANY_OPENED_FILES)) {
@@ -806,6 +807,7 @@ extern void build_options(bool screen);
        };
        struct smbd_parent_context *parent = NULL;
        TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+       NTSTATUS status;
 
        smbd_init_globals();
 
@@ -998,8 +1000,10 @@ extern void build_options(bool screen);
        if (is_daemon)
                pidfile_create("smbd");
 
-       if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(),
-                            smbd_event_context(), false))) {
+       status = reinit_after_fork(smbd_messaging_context(),
+                                  smbd_event_context(),
+                                  procid_self(), false);
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                exit(1);
        }
index 34fd271194c97303f48ec5c76b49782c8459f9ce..cdbf2d62ca6f1efc9a87a7b4d7158f7532fc6495 100644 (file)
@@ -1122,6 +1122,7 @@ int main(int argc, char **argv, char **envp)
        poptContext pc;
        int opt;
        TALLOC_CTX *frame = talloc_stackframe();
+       NTSTATUS status;
 
        /* glibc (?) likes to print "User defined signal 1" and exit if a
           SIGUSR[12] is received before a handler is installed */
@@ -1278,9 +1279,10 @@ int main(int argc, char **argv, char **envp)
         * winbindd-specific resources we must free yet. JRA.
         */
 
-       if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
-                                              winbind_event_context(),
-                                              false))) {
+       status = reinit_after_fork(winbind_messaging_context(),
+                                  winbind_event_context(),
+                                  procid_self(), false);
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                exit(1);
        }
index 2ae32e793c9ee49f7d128ab09c8c50285f107f16..e506d2a53acadb7983de5c605697d27ac68ad532 100644 (file)
@@ -1106,10 +1106,12 @@ bool winbindd_reinit_after_fork(const char *logfilename)
 {
        struct winbindd_domain *domain;
        struct winbindd_child *cl;
+       NTSTATUS status;
 
-       if (!NT_STATUS_IS_OK(reinit_after_fork(winbind_messaging_context(),
-                                              winbind_event_context(),
-                                              true))) {
+       status = reinit_after_fork(winbind_messaging_context(),
+                                  winbind_event_context(),
+                                  procid_self(), true);
+       if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                return false;
        }