From: Jeremy Allison Date: Fri, 23 Sep 2016 19:16:58 +0000 (-0700) Subject: s3: nmbd: Now attrs array mirrors fd's array use it in preference. X-Git-Tag: samba-4.3.12~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9236d1cf58b33af598141a142f6e4fc2e4d491f5;p=thirdparty%2Fsamba.git s3: nmbd: Now attrs array mirrors fd's array use it in preference. 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 Reviewed-by: Volker Lendecke (cherry picked from commit 376e04656b6755d1a182430b39273a93495d00b2) --- diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 1b59d6bcdf4..77add59bdee 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -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);