s3: nmbd: Now attrs array mirrors fd's array use it in preference.
authorJeremy Allison <jra@samba.org>
Fri, 23 Sep 2016 19:16:58 +0000 (12:16 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 20 Oct 2016 08:45:25 +0000 (10:45 +0200)
This will allow us to eventually remove source3/lib/events.c
dependency and make nmbd purely tevent based.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 376e04656b6755d1a182430b39273a93495d00b2)

source3/nmbd/nmbd_packets.c

index 26486797de702c2bbe647059206dd6425e79e1a9..732192238348a306b434d9e00a4444ad394c501b 100644 (file)
@@ -2004,7 +2004,7 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
                        client_port = DGRAM_PORT;
                }
 
-               packet = read_packet(fds[i].fd, packet_type);
+               packet = read_packet(attrs[i].fd, packet_type);
                if (!packet) {
                        continue;
                }
@@ -2014,7 +2014,7 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
                 * only is set then check it came from one of our local nets.
                 */
                if (lp_bind_interfaces_only() &&
-                   (fds[i].fd == client_fd) &&
+                   (attrs[i].fd == client_fd) &&
                    (!is_local_net_v4(packet->ip))) {
                        DEBUG(7,("discarding %s packet sent to broadcast socket from %s:%d\n",
                                packet_name, inet_ntoa(packet->ip), packet->port));
@@ -2053,10 +2053,10 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
 
                if (attrs[i].broadcast) {
                        /* this is a broadcast socket */
-                       packet->send_fd = fds[i-1].fd;
+                       packet->send_fd = attrs[i-1].fd;
                } else {
                        /* this is already a unicast socket */
-                       packet->send_fd = fds[i].fd;
+                       packet->send_fd = attrs[i].fd;
                }
 
                queue_packet(packet);