mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
r12941@catbus: nickm | 2007-05-24 16:25:00 -0400
Fix some eventdns dns server bugs, and add a new eventdns function to get the address of whoever requested this lookup. svn:r10316
This commit is contained in:
parent
a312afd67e
commit
17830bc03b
@ -1708,7 +1708,7 @@ evdns_server_request_respond(struct evdns_server_request *_req, int err)
|
||||
if (server_request_free(req))
|
||||
return 0;
|
||||
|
||||
if (req->port->pending_replies)
|
||||
if (port->pending_replies)
|
||||
server_port_flush(port);
|
||||
|
||||
return 0;
|
||||
@ -1797,7 +1797,8 @@ server_port_free(struct evdns_server_port *port)
|
||||
}
|
||||
(void) event_del(&port->event);
|
||||
CLEAR(&port->event);
|
||||
// XXXX actually free the port? -NM
|
||||
// XXXX020 actually free the port? -NM
|
||||
// XXXX yes, and fix up evdns_close_server_port to dtrt. -NM
|
||||
}
|
||||
|
||||
// exported function
|
||||
@ -1809,6 +1810,17 @@ evdns_server_request_drop(struct evdns_server_request *_req)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// exported function
|
||||
int
|
||||
evdns_server_request_get_requesting_addr(struct evdns_server_request *_req, struct sockaddr *sa, socklen_t addr_len)
|
||||
{
|
||||
struct server_request *req = TO_SERVER_REQUEST(_req);
|
||||
if (addr_len < req->addrlen)
|
||||
return -1;
|
||||
memcpy(sa, &(req->addr), req->addrlen);
|
||||
return req->addrlen;
|
||||
}
|
||||
|
||||
#undef APPEND16
|
||||
#undef APPEND32
|
||||
|
||||
|
@ -323,6 +323,9 @@ int evdns_server_request_add_aaaa_reply(struct evdns_server_request *req, const
|
||||
int evdns_server_request_add_ptr_reply(struct evdns_server_request *req, struct in_addr *in, const char *inaddr_name, const char *hostname, int ttl);
|
||||
int evdns_server_request_add_cname_reply(struct evdns_server_request *req, const char *name, const char *cname, int ttl);
|
||||
|
||||
struct sockaddr;
|
||||
int evdns_server_request_get_requesting_addr(struct evdns_server_request *req, struct sockaddr *sa, socklen_t addr_len);
|
||||
|
||||
int evdns_server_request_respond(struct evdns_server_request *req, int err);
|
||||
int evdns_server_request_drop(struct evdns_server_request *req);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user