* The authors takes no responsibility for any damage or loss
* of property which results from the use of this software.
*
- * $Id: res.c 2023 2006-09-02 23:47:27Z jilles $
+ * $Id: res.c 3301 2007-03-28 15:04:06Z jilles $
* from Hybrid Id: res.c 459 2006-02-12 22:21:37Z db $
*
* July 1999 - Rewrote a bunch of stuff here. Change hostent builder code,
if (res_fd <= 0) /* there isn't any such thing as fd 0, that's just a myth. */
{
- if ((res_fd = comm_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0,
+ if ((res_fd = rb_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0,
"UDP resolver socket")) == -1)
return;
/* At the moment, the resolver FD data is global .. */
- comm_setselect(res_fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0);
+ rb_setselect(res_fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0);
eventAdd("timeout_resolver", timeout_resolver, NULL, 1);
}
}
*/
void restart_resolver(void)
{
- comm_close(res_fd);
+ rb_close(res_fd);
res_fd = -1;
eventDelete(timeout_resolver, NULL); /* -ddosen */
start_resolver();
if (max_queries == 0)
max_queries = 1;
- for (i = 0; i < max_queries; i++)
+ for (i = 0; sent < max_queries && i < irc_nscount; i++)
{
if (sendto(res_fd, msg, len, 0,
(struct sockaddr *)&(irc_nsaddr_list[i]),
{
char host_name[HOSTLEN + 1];
- strlcpy(host_name, name, HOSTLEN);
+ strlcpy(host_name, name, HOSTLEN + 1);
add_local_domain(host_name, HOSTLEN);
if (request == NULL)
struct sockaddr_in *v4 = (struct sockaddr_in *)addr;
cp = (const unsigned char *)&v4->sin_addr.s_addr;
- ircsprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]),
+ rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]),
(unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0]));
}
#ifdef IPV6
else if (n == 0)
return (0); /* no more answers left */
- strlcpy(request->name, hostbuf, HOSTLEN);
+ strlcpy(request->name, hostbuf, HOSTLEN + 1);
return (1);
break;
/* Re-schedule a read *after* recvfrom, or we'll be registering
* interest where it'll instantly be ready for read :-) -- adrian
*/
- comm_setselect(fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0);
+ rb_setselect(fd, FDLIST_NONE, COMM_SELECT_READ, res_readreply, NULL, 0);
/* Better to cast the sizeof instead of rc */
if (rc <= (int)(sizeof(HEADER)))
return;