From 78d4d66b81c55eeac0b4414ec8433c4ec9c53a5b Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Thu, 10 Feb 2005 03:25:40 +0000 Subject: [PATCH] Fix a resolver crash and an v4-compatible address parsing crash. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1310 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 10 ++++++++++ ircd/ircd_res.c | 2 +- ircd/ircd_string.c | 1 + ircd/test/ircd_in_addr_t.c | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d1ce540..692d995 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-02-09 Michael Poole + + * ircd/ircd_res.c (check_resolver_timeout): Try another way to + avoid timer_chg() on a non-queued/active timer. + + * ircd/ircd_string.c (ircd_aton): Set part_start to handle input + strings like "::127.0.0.1". + + * ircd/test/ircd_in_addr_t.c (test_addrs): Add a test for that. + 2005-02-02 Michael Poole * Makefile.in (install): Do not create ${prefix}/include since it diff --git a/ircd/ircd_res.c b/ircd/ircd_res.c index e56c6cd..6ed8666 100644 --- a/ircd/ircd_res.c +++ b/ircd/ircd_res.c @@ -278,7 +278,7 @@ check_resolver_timeout(time_t when) { if (when > CurrentTime + AR_TTL) when = CurrentTime + AR_TTL; - if (!t_onqueue(&res_timeout)) + if (!t_active(&res_timeout) || !t_onqueue(&res_timeout)) timer_add(&res_timeout, timeout_resolver, NULL, TT_ABSOLUTE, when); else if (when < t_expire(&res_timeout)) timer_chg(&res_timeout, TT_ABSOLUTE, when); diff --git a/ircd/ircd_string.c b/ircd/ircd_string.c index fab7c71..8f0cd09 100644 --- a/ircd/ircd_string.c +++ b/ircd/ircd_string.c @@ -596,6 +596,7 @@ ircd_aton(struct irc_in_addr *ip, const char *input) return 0; colon = 0; pos += 2; + part_start = input + pos; } while (ii < 8) { unsigned char chval; diff --git a/ircd/test/ircd_in_addr_t.c b/ircd/test/ircd_in_addr_t.c index 90dd319..4694d67 100644 --- a/ircd/test/ircd_in_addr_t.c +++ b/ircd/test/ircd_in_addr_t.c @@ -34,6 +34,9 @@ static struct address_test test_addrs[] = { { "::ffff:127.0.0.3", "127.0.0.3", {{ 0, 0, 0, 0, 0, 0xffff, 0x7f00, 3 }}, "B]AAAD", "B]AAAD", 1, 1, 1 }, + { "::127.0.0.1", "127.0.0.1", + {{ 0, 0, 0, 0, 0, 0, 0x7f00, 1 }}, + "B]AAAB", "B]AAAB", 1, 1, 1 }, { "2002:7f00:3::1", "2002:7f00:3::1", {{ 0x2002, 0x7f00, 3, 0, 0, 0, 0, 1 }}, "B]AAAD", "CACH8AAAD_AAB", 1, 0, 0 }, -- 2.20.1