Use message system to notify when smb.conf is updated.
authorJeremy Allison <jra@samba.org>
Tue, 10 Apr 2001 01:44:45 +0000 (01:44 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 10 Apr 2001 01:44:45 +0000 (01:44 +0000)
Jeremy.
(This used to be commit ae9eda5c3c3bbfc8ec795b43ab18dc492e5fdcf6)

source3/include/messages.h
source3/rpc_server/srv_srvsvc_nt.c

index 513f7b24a18d5cc65f723cec75bb403a959c7162..fb88ddbd0e1be8d0d100b0e559fe1dc9612545b6 100644 (file)
@@ -38,4 +38,6 @@
 /* rpc messages */
 #define MSG_PRINTER_NOTIFY 2001
 
+#define MSG_SMB_CONF_UPDATED 3001
+
 #endif
index b3a5d1a901c49ae3e7aa5a5d22fb2c5ffd710236..cef31f7a8cabf40c9d3949f1dd44ccf36ba1bb6f 100644 (file)
@@ -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);
 }
 
+/*******************************************************************
+ 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.
  ********************************************************************/
@@ -123,6 +133,8 @@ BOOL share_info_db_init(void)
         tdb_store_int(share_tdb, vstring, SHARE_DATABASE_VERSION);
     }
     tdb_unlock_bystring(share_tdb, vstring);
+
+       message_register(MSG_SMB_CONF_UPDATED, smb_conf_updated);
  
     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;
                }
 
-               /* Send SIGHUP to process group. */
-               kill(0, SIGHUP);
+               /* Tell everyone we updated smb.conf. */
+               message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False);
+
        } else {
                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 ));
        }
 
-       /* Send SIGHUP to process group. */
-       kill(0, SIGHUP);
+       /* Tell everyone we updated smb.conf. */
+       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
         * 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_share_security(snum);
 
-       /* Send SIGHUP to process group. */
-       kill(0, SIGHUP);
+       /* Tell everyone we updated smb.conf. */
+       message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False);
 
        lp_killservice(snum);