Merge branch 'v4-0-logon' of git://git.id10ts.net/samba into 4-0-local
[tprouty/samba.git] / source4 / smbd / process_standard.c
index e013f9cd0e16aa8b7da2704c1e8bf59a8184d458..deb44c0a6860529f4d0b61bec7efb44d35ed5f06 100644 (file)
@@ -29,6 +29,7 @@
 #include "param/secrets.h"
 #include "system/filesys.h"
 #include "cluster/cluster.h"
+#include "param/param.h"
 
 #ifdef HAVE_SETPROCTITLE
 #ifdef HAVE_SETPROCTITLE_H
@@ -55,8 +56,10 @@ static void standard_model_init(struct event_context *ev)
   called when a listening socket becomes readable. 
 */
 static void standard_accept_connection(struct event_context *ev, 
+                                      struct loadparm_context *lp_ctx,
                                       struct socket_context *sock, 
-                                      void (*new_conn)(struct event_context *, struct socket_context *, 
+                                      void (*new_conn)(struct event_context *,
+                                                       struct loadparm_context *, struct socket_context *, 
                                                        struct server_id , void *), 
                                       void *private)
 {
@@ -124,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, 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
@@ -140,7 +143,9 @@ static void standard_accept_connection(struct event_context *ev,
   called to create a new server task
 */
 static void standard_new_task(struct event_context *ev, 
-                             void (*new_task)(struct event_context *, struct server_id , void *), 
+                             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)
 {
        pid_t pid;
@@ -175,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, 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
@@ -197,7 +202,7 @@ _NORETURN_ static void standard_terminate(struct event_context *ev, const char *
 
        /* this reload_charcnv() has the effect of freeing the iconv context memory,
           which makes leak checking easier */
-       reload_charcnv();
+       reload_charcnv(global_loadparm);
 
        /* the secrets db should really hang off the connection structure */
        secrets_shutdown();