summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/server.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2014-12-18 23:26:14 +0000
committerBrad Smith <brad@cvs.openbsd.org>2014-12-18 23:26:14 +0000
commit7e41ca48cdadb444707d45fe93aa3aa8c48fcfc9 (patch)
tree8c7e8200f1db8947cbd43aa8029a29cd77394260 /usr.sbin/nsd/server.c
parentac3028fa62d940529fecac4c3f01c3304e379fba (diff)
Merge in some commits from upstream..
- Fix that failure to add tcp to tcp base does not leak the socket. - Fixes for wildcard addition and deletion, speedup for some cases. - Fix that queries for noname CH TXT are REFUSED instead of nodata. - Fix #616: retry xfer for zones with no content after command. - Fix that expired zones stay expired after a server restart. - RFC 7344: CDS and CDNSKEY (read in). ok sthen@
Diffstat (limited to 'usr.sbin/nsd/server.c')
-rw-r--r--usr.sbin/nsd/server.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/nsd/server.c b/usr.sbin/nsd/server.c
index 22cfff7897c..0c8ca29c754 100644
--- a/usr.sbin/nsd/server.c
+++ b/usr.sbin/nsd/server.c
@@ -2522,10 +2522,18 @@ handle_tcp_accept(int fd, short event, void* arg)
event_set(&tcp_data->event, s, EV_PERSIST | EV_READ | EV_TIMEOUT,
handle_tcp_reading, tcp_data);
- if(event_base_set(data->event.ev_base, &tcp_data->event) != 0)
- log_msg(LOG_ERR, "cannot set tcp event base");
- if(event_add(&tcp_data->event, &timeout) != 0)
+ if(event_base_set(data->event.ev_base, &tcp_data->event) != 0) {
log_msg(LOG_ERR, "cannot set tcp event base");
+ close(s);
+ region_destroy(tcp_region);
+ return;
+ }
+ if(event_add(&tcp_data->event, &timeout) != 0) {
+ log_msg(LOG_ERR, "cannot add tcp to event base");
+ close(s);
+ region_destroy(tcp_region);
+ return;
+ }
/*
* Keep track of the total number of TCP handlers installed so