diff options
-rw-r--r-- | source3/smbd/process.c | 21 | ||||
-rw-r--r-- | source3/smbd/server.c | 21 |
2 files changed, 30 insertions, 12 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index e57faf1978..2b35680949 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -925,6 +925,22 @@ void smbd_setup_sig_hup_handler(struct smbd_server_connection *sconn) } } +static void smbd_conf_updated(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) +{ + struct smbd_server_connection *sconn = + talloc_get_type_abort(private_data, + struct smbd_server_connection); + + DEBUG(10,("smbd_conf_updated: Got message saying smb.conf was " + "updated. Reloading.\n")); + change_to_root_user(); + reload_services(sconn->msg_ctx, sconn->sock, False); +} + static NTSTATUS smbd_server_connection_loop_once(struct tevent_context *ev_ctx, struct smbd_server_connection *conn) { @@ -3254,6 +3270,11 @@ void smbd_process(struct tevent_context *ev_ctx, messaging_register(sconn->msg_ctx, sconn, ID_CACHE_KILL, smbd_id_cache_kill); + messaging_deregister(sconn->msg_ctx, + MSG_SMB_CONF_UPDATED, sconn->ev_ctx); + messaging_register(sconn->msg_ctx, sconn, + MSG_SMB_CONF_UPDATED, smbd_conf_updated); + /* * Use the default MSG_DEBUG handler to avoid rebroadcasting * MSGs to all child processes diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 7e1bddd23b..e58128ea58 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -87,23 +87,20 @@ extern int dcelogin_atmost_once; What to do when smb.conf is updated. ********************************************************************/ -static void smb_conf_updated(struct messaging_context *msg, - void *private_data, - uint32_t msg_type, - struct server_id server_id, - DATA_BLOB *data) +static void smbd_parent_conf_updated(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data) { struct tevent_context *ev_ctx = talloc_get_type_abort(private_data, struct tevent_context); - struct smbd_server_connection *sconn = msg_ctx_to_sconn(msg); - DEBUG(10,("smb_conf_updated: Got message saying smb.conf was " + DEBUG(10,("smbd_parent_conf_updated: Got message saying smb.conf was " "updated. Reloading.\n")); change_to_root_user(); - reload_services(msg, sconn->sock, False); - if (am_parent) { - printing_subsystem_update(ev_ctx, msg, false); - } + reload_services(msg, -1, false); + printing_subsystem_update(ev_ctx, msg, false); } /******************************************************************* @@ -801,7 +798,7 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, messaging_register(msg_ctx, NULL, MSG_SHUTDOWN, msg_exit_server); messaging_register(msg_ctx, ev_ctx, MSG_SMB_CONF_UPDATED, - smb_conf_updated); + smbd_parent_conf_updated); messaging_register(msg_ctx, NULL, MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete); messaging_register(msg_ctx, NULL, MSG_DEBUG, smbd_msg_debug); |