s3: Centralize nmbd_messaging_context in nmbd.c
authorVolker Lendecke <vl@samba.org>
Tue, 13 Dec 2011 15:48:11 +0000 (16:48 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 14 Dec 2011 16:34:20 +0000 (17:34 +0100)
source3/nmbd/asyncdns.c
source3/nmbd/nmbd.c
source3/nmbd/nmbd_packets.c
source3/nmbd/nmbd_proto.h

index 649b9db7f7e976f963412e3cf9d9b03e13be5060..a42ad25c20bd5485464400e5b5dd956785394b75 100644 (file)
@@ -135,7 +135,7 @@ void kill_async_dns_child(void)
 /***************************************************************************
   create a child process to handle DNS lookups
   ****************************************************************************/
-void start_async_dns(void)
+void start_async_dns(struct messaging_context *msg)
 {
        int fd1[2], fd2[2];
        NTSTATUS status;
@@ -166,9 +166,7 @@ void start_async_dns(void)
        CatchSignal(SIGHUP, SIG_IGN);
         CatchSignal(SIGTERM, sig_term);
 
-       status = reinit_after_fork(nmbd_messaging_context(),
-                                  nmbd_event_context(),
-                                  true);
+       status = reinit_after_fork(msg, nmbd_event_context(), true);
 
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
@@ -205,7 +203,7 @@ static bool write_child(struct packet_struct *p)
 /***************************************************************************
   check the DNS queue
   ****************************************************************************/
-void run_dns_queue(void)
+void run_dns_queue(struct messaging_context *msg)
 {
        struct query_record r;
        struct packet_struct *p, *p2;
@@ -218,7 +216,7 @@ void run_dns_queue(void)
        if (!process_exists_by_pid(child_pid)) {
                close(fd_in);
                close(fd_out);
-               start_async_dns();
+               start_async_dns(msg);
        }
 
        status = read_data(fd_in, (char *)&r, sizeof(r));
index 7dff92a502a1e77abd6ea86d091918d81b9bdf3a..95bb89bb05ddd9c2dd028541fb68363f65bd2eb4 100644 (file)
@@ -480,7 +480,8 @@ static void process(void)
                 * (nmbd_packets.c)
                 */
 
-               if(listen_for_packets(run_election)) {
+               if (listen_for_packets(nmbd_messaging_context(),
+                                      run_election)) {
                        TALLOC_FREE(frame);
                        return;
                }
@@ -905,7 +906,7 @@ static bool open_sockets(bool isdaemon, int port)
        /* Setup the async dns. We do it here so it doesn't have all the other
                stuff initialised and thus chewing memory and sockets */
        if(lp_we_are_a_wins_server() && lp_dns_proxy()) {
-               start_async_dns();
+               start_async_dns(nmbd_messaging_context());
        }
 #endif
 
index c7ecfc6d3668a9ac456bc1720103f220dc985973..da38dcfbfeb5350da0da142e4c46d214fe81847e 100644 (file)
@@ -1864,7 +1864,7 @@ static void free_processed_packet_list(struct processed_packet **pp_processed_pa
   return True if the socket is dead
 ***************************************************************************/
 
-bool listen_for_packets(bool run_election)
+bool listen_for_packets(struct messaging_context *msg, bool run_election)
 {
        static struct pollfd *fds = NULL;
        static struct socket_attributes *attrs = NULL;
@@ -1948,7 +1948,7 @@ bool listen_for_packets(bool run_election)
 #ifndef SYNC_DNS
        if ((dns_fd != -1) && (dns_pollidx != -1) &&
            (fds[dns_pollidx].revents & (POLLIN|POLLHUP|POLLERR))) {
-               run_dns_queue();
+               run_dns_queue(msg);
        }
 #endif
 
index 0258b4a478bd581de84c408d2e06669268304834..0e62bc0d0ea80d0b0eb08b6fb00728dbbb5c0b77 100644 (file)
@@ -28,8 +28,8 @@
 
 int asyncdns_fd(void);
 void kill_async_dns_child(void);
-void start_async_dns(void);
-void run_dns_queue(void);
+void start_async_dns(struct messaging_context *msg);
+void run_dns_queue(struct messaging_context *msg);
 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
 void kill_async_dns_child(void);
@@ -264,7 +264,7 @@ void reply_netbios_packet(struct packet_struct *orig_packet,
 void queue_packet(struct packet_struct *packet);
 void run_packet_queue(void);
 void retransmit_or_expire_response_records(time_t t);
-bool listen_for_packets(bool run_election);
+bool listen_for_packets(struct messaging_context *msg, bool run_election);
 bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
                    const char *srcname, int src_type,
                    const char *dstname, int dest_type,