s3: Lift the server_messaging_context from check_reload
[amitay/samba.git] / source3 / smbd / process.c
index d8ed563e1c16c3e9fa6c1a0735541c1afe5ee633..1d00e12c7e7577216b76b06a91e77271870a664c 100644 (file)
@@ -910,20 +910,20 @@ static void smbd_sig_hup_handler(struct tevent_context *ev,
                                  void *siginfo,
                                  void *private_data)
 {
+       struct messaging_context *msg_ctx = talloc_get_type_abort(
+               private_data, struct messaging_context);
        change_to_root_user();
        DEBUG(1,("Reloading services after SIGHUP\n"));
-       reload_services(False);
+       reload_services(msg_ctx, False);
 }
 
-void smbd_setup_sig_hup_handler(void)
+void smbd_setup_sig_hup_handler(struct tevent_context *ev,
+                               struct messaging_context *msg_ctx)
 {
        struct tevent_signal *se;
 
-       se = tevent_add_signal(smbd_event_context(),
-                              smbd_event_context(),
-                              SIGHUP, 0,
-                              smbd_sig_hup_handler,
-                              NULL);
+       se = tevent_add_signal(ev, ev, SIGHUP, 0, smbd_sig_hup_handler,
+                              msg_ctx);
        if (!se) {
                exit_server("failed to setup SIGHUP handler");
        }
@@ -2198,7 +2198,7 @@ void chain_reply(struct smb_request *req)
  Check if services need reloading.
 ****************************************************************************/
 
-void check_reload(time_t t)
+static void check_reload(struct messaging_context *msg_ctx, time_t t)
 {
        time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
 
@@ -2223,7 +2223,7 @@ void check_reload(time_t t)
        }
 
        if (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK) {
-               reload_services(True);
+               reload_services(msg_ctx, True);
                last_smb_conf_reload_time = t;
        }
 
@@ -2237,7 +2237,7 @@ void check_reload(time_t t)
                        || (t-last_printer_reload_time  < 0) ) 
                {
                        DEBUG( 3,( "Printcap cache time expired.\n"));
-                       reload_printers();
+                       reload_printers(msg_ctx);
                        last_printer_reload_time = t;
                }
        }
@@ -2469,10 +2469,10 @@ static bool housekeeping_fn(const struct timeval *now, void *private_data)
        change_to_root_user();
 
        /* update printer queue caches if necessary */
-       update_monitored_printq_cache();
+       update_monitored_printq_cache(smbd_messaging_context());
 
        /* check if we need to reload services */
-       check_reload(time(NULL));
+       check_reload(smbd_messaging_context(), time(NULL));
 
        /* Change machine password if neccessary. */
        attempt_machine_password_change();
@@ -2860,7 +2860,7 @@ fail:
 
 static bool spoolss_init_cb(void *ptr)
 {
-       return nt_printing_tdb_migrate();
+       return nt_printing_tdb_migrate(smbd_messaging_context());
 }
 
 /****************************************************************************
@@ -2949,7 +2949,7 @@ void smbd_process(void)
        /* this is needed so that we get decent entries
           in smbstatus for port 445 connects */
        set_remote_machine_name(remaddr, false);
-       reload_services(true);
+       reload_services(smbd_server_conn->msg_ctx, true);
 
        /*
         * Before the first packet, check the global hosts allow/ hosts deny