s3: nmbd: Ensure attrs array mirrors fd's array for dns.
authorJeremy Allison <jra@samba.org>
Fri, 23 Sep 2016 19:12:43 +0000 (12:12 -0700)
committerVolker Lendecke <vl@samba.org>
Sat, 24 Sep 2016 17:52:08 +0000 (19:52 +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>
source3/nmbd/nmbd_packets.c

index 619cc9a..2648679 100644 (file)
@@ -1919,8 +1919,23 @@ bool listen_for_packets(struct messaging_context *msg, bool run_election)
                if (fds == NULL) {
                        return true;
                }
+               attrs = talloc_realloc(NULL,
+                                       attrs,
+                                       struct socket_attributes,
+                                       num_sockets + 1);
+               if (attrs == NULL) {
+                       TALLOC_FREE(fds);
+                       return true;
+               }
                dns_pollidx = num_sockets;
                fds[num_sockets].fd = dns_fd;
+               attrs[dns_pollidx].fd = dns_fd;
+               /*
+                * dummy values, we only need
+                * fd and triggered.
+                */
+               attrs[dns_pollidx].type = NMB_PACKET;
+               attrs[dns_pollidx].broadcast = false;
                num_sockets += 1;
        }
 #endif