diff --git a/Changes b/Changes index 4316179eb..adea13016 100644 --- a/Changes +++ b/Changes @@ -1766,3 +1766,4 @@ seen. gmtime warning still there - Fixed bug #0000601 reported by cate where specifying just a :port number for set::scan::endpoint caused a seg fault. - Added some patches by Syzop to fix a variety of different bugs +- Added some bugfixes for IPv6 and others by Syzop diff --git a/src/match.c b/src/match.c index b71424f6f..1e3fedb0d 100644 --- a/src/match.c +++ b/src/match.c @@ -95,6 +95,7 @@ static inline int match2(char *mask, char *name) cm = *m; if (cm == '\\') /* don't do ? checking if a \ */ { + cm = *(++m); /* just skip this char, no ? checking */ } else if (cm == '?') /* if it's a ? */ @@ -139,6 +140,7 @@ static inline int match2(char *mask, char *name) if (cm == '\\') /* next char will not be a wildcard. */ { /* skip wild checking, don't continue */ cm = lc(*(++m)); + n++; } /* Complicated to read, but to save CPU time. Every ounce counts. */ if (lc(*n) != cm) /* if the current chars don't equal, */ diff --git a/src/res.c b/src/res.c index 1b165835e..ff6cc190b 100644 --- a/src/res.c +++ b/src/res.c @@ -1155,6 +1155,7 @@ struct hostent *get_res(char *lp,long id) bcopy((char *)&rptr->cinfo, lp, sizeof(Link)); } #else +/* WIN32 */ he = rptr->he; if (he && he->h_name && ((struct IN_ADDR *)he->h_addr)->S_ADDR && rptr->locked < 2) @@ -1367,13 +1368,8 @@ static void update_list(ResRQ *rptr, aCache *cachep) /* * Do the same again for IP#'s. */ -#ifdef INET6 for (s = (char *)HE(rptr)->h_addr.S_ADDR; - ((struct IN_ADDR *)s)->S_ADDR; s += sizeof(struct IN_ADDR)) -#else - for (s = (char *)&HE(rptr)->h_addr.S_ADDR; - ((struct IN_ADDR *)s)->S_ADDR; s += sizeof(struct IN_ADDR)) -#endif + WHOSTENTP(((struct IN_ADDR *)s)->S_ADDR); s += sizeof(struct IN_ADDR)) { #ifdef INET6 for (i = 0; (t = HE(cp)->h_addr_list[i]); i++) @@ -1403,10 +1399,18 @@ static void update_list(ResRQ *rptr, aCache *cachep) base = (char **)MyRealloc((char *)ab, (addrcount + 1) * sizeof(*ab)); HE(cp)->h_addr_list = base; + ab = (struct IN_ADDR **)HE(cp)->h_addr_list; /* Update after realloc -- Syzop */ #ifdef DEBUGMODE + #ifdef INET6 + Debug((DEBUG_DNS, "u_l:add IP %s hal %x ac %d", + inet_ntop(((struct IN_ADDR *)s), mydummy, + MYDUMMY_SIZE), + HE(cp)->h_addr_list, addrcount)); + #else Debug((DEBUG_DNS, "u_l:add IP %x hal %x ac %d", ntohl(((struct IN_ADDR *)s)->S_ADDR), HE(cp)->h_addr_list, addrcount)); + #endif #endif for (; addrcount; addrcount--) { @@ -1556,7 +1560,7 @@ static aCache *make_cache(ResRQ *rptr) ** shouldn't happen but it just might... */ #ifndef _WIN32 - if (!rptr->he.h_name || !rptr->he.h_addr.S_ADDR) + if (!rptr->he.h_name || !WHOSTENTP(rptr->he.h_addr.S_ADDR) ) #else if (!rptr->he->h_name || !((struct IN_ADDR *)rptr->he->h_addr)->S_ADDR) #endif diff --git a/src/s_bsd.c b/src/s_bsd.c index fc87c163f..d30f052f3 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -750,8 +750,6 @@ int check_client(aClient *cptr) if ((i = AllowClient(cptr, hp, sockname))) { - Debug((DEBUG_DNS, "ch_cl: access denied: %s[%s]", - cptr->name, sockname)); return i; } @@ -1856,7 +1854,7 @@ deadsocket: ) length = read_packet(cptr, &read_set); #ifdef USE_SSL - if ((cptr->ssl != NULL) && + if ((length != FLUSH_BUFFER) && (cptr->ssl != NULL) && (IsSSLAcceptHandshake(cptr) || IsSSLConnectHandshake(cptr)) && FD_ISSET(cptr->fd, &read_set)) {