Merge branch 'master' of ssh://git.samba.org/data/git/samba into selftest
[kai/samba-autobuild/.git] / source4 / smbd / process_standard.c
index c088ea3b1a3a5b9c29b9cb1ff731c8ee3b6c3561..0a864dabb2a27d88684e6ca5f4fb56b24021cfc4 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "includes.h"
 #include "lib/events/events.h"
-#include "lib/tdb/include/tdb.h"
+#include "../tdb/include/tdb.h"
 #include "lib/socket/socket.h"
 #include "smbd/process_model.h"
 #include "param/secrets.h"
@@ -92,7 +92,7 @@ static void standard_accept_connection(struct event_context *ev,
        pid = getpid();
 
        /* This is now the child code. We need a completely new event_context to work with */
-       ev2 = event_context_init(NULL);
+       ev2 = s4_event_context_init(NULL);
 
        /* the service has given us a private pointer that
           encapsulates the context it needs for this new connection -
@@ -127,8 +127,8 @@ static void standard_accept_connection(struct event_context *ev,
        talloc_free(c);
        talloc_free(s);
 
-       /* setup this new connection */
-       new_conn(ev2, lp_ctx, sock2, cluster_id(pid), private);
+       /* setup this new connection.  Cluster ID is PID based for this process modal */
+       new_conn(ev2, lp_ctx, sock2, cluster_id(pid, 0), private);
 
        /* we can't return to the top level here, as that event context is gone,
           so we now process events in the new event context until there are no
@@ -144,6 +144,7 @@ static void standard_accept_connection(struct event_context *ev,
 */
 static void standard_new_task(struct event_context *ev, 
                              struct loadparm_context *lp_ctx,
+                             const char *service_name,
                              void (*new_task)(struct event_context *, struct loadparm_context *lp_ctx, struct server_id , void *), 
                              void *private)
 {
@@ -160,7 +161,7 @@ static void standard_new_task(struct event_context *ev,
        pid = getpid();
 
        /* This is now the child code. We need a completely new event_context to work with */
-       ev2 = event_context_init(NULL);
+       ev2 = s4_event_context_init(NULL);
 
        /* the service has given us a private pointer that
           encapsulates the context it needs for this new connection -
@@ -179,10 +180,10 @@ static void standard_new_task(struct event_context *ev,
        /* Ensure that the forked children do not expose identical random streams */
        set_need_random_reseed();
 
-       setproctitle("task server_id[%d]", pid);
+       setproctitle("task %s server_id[%d]", service_name, pid);
 
-       /* setup this new connection */
-       new_task(ev2, lp_ctx, cluster_id(pid), private);
+       /* setup this new task.  Cluster ID is PID based for this process modal */
+       new_task(ev2, lp_ctx, cluster_id(pid, 0), private);
 
        /* we can't return to the top level here, as that event context is gone,
           so we now process events in the new event context until there are no
@@ -195,16 +196,14 @@ static void standard_new_task(struct event_context *ev,
 
 
 /* called when a task goes down */
-_NORETURN_ static void standard_terminate(struct event_context *ev, const char *reason) 
+_NORETURN_ static void standard_terminate(struct event_context *ev, struct loadparm_context *lp_ctx, 
+                                         const char *reason) 
 {
        DEBUG(2,("standard_terminate: reason[%s]\n",reason));
 
        /* this reload_charcnv() has the effect of freeing the iconv context memory,
           which makes leak checking easier */
-       reload_charcnv(global_loadparm);
-
-       /* the secrets db should really hang off the connection structure */
-       secrets_shutdown();
+       reload_charcnv(lp_ctx);
 
        talloc_free(ev);