mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
Use message system to notify when smb.conf is updated.
Jeremy.
(This used to be commit ae9eda5c3c
)
This commit is contained in:
@ -38,4 +38,6 @@
|
|||||||
/* rpc messages */
|
/* rpc messages */
|
||||||
#define MSG_PRINTER_NOTIFY 2001
|
#define MSG_PRINTER_NOTIFY 2001
|
||||||
|
|
||||||
|
#define MSG_SMB_CONF_UPDATED 3001
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,6 +94,16 @@ static void init_srv_share_info_2(SRV_SHARE_INFO_2 *sh2, int snum)
|
|||||||
init_srv_share_info2_str(&sh2->info_2_str, net_name, remark, path, passwd);
|
init_srv_share_info2_str(&sh2->info_2_str, net_name, remark, path, passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
What to do when smb.conf is updated.
|
||||||
|
********************************************************************/
|
||||||
|
|
||||||
|
static void smb_conf_updated(int msg_type, pid_t src, void *buf, size_t len)
|
||||||
|
{
|
||||||
|
DEBUG(10,("smb_conf_updated: Got message saying smb.conf was updated. Reloading.\n"));
|
||||||
|
reload_services(False);
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Create the share security tdb.
|
Create the share security tdb.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
@ -123,6 +133,8 @@ BOOL share_info_db_init(void)
|
|||||||
tdb_store_int(share_tdb, vstring, SHARE_DATABASE_VERSION);
|
tdb_store_int(share_tdb, vstring, SHARE_DATABASE_VERSION);
|
||||||
}
|
}
|
||||||
tdb_unlock_bystring(share_tdb, vstring);
|
tdb_unlock_bystring(share_tdb, vstring);
|
||||||
|
|
||||||
|
message_register(MSG_SMB_CONF_UPDATED, smb_conf_updated);
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
@ -1288,8 +1300,9 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
|
|||||||
return ERROR_ACCESS_DENIED;
|
return ERROR_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send SIGHUP to process group. */
|
/* Tell everyone we updated smb.conf. */
|
||||||
kill(0, SIGHUP);
|
message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG(10,("_srv_net_share_set_info: No change to share name (%s)\n", share_name ));
|
DEBUG(10,("_srv_net_share_set_info: No change to share name (%s)\n", share_name ));
|
||||||
}
|
}
|
||||||
@ -1407,11 +1420,11 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S
|
|||||||
share_name ));
|
share_name ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send SIGHUP to process group. */
|
/* Tell everyone we updated smb.conf. */
|
||||||
kill(0, SIGHUP);
|
message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't call reload_services() here, the SIGHUP will
|
* We don't call reload_services() here, the message will
|
||||||
* cause this to be done before the next packet is read
|
* cause this to be done before the next packet is read
|
||||||
* from the client. JRA.
|
* from the client. JRA.
|
||||||
*/
|
*/
|
||||||
@ -1470,8 +1483,8 @@ uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_S
|
|||||||
/* Delete the SD in the database. */
|
/* Delete the SD in the database. */
|
||||||
delete_share_security(snum);
|
delete_share_security(snum);
|
||||||
|
|
||||||
/* Send SIGHUP to process group. */
|
/* Tell everyone we updated smb.conf. */
|
||||||
kill(0, SIGHUP);
|
message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False);
|
||||||
|
|
||||||
lp_killservice(snum);
|
lp_killservice(snum);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user