summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-09-23 12:05:59 -0700
committerKarolin Seeger <kseeger@samba.org>2016-10-20 10:43:27 +0200
commit447b640638d616bb39916b55191a5f22a90d4e43 (patch)
treee498c7f3c3326d25445a121c456552d440382215
parentde63f7dc012336364dee930541e1008324863892 (diff)
downloadsamba-447b640638d616bb39916b55191a5f22a90d4e43.tar.gz
s3: nmbd: Add fd, triggered elements to struct socket_attributes.
Zero the attrs array on allocation, and mirror the fd's. 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 d8ade0730797df22bfe28847e034eb6d116b0e00)
-rw-r--r--source3/nmbd/nmbd_packets.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 65c8a73753e..ddbc2a0efdc 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1683,6 +1683,8 @@ on subnet %s\n", rrec->response_id, inet_ntoa(rrec->packet->ip), subrec->subnet_
struct socket_attributes {
enum packet_type type;
bool broadcast;
+ int fd;
+ bool triggered;
};
static bool create_listen_pollfds(struct pollfd **pfds,
@@ -1723,7 +1725,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
return true;
}
- attrs = talloc_array(NULL, struct socket_attributes, count);
+ attrs = talloc_zero_array(NULL, struct socket_attributes, count);
if (attrs == NULL) {
DEBUG(1, ("create_listen_pollfds: malloc fail for attrs. "
"size %d\n", count));
@@ -1734,11 +1736,13 @@ static bool create_listen_pollfds(struct pollfd **pfds,
num = 0;
fds[num].fd = ClientNMB;
+ attrs[num].fd = ClientNMB;
attrs[num].type = NMB_PACKET;
attrs[num].broadcast = false;
num += 1;
fds[num].fd = ClientDGRAM;
+ attrs[num].fd = ClientDGRAM;
attrs[num].type = DGRAM_PACKET;
attrs[num].broadcast = false;
num += 1;
@@ -1747,6 +1751,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
if (subrec->nmb_sock != -1) {
fds[num].fd = subrec->nmb_sock;
+ attrs[num].fd = subrec->nmb_sock;
attrs[num].type = NMB_PACKET;
attrs[num].broadcast = false;
num += 1;
@@ -1754,6 +1759,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
if (subrec->nmb_bcast != -1) {
fds[num].fd = subrec->nmb_bcast;
+ attrs[num].fd = subrec->nmb_bcast;
attrs[num].type = NMB_PACKET;
attrs[num].broadcast = true;
num += 1;
@@ -1761,6 +1767,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
if (subrec->dgram_sock != -1) {
fds[num].fd = subrec->dgram_sock;
+ attrs[num].fd = subrec->dgram_sock;
attrs[num].type = DGRAM_PACKET;
attrs[num].broadcast = false;
num += 1;
@@ -1768,6 +1775,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
if (subrec->dgram_bcast != -1) {
fds[num].fd = subrec->dgram_bcast;
+ attrs[num].fd = subrec->dgram_bcast;
attrs[num].type = DGRAM_PACKET;
attrs[num].broadcast = true;
num += 1;