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");
}
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();
}
if (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK) {
- reload_services(True);
+ reload_services(msg_ctx, True);
last_smb_conf_reload_time = 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;
}
}
*/
static bool deadtime_fn(const struct timeval *now, void *private_data)
{
- struct smbd_server_connection *sconn = smbd_server_conn;
+ struct smbd_server_connection *sconn =
+ (struct smbd_server_connection *)private_data;
if (sconn->using_smb2) {
/* TODO: implement real idle check */
return true;
}
DEBUG( 2, ( "Closing idle SMB2 connection\n" ) );
- messaging_send(smbd_messaging_context(), procid_self(),
+ messaging_send(sconn->msg_ctx, procid_self(),
MSG_SHUTDOWN, &data_blob_null);
return false;
}
if ((conn_num_open(sconn) == 0)
|| (conn_idle_all(sconn, now->tv_sec))) {
DEBUG( 2, ( "Closing idle SMB1 connection\n" ) );
- messaging_send(smbd_messaging_context(), procid_self(),
+ messaging_send(sconn->msg_ctx, procid_self(),
MSG_SHUTDOWN, &data_blob_null);
return False;
}
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();
close(listener_pipe[0]);
- status = reinit_after_fork(smbd_messaging_context(),
+ status = reinit_after_fork(sconn->msg_ctx,
smbd_event_context(),
procid_self(), false);
if (!NT_STATUS_IS_OK(status)) {
static bool spoolss_init_cb(void *ptr)
{
- return nt_printing_tdb_migrate();
+ return nt_printing_tdb_migrate(smbd_messaging_context());
}
/****************************************************************************
/* 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
if (!(event_add_idle(smbd_event_context(), NULL,
timeval_set(IDLE_CLOSED_TIMEOUT, 0),
- "deadtime", deadtime_fn, NULL))) {
+ "deadtime", deadtime_fn, smbd_server_conn))) {
DEBUG(0, ("Could not add deadtime event\n"));
exit(1);
}