Only in irc2.9.5: : Only in irc2.9.5: alpha-dec-osf4.0b diff -ru irc2.9.5.orig/common/bsd.c irc2.9.5/common/bsd.c --- irc2.9.5.orig/common/bsd.c Wed Sep 3 19:45:11 1997 +++ irc2.9.5/common/bsd.c Wed Mar 18 16:56:28 1998 @@ -105,7 +105,11 @@ #ifndef NOWRITEALARM (void)alarm(WRITEWAITDELAY); #endif +#ifdef INET6 + retval = sendto(cptr->fd, str, len, 0, 0, 0); +#else retval = send(cptr->fd, str, len, 0); +#endif /* ** Convert WOULDBLOCK to a return of "0 bytes moved". This ** should occur only if socket was non-blocking. Note, that diff -ru irc2.9.5.orig/common/parse.c irc2.9.5/common/parse.c --- irc2.9.5.orig/common/parse.c Fri Jan 23 23:38:33 1998 +++ irc2.9.5/common/parse.c Wed Mar 18 16:57:48 1998 @@ -539,8 +539,11 @@ sendto_flag(SCH_ERROR, "Unknown command from %s:%s", get_client_name(cptr, TRUE), ch); - Debug((DEBUG_ERROR,"Unknown (%s) from %s", + fprintf(stderr,"Unknown (%s) from %s", + ch, get_client_name(cptr, TRUE)); +/* Debug((DEBUG_ERROR,"Unknown (%s) from %s", ch, get_client_name(cptr, TRUE))); +*/ #endif } ircstp->is_unco++; diff -ru irc2.9.5.orig/common/send.c irc2.9.5/common/send.c --- irc2.9.5.orig/common/send.c Fri Jan 23 14:26:18 1998 +++ irc2.9.5/common/send.c Wed Mar 18 16:59:15 1998 @@ -149,7 +149,9 @@ } #endif if (IsDead(to)) +{ return 0; /* This socket has already been marked as dead */ +} # ifndef CLIENT_COMPILE if (DBufLength(&to->sendQ) > get_sendq(to)) { diff -ru irc2.9.5.orig/common/struct_def.h irc2.9.5/common/struct_def.h --- irc2.9.5.orig/common/struct_def.h Fri Jan 23 14:28:07 1998 +++ irc2.9.5/common/struct_def.h Mon Mar 16 19:32:58 1998 @@ -33,7 +33,7 @@ typedef struct MotdItem aMotd; #endif -#define HOSTLEN 63 /* Length of hostname. Updated to */ +#define HOSTLEN 163 /* Length of hostname. Updated to */ /* comply with RFC1123 */ #define NICKLEN 9 /* Necessary to put 9 here instead of 10 @@ -240,6 +240,7 @@ u_long ping; u_long seq; /* # sent still in the "window" */ u_long lseq; /* sequence # of last sent */ +#undef recv u_long recv; /* # received still in the "window" */ u_long lrecv; /* # received */ }; @@ -247,7 +248,11 @@ struct ConfItem { u_int status; /* If CONF_ILLEGAL, delete when no clients */ int clients; /* Number of *LOCAL* clients using this */ +#ifdef INET6 + struct in6_addr ipnum; /* ip number of host field */ +#else struct in_addr ipnum; /* ip number of host field */ +#endif char *host; char *passwd; char *name; @@ -440,7 +445,11 @@ int priority; /* priority for selection as active */ u_short ract; /* no fear about this. */ u_short port; /* and the remote port# too :-) */ +#ifdef INET6 + struct in6_addr ip; /* keep real ip# too */ +#else struct in_addr ip; /* keep real ip# too */ +#endif struct hostent *hostp; char sockhost[HOSTLEN+1]; /* This is the host name from the socket ** and after which the connection was @@ -767,7 +776,11 @@ #define UTMP "/etc/utmp" #define COMMA "," +#ifdef INET6 +#define SAP struct sockaddr_in6 * +#else #define SAP struct sockaddr * +#endif /* IRC client structures */ diff -ru irc2.9.5.orig/common/support.c irc2.9.5/common/support.c --- irc2.9.5.orig/common/support.c Tue Feb 17 21:27:53 1998 +++ irc2.9.5/common/support.c Wed Mar 18 18:24:36 1998 @@ -438,7 +438,14 @@ return ret + SZ_CHST; } +#if defined(MyFree) +/* +#endif void MyFree(x) +#if defined(MyFree) +*/ +void MyMyFree(x) +#endif char *x; { size_t i; diff -ru irc2.9.5.orig/irc/c_bsd.c irc2.9.5/irc/c_bsd.c --- irc2.9.5.orig/irc/c_bsd.c Fri Oct 17 19:45:16 1997 +++ irc2.9.5/irc/c_bsd.c Wed Mar 18 16:55:51 1998 @@ -18,6 +18,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + #ifndef lint static char rcsid[] = "@(#)$Id: c_bsd.c,v 1.4 1997/10/17 17:45:16 kalt Exp $"; #endif @@ -46,34 +47,69 @@ { int sock; static struct hostent *hp; +#ifdef INET6 + static struct sockaddr_in6 server; +#else static struct sockaddr_in server; +#endif +#ifdef INET6 + sock = socket(AF_INET6, SOCK_STREAM, 0); +#else sock = socket(AF_INET, SOCK_STREAM, 0); +#endif if (sock < 0) { perror("opening stream socket"); exit(1); } +#ifdef INET6 + server.sin6_family = AF_INET6; +#else server.sin_family = AF_INET; +#endif if (isdigit(*host)) +#ifdef INET6 + inet_pton(AF_INET6,host,server.sin6_addr); +#else server.sin_addr.s_addr = inetaddr(host); +#endif else { +#ifdef INET6 + res_init(); + _res.options|=RES_USE_INET6; hp = gethostbyname(host); +#else + hp = gethostbyname(host); +#endif if (hp == 0) { fprintf(stderr, "%s: unknown host\n", host); exit(2); } +#ifdef INET6 + bcopy(hp->h_addr, (char *)&server.sin6_addr, hp->h_length); +#else bcopy(hp->h_addr, (char *)&server.sin_addr, hp->h_length); +#endif } +#ifdef INET6 + server.sin6_port = htons(portnum); +#else server.sin_port = htons(portnum); +#endif if (connect(sock, (SAP)&server, sizeof(server)) == -1) { perror("irc"); exit(1); } cptr->acpt = cptr; +#ifdef INET6 + cptr->port = server.sin6_port; + bcopy(server.sin6_addr.s6_addr,cptr->ip.s6_addr,16); +#else cptr->port = server.sin_port; cptr->ip.s_addr = server.sin_addr.s_addr; +#endif return(sock); } diff -ru irc2.9.5.orig/irc/c_version.c irc2.9.5/irc/c_version.c --- irc2.9.5.orig/irc/c_version.c Wed Sep 3 19:45:35 1997 +++ irc2.9.5/irc/c_version.c Wed Mar 11 17:07:58 1998 @@ -41,6 +41,7 @@ char *HEADEROLD = "*Internet Relay Chat* Type /help to get help * Client v%s * "; -char *HEADER = + +char *HEADER2 = " *IRC Client v%s* %10.10s on %10.10s */help for help* "; diff -ru irc2.9.5.orig/irc/c_version_ext.h irc2.9.5/irc/c_version_ext.h --- irc2.9.5.orig/irc/c_version_ext.h Wed Sep 3 19:45:36 1997 +++ irc2.9.5/irc/c_version_ext.h Wed Mar 11 17:07:10 1998 @@ -28,5 +28,5 @@ extern char *version; extern char *infotext[]; extern char *HEADEROLD; -extern char *HEADER; +extern char *HEADER2; #endif /* C_VERSION_C */ diff -ru irc2.9.5.orig/irc/irc.c irc2.9.5/irc/irc.c --- irc2.9.5.orig/irc/irc.c Wed Sep 3 19:45:40 1997 +++ irc2.9.5/irc/irc.c Sat Mar 14 13:21:19 1998 @@ -630,7 +630,7 @@ if (termtype == CURSES_TERM) { apu = 0; - sprintf(header,HEADER,version, me.name, currserver); + sprintf(header,HEADER2,version, me.name, currserver); clear(); standout(); mvaddstr(LINES - 2, 0, header); @@ -715,7 +715,7 @@ refresh(); apu -= 4; /* redraw status line */ - sprintf(header,HEADER,version, + sprintf(header,HEADER2,version, me.name, currserver); standout(); mvaddstr(LINES - 2, 0, header); @@ -881,7 +881,7 @@ char header[HEADERLEN]; if (termtype == CURSES_TERM) { - sprintf(header, HEADER, version, me.name, currserver); + sprintf(header, HEADER2, version, me.name, currserver); standout(); mvaddstr(LINES - 2, 0, header); standend(); diff -ru irc2.9.5.orig/irc/swear.c irc2.9.5/irc/swear.c --- irc2.9.5.orig/irc/swear.c Sat Oct 18 15:41:12 1997 +++ irc2.9.5/irc/swear.c Wed Mar 11 17:08:45 1998 @@ -159,7 +159,7 @@ cls = codes; tgetstr("mr",&cls); printf("%s",codes); - printf(HEADER, version); + printf(HEADER2, version); cls = codes; tgetstr("me",&cls); printf("%s",codes); diff -ru irc2.9.5.orig/ircd/hash.c irc2.9.5/ircd/hash.c --- irc2.9.5.orig/ircd/hash.c Sat Feb 7 15:39:59 1998 +++ irc2.9.5/ircd/hash.c Wed Mar 18 16:59:46 1998 @@ -360,7 +360,7 @@ } /* - * del_from_client_hash_table + * d6el_from_client_hash_table */ int del_from_client_hash_table(name, cptr) char *name; diff -ru irc2.9.5.orig/ircd/ircd.c irc2.9.5/ircd/ircd.c --- irc2.9.5.orig/ircd/ircd.c Wed Feb 18 19:41:34 1998 +++ irc2.9.5/ircd/ircd.c Mon Mar 16 19:42:40 1998 @@ -554,7 +554,6 @@ (void)moncontrol(1); (void)signal(SIGUSR1, s_monitor); #endif - #ifdef CHROOTDIR if (chdir(dpath)) { diff -ru irc2.9.5.orig/ircd/nameser_def.h irc2.9.5/ircd/nameser_def.h --- irc2.9.5.orig/ircd/nameser_def.h Wed Sep 3 19:45:52 1997 +++ irc2.9.5/ircd/nameser_def.h Wed Mar 11 17:11:39 1998 @@ -88,6 +88,8 @@ * is new enough to contain a certain feature. */ +#ifdef QWERTYUIOP + #define __BIND 19960801 /* interface version stamp */ /* @@ -328,3 +330,5 @@ *t_cp = t_l; \ (cp) += INT32SZ; \ } + +#endif diff -ru irc2.9.5.orig/ircd/res.c irc2.9.5/ircd/res.c --- irc2.9.5.orig/ircd/res.c Mon Oct 13 19:37:11 1997 +++ irc2.9.5/ircd/res.c Wed Mar 18 17:09:51 1998 @@ -22,12 +22,16 @@ #define RES_C #include "s_externs.h" #undef RES_C +#define RES_C + +#define WHOSTENTP(x) ((x)[0]|(x)[1]|(x)[2]|(x)[3]|(x)[4]|(x)[5]|(x)[6]|(x)[7]|(x)[8]|(x)[9]|(x)[10]|(x)[11]|(x)[12]|(x)[13]|(x)[14]|(x)[15]) #ifndef lint static char rcsid[] = "@(#)$Id: res.c,v 1.12 1997/10/13 17:37:11 kalt Exp $"; #endif #undef DEBUG /* because there is a lot of debug code in here :-) */ +#define DEBUG /* because there is a lot of debug code in here :-) */ static char hostbuf[HOSTLEN+1]; static char dot[] = "."; @@ -39,7 +43,11 @@ static void rem_cache __P((aCache *)); static void rem_request __P((ResRQ *)); static int do_query_name __P((Link *, char *, ResRQ *)); +#ifdef INET6 +static int do_query_number __P((Link *, struct in6_addr *, ResRQ *)); +#else static int do_query_number __P((Link *, struct in_addr *, ResRQ *)); +#endif static void resend_query __P((ResRQ *)); static int proc_answer __P((ResRQ *, HEADER *, char *, char *)); static int query_name __P((char *, int, int, ResRQ *)); @@ -55,6 +63,9 @@ static int hash_name __P((char *)); static int bad_hostname __P((char *, int)); +char mydummy[256]; +char mydummy2[256]; + static struct cacheinfo { int ca_adds; int ca_dels; @@ -97,8 +108,12 @@ if (!ircd_res.nscount) { ircd_res.nscount = 1; +#ifdef INET6 + inet_pton(AF_INET,"127.0.0.1",ircd_res.nsaddr_list[0].sin_addr.s_addr); +#else ircd_res.nsaddr_list[0].sin_addr.s_addr = inetaddr("127.0.0.1"); +#endif } } @@ -106,7 +121,11 @@ { int on = 0; +#ifdef INET6 + ret = resfd = socket(AF_INET, SOCK_DGRAM, 0); +#else ret = resfd = socket(AF_INET, SOCK_DGRAM, 0); +#endif (void) SETSOCKOPT(ret, SOL_SOCKET, SO_BROADCAST, &on, on); } #ifdef DEBUG @@ -198,7 +217,11 @@ else bzero((char *)&nreq->cinfo, sizeof(Link)); nreq->timeout = 4; /* start at 4 and exponential inc. */ +#ifdef INET6 + nreq->he.h_addrtype = AF_INET6; +#else nreq->he.h_addrtype = AF_INET; +#endif nreq->he.h_name = NULL; nreq->he.h_aliases[0] = NULL; (void)add_request(nreq); @@ -306,9 +329,17 @@ for (i = 0; i < max; i++) { +#ifdef INET6 + ircd_res.nsaddr_list[i].sin_family = AF_INET; +#else ircd_res.nsaddr_list[i].sin_family = AF_INET; +#endif if (sendto(resfd, msg, len, 0, (SAP)&(ircd_res.nsaddr_list[i]), +#ifdef INET6 sizeof(struct sockaddr)) == len) +#else + sizeof(struct sockaddr)) == len) +#endif { reinfo.re_sent++; sent++; @@ -362,7 +393,11 @@ return (struct hostent *)&(cp->he); if (!lp) return NULL; +#ifdef INET6 + (void)do_query_number(lp, (struct in6_addr *)addr, NULL); +#else (void)do_query_number(lp, (struct in_addr *)addr, NULL); +#endif return NULL; } @@ -391,11 +426,19 @@ if (!rptr) { rptr = make_request(lp); +#ifdef INET6 + rptr->type = T_AAAA; +#else rptr->type = T_A; +#endif rptr->name = (char *)MyMalloc(strlen(name) + 1); (void)strcpy(rptr->name, name); } +#ifdef INET6 + return (query_name(hname, C_IN, T_AAAA, rptr)); +#else return (query_name(hname, C_IN, T_A, rptr)); +#endif } /* @@ -403,25 +446,80 @@ */ static int do_query_number(lp, numb, rptr) Link *lp; +#ifdef INET6 +struct in6_addr *numb; +#else struct in_addr *numb; +#endif Reg ResRQ *rptr; { - char ipbuf[32]; + char ipbuf[128]; Reg u_char *cp; +#ifdef INET6 + cp = (u_char *)numb->s6_addr; + if (cp[0]==0 && cp[1]==0 && cp[2]==0 && cp[3]==0 && cp[4]==0 && cp[5]==0 && cp[6]==0 && cp[7]==0 && cp[8]==0 && cp[9]==0 && cp[10]==0xff && cp[11]==0xff) { + (void)sprintf(ipbuf,"%u.%u.%u.%u.in-addr.arpa.", + (u_int)(cp[15]), (u_int)(cp[14]), + (u_int)(cp[13]), (u_int)(cp[12])); +}else{ + (void)sprintf(ipbuf,"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.int.", + (u_int)(cp[15]&0xf), (u_int)(cp[15]>>4), + (u_int)(cp[14]&0xf), (u_int)(cp[14]>>4), + (u_int)(cp[13]&0xf), (u_int)(cp[13]>>4), + (u_int)(cp[12]&0xf), (u_int)(cp[12]>>4), + (u_int)(cp[11]&0xf), (u_int)(cp[11]>>4), + (u_int)(cp[10]&0xf), (u_int)(cp[10]>>4), + (u_int)(cp[9]&0xf), (u_int)(cp[9]>>4), + (u_int)(cp[8]&0xf), (u_int)(cp[8]>>4), + (u_int)(cp[7]&0xf), (u_int)(cp[7]>>4), + (u_int)(cp[6]&0xf), (u_int)(cp[6]>>4), + (u_int)(cp[5]&0xf), (u_int)(cp[5]>>4), + (u_int)(cp[4]&0xf), (u_int)(cp[4]>>4), + (u_int)(cp[3]&0xf), (u_int)(cp[3]>>4), + (u_int)(cp[2]&0xf), (u_int)(cp[2]>>4), + (u_int)(cp[1]&0xf), (u_int)(cp[1]>>4), + (u_int)(cp[0]&0xf), (u_int)(cp[0]>>4)); + (void)fprintf(stderr,"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.int.\n", + (u_int)(cp[15]&0xf), (u_int)(cp[15]>>4), + (u_int)(cp[14]&0xf), (u_int)(cp[14]>>4), + (u_int)(cp[13]&0xf), (u_int)(cp[13]>>4), + (u_int)(cp[12]&0xf), (u_int)(cp[12]>>4), + (u_int)(cp[11]&0xf), (u_int)(cp[11]>>4), + (u_int)(cp[10]&0xf), (u_int)(cp[10]>>4), + (u_int)(cp[9]&0xf), (u_int)(cp[9]>>4), + (u_int)(cp[8]&0xf), (u_int)(cp[8]>>4), + (u_int)(cp[7]&0xf), (u_int)(cp[7]>>4), + (u_int)(cp[6]&0xf), (u_int)(cp[6]>>4), + (u_int)(cp[5]&0xf), (u_int)(cp[5]>>4), + (u_int)(cp[4]&0xf), (u_int)(cp[4]>>4), + (u_int)(cp[3]&0xf), (u_int)(cp[3]>>4), + (u_int)(cp[2]&0xf), (u_int)(cp[2]>>4), + (u_int)(cp[1]&0xf), (u_int)(cp[1]>>4), + (u_int)(cp[0]&0xf), (u_int)(cp[0]>>4)); +} +#else cp = (u_char *)&numb->s_addr; (void)sprintf(ipbuf,"%u.%u.%u.%u.in-addr.arpa.", (u_int)(cp[3]), (u_int)(cp[2]), (u_int)(cp[1]), (u_int)(cp[0])); +#endif if (!rptr) { rptr = make_request(lp); rptr->type = T_PTR; +#ifdef INET6 + bcopy(numb->s6_addr,rptr->addr.s6_addr,16); + bcopy((char *)numb->s6_addr, + (char *)&rptr->he.h_addr, sizeof(struct in6_addr)); + rptr->he.h_length = sizeof(struct in6_addr); +#else rptr->addr.s_addr = numb->s_addr; bcopy((char *)&numb->s_addr, (char *)&rptr->he.h_addr, sizeof(struct in_addr)); rptr->he.h_length = sizeof(struct in_addr); +#endif } return (query_name(ipbuf, C_IN, T_PTR, rptr)); } @@ -486,6 +584,9 @@ case T_PTR: (void)do_query_number(NULL, &rptr->addr, rptr); break; +#ifdef INET6 + case T_AAAA: +#endif case T_A: (void)do_query_name(NULL, rptr->name, rptr); break; @@ -506,12 +607,20 @@ Reg char *cp, **alias; Reg struct hent *hp; int class, type, dlen, len, ans = 0, n; +#ifdef INET6 + struct in6_addr dr, *adr; +#else struct in_addr dr, *adr; +#endif cp = buf + sizeof(HEADER); hp = (struct hent *)&(rptr->he); adr = &hp->h_addr; +#ifdef INET6 + while (adr->s6_laddr[0]|adr->s6_laddr[1]|adr->s6_laddr[2]|adr->s6_laddr[3]) +#else while (adr->s_addr) +#endif adr++; alias = hp->h_aliases; while (*alias) @@ -522,9 +631,13 @@ while (hptr->qdcount-- > 0) #endif if ((n = __ircd_dn_skipname((u_char *)cp, (u_char *)eob)) == -1) +{ break; +} else +{ cp += (n + QFIXEDSZ); +} /* * proccess each answer sent to us blech. */ @@ -559,8 +672,16 @@ switch(type) { +#ifdef INET6 + case T_AAAA: +#endif case T_A : + fprintf(stderr,"in T_A\n"); +#ifdef INET6 + if (dlen != sizeof(dr)) +#else if (dlen != sizeof(dr)) +#endif { sendto_flag(SCH_ERROR, "Bad IP length (%d) returned for %s", dlen, @@ -573,11 +694,26 @@ hp->h_length = dlen; if (ans == 1) hp->h_addrtype = (class == C_IN) ? +#ifdef INET6 + AF_INET6 : AF_UNSPEC; +#else AF_INET : AF_UNSPEC; +#endif bcopy(cp, (char *)&dr, dlen); +#ifdef INET6 + bcopy(dr.s6_addr,adr->s6_addr,16); +#else adr->s_addr = dr.s_addr; +#endif +#ifdef INET6 + inet_ntop(AF_INET6,(char *)adr,mydummy); +#endif Debug((DEBUG_INFO,"got ip # %s for %s", +#ifdef INET6 + mydummy, hostbuf)); +#else inetntoa((char *)adr), hostbuf)); +#endif if (!hp->h_name) { hp->h_name =(char *)MyMalloc(len+1); @@ -588,6 +724,7 @@ cp += dlen; break; case T_PTR : + fprintf(stderr,"in T_PTR\n"); if((n = ircd_dn_expand((u_char *)buf, (u_char *)eob, (u_char *)cp, hostbuf, sizeof(hostbuf) )) < 0) @@ -654,7 +791,11 @@ Reg HEADER *hptr; Reg ResRQ *rptr = NULL; aCache *cp = NULL; +#ifdef INET6 + struct sockaddr_in sin; +#else struct sockaddr_in sin; +#endif int rc, a, max; SOCK_LEN_TYPE len = sizeof(sin); @@ -692,10 +833,17 @@ max = 1; for (a = 0; a < max; a++) +#ifdef INET6 + if (!ircd_res.nsaddr_list[a].sin_addr.s_addr || + !bcmp((char *)&sin.sin_addr, + (char *)&ircd_res.nsaddr_list[a].sin_addr, + sizeof(struct in_addr))) +#else if (!ircd_res.nsaddr_list[a].sin_addr.s_addr || !bcmp((char *)&sin.sin_addr, (char *)&ircd_res.nsaddr_list[a].sin_addr, sizeof(struct in_addr))) +#endif break; if (a == max) { @@ -738,13 +886,32 @@ goto getres_err; } a = proc_answer(rptr, hptr, buf, buf+rc); + if (a == -1) { + +#ifdef INET6 + inet_ntop(AF_INET,sin.sin_addr,mydummy2); + inet_ntop(AF_INET6,rptr->he.h_addr,mydummy); +#endif + sendto_flag(SCH_ERROR, "Bad hostname returned from %s for %s", +#ifdef INET6 + mydummy2,mydummy); +#else inetntoa((char *)&sin.sin_addr), inetntoa((char *)&rptr->he.h_addr)); +#endif +#ifdef INET6 + inet_ntop(AF_INET,(char *)&sin.sin_addr,mydummy); + inet_ntop(AF_INET6,(char *)&rptr->he.h_addr,mydummy2); +#endif Debug((DEBUG_DNS, "Bad hostname returned from %s for %s", +#ifdef INET6 + mydummy,mydummy2)); +#else inetntoa((char *)&sin.sin_addr), inetntoa((char *)&rptr->he.h_addr))); +#endif } #ifdef DEBUG Debug((DEBUG_INFO,"get_res:Proc answer = %d",a)); @@ -756,8 +923,16 @@ if (BadPtr(rptr->he.h_name)) /* Kludge! 960907/Vesa */ goto getres_err; +#ifdef INET6 + mydummy[0]=0; + inet_ntop(AF_INET6,(char *)&rptr->he.h_addr,mydummy); +#endif Debug((DEBUG_DNS, "relookup %s <-> %s", +#ifdef INET6 + rptr->he.h_name, mydummy)); +#else rptr->he.h_name, inetntoa((char *)&rptr->he.h_addr))); +#endif /* * Lookup the 'authoritive' name that we were given for the * ip#. By using this call rather than regenerating the @@ -839,6 +1014,20 @@ hashv += (int)*ip++; hashv += hashv + (int)*ip++; hashv += hashv + (int)*ip++; +#ifdef INET6 + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; + hashv += hashv + (int)*ip++; +#endif hashv += hashv + (int)*ip; hashv %= ARES_CACSIZE; return (hashv); @@ -970,18 +1159,35 @@ base[addrcount] = NULL; } } +#ifdef INET6 for (i = 0; cp->he.h_addr_list[i]; i++) +#else + for (i = 0; cp->he.h_addr_list[i]; i++) +#endif ; addrcount = i; /* * Do the same again for IP#'s. */ +#ifdef INET6 + for (s = (char *)rptr->he.h_addr.s6_addr; + ((struct in6_addr *)s)->s6_addr; s += sizeof(struct in6_addr)) +#else for (s = (char *)&rptr->he.h_addr.s_addr; ((struct in_addr *)s)->s_addr; s += sizeof(struct in_addr)) +#endif { +#ifdef INET6 for (i = 0; (t = cp->he.h_addr_list[i]); i++) +#else + for (i = 0; (t = cp->he.h_addr_list[i]); i++) +#endif +#ifdef INET6 + if (!bcmp(s, t, sizeof(struct in6_addr))) +#else if (!bcmp(s, t, sizeof(struct in_addr))) +#endif break; if (i >= MAXADDRS || addrcount >= MAXADDRS) break; @@ -995,28 +1201,51 @@ */ if (!t) { +#ifdef INET6 + struct in6_addr **ab; + + ab = (struct in6_addr **)cp->he.h_addr_list; +#else struct in_addr **ab; ab = (struct in_addr **)cp->he.h_addr_list; +#endif addrcount++; t = (char *)MyRealloc((char *)*ab, +#ifdef INET6 + addrcount * sizeof(struct in6_addr)); +#else addrcount * sizeof(struct in_addr)); +#endif base = (char **)MyRealloc((char *)ab, (addrcount + 1) * sizeof(*ab)); cp->he.h_addr_list = base; #ifdef DEBUG Debug((DEBUG_DNS,"u_l:add IP %x hal %x ac %d", +#ifdef INET6 + ntohl(((struct in6_addr *)s)->s6_addr), +#else ntohl(((struct in_addr *)s)->s_addr), +#endif cp->he.h_addr_list, addrcount)); #endif for (; addrcount; addrcount--) { +#ifdef INET6 + *ab++ = (struct in6_addr *)t; + t += sizeof(struct in6_addr); +#else *ab++ = (struct in_addr *)t; t += sizeof(struct in_addr); +#endif } *ab = NULL; +#ifdef INET6 + bcopy(s, (char *)*--ab, sizeof(struct in6_addr)); +#else bcopy(s, (char *)*--ab, sizeof(struct in_addr)); +#endif } } return; @@ -1075,21 +1304,39 @@ Reg aCache *cp; Reg int hashv,i; #ifdef DEBUG +#ifdef INET6 + struct in6_addr *ip = (struct in6_addr *)numb; +#else struct in_addr *ip = (struct in_addr *)numb; #endif +#endif hashv = hash_number((u_char *)numb); cp = hashtable[hashv].num_list; #ifdef DEBUG +#ifdef INET6 + inet_ntop(AF_INET6,numb,mydummy); +#endif Debug((DEBUG_DNS,"find_cache_number:find %s[%08x]: hashv = %d", +#ifdef INET6 + mydummy, ip->s6_addr, hashv)); +#else inetntoa(numb), ntohl(ip->s_addr), hashv)); #endif - - for (; cp; cp = cp->hnum_next) +#endif + for (; cp; cp = cp->hnum_next) +#ifdef INET6 + for (i = 0; cp->he.h_addr_list[i]; i++) +#else for (i = 0; cp->he.h_addr_list[i]; i++) +#endif if (!bcmp(cp->he.h_addr_list[i], numb, +#ifdef INET6 + sizeof(struct in6_addr))) +#else sizeof(struct in_addr))) +#endif { cainfo.ca_nu_hits++; update_list(rptr, cp); @@ -1107,7 +1354,11 @@ * single address entry...would have been done by hashed * search above... */ +#ifdef INET6 + if (!cp->he.h_addr_list[1]) +#else if (!cp->he.h_addr_list[1]) +#endif continue; /* * if the first IP# has the same hashnumber as the IP# we @@ -1115,9 +1366,17 @@ */ if (hashv == hash_number((u_char *)cp->he.h_addr_list[0])) continue; +#ifdef INET6 + for (i = 1; cp->he.h_addr_list[i]; i++) +#else for (i = 1; cp->he.h_addr_list[i]; i++) +#endif if (!bcmp(cp->he.h_addr_list[i], numb, +#ifdef INET6 + sizeof(struct in6_addr))) +#else sizeof(struct in_addr))) +#endif { cainfo.ca_nu_hits++; update_list(rptr, cp); @@ -1138,15 +1397,25 @@ /* ** shouldn't happen but it just might... */ +#ifdef INET6 + if (!rptr->he.h_name || !WHOSTENTP(rptr->he.h_addr.s6_addr)) +#else if (!rptr->he.h_name || !rptr->he.h_addr.s_addr) +#endif return NULL; /* ** Make cache entry. First check to see if the cache already exists ** and if so, return a pointer to it. */ +#ifdef INET6 + for (i = 0; WHOSTENTP(rptr->he.h_addr_list[i].s6_addr); i++) + if ((cp = find_cache_number(rptr, + (char *)(rptr->he.h_addr_list[i].s6_addr)))) +#else for (i = 0; rptr->he.h_addr_list[i].s_addr; i++) if ((cp = find_cache_number(rptr, (char *)&(rptr->he.h_addr_list[i].s_addr)))) +#endif return cp; /* @@ -1156,7 +1425,11 @@ bzero((char *)cp, sizeof(aCache)); hp = &cp->he; for (i = 0; i < MAXADDRS - 1; i++) +#ifdef INET6 + if (!WHOSTENTP(rptr->he.h_addr_list[i].s6_addr)) +#else if (!rptr->he.h_addr_list[i].s_addr) +#endif break; /* @@ -1165,14 +1438,25 @@ t = hp->h_addr_list = (char **)MyMalloc(sizeof(char *) * (i+1)); bzero((char *)t, sizeof(char *) * (i+1)); +#ifdef INET6 + s = (char *)MyMalloc(sizeof(struct in6_addr) * i); + bzero(s, sizeof(struct in6_addr) * i); + + for (n = 0; n < i; n++, s += sizeof(struct in6_addr)) +#else s = (char *)MyMalloc(sizeof(struct in_addr) * i); bzero(s, sizeof(struct in_addr) * i); for (n = 0; n < i; n++, s += sizeof(struct in_addr)) +#endif { *t++ = s; bcopy((char *)&rptr->he.h_addr_list[n], s, +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif } *t = (char *)NULL; @@ -1284,7 +1568,11 @@ hashv = hash_number((u_char *)hp->h_addr); #ifdef DEBUG Debug((DEBUG_DEBUG,"rem_cache: h_addr %s hashv %d next %#x first %#x", +#ifdef INET6 + inet_ntop(AF_INET6,hp->h_addr,mydummy), hashv, ocp->hnum_next, +#else inetntoa(hp->h_addr), hashv, ocp->hnum_next, +#endif hashtable[hashv].num_list)); #endif for (cp = &hashtable[hashv].num_list; *cp; cp = &((*cp)->hnum_next)) @@ -1372,17 +1660,36 @@ if (parv[1] && *parv[1] == 'l') { for(cp = cachetop; cp; cp = cp->list_next) { +#ifdef INET6 + inet_ntop(AF_INET6,cp->he.h_addr,mydummy); +#endif sendto_one(sptr, "NOTICE %s :Ex %d ttl %d host %s(%s)", parv[0], cp->expireat - timeofday, cp->ttl, +#ifdef INET6 + cp->he.h_name, mydummy); +#else cp->he.h_name, inetntoa(cp->he.h_addr)); +#endif for (i = 0; cp->he.h_aliases[i]; i++) sendto_one(sptr,"NOTICE %s : %s = %s (CN)", parv[0], cp->he.h_name, cp->he.h_aliases[i]); - for (i = 1; cp->he.h_addr_list[i]; i++) +#ifdef INET6 + for (i = 1; cp->he.h_addr_list[i]; i++) { +#else + for (i = 1; cp->he.h_addr_list[i]; i++) { +#endif +#ifdef INET6 + inet_ntop(AF_INET6,cp->he.h_addr_list[i],mydummy); +#endif sendto_one(sptr,"NOTICE %s : %s = %s (IP)", parv[0], cp->he.h_name, +#ifdef INET6 + mydummy); +#else inetntoa(cp->he.h_addr_list[i])); +#endif + } } return 2; } @@ -1414,10 +1721,18 @@ { sm += sizeof(*c); h = &c->he; +#ifdef INET6 for (i = 0; h->h_addr_list[i]; i++) +#else + for (i = 0; h->h_addr_list[i]; i++) +#endif { im += sizeof(char *); +#ifdef INET6 + im += sizeof(struct in6_addr); +#else im += sizeof(struct in_addr); +#endif } im += sizeof(char *); for (i = 0; h->h_aliases[i]; i++) diff -ru irc2.9.5.orig/ircd/res_comp.c irc2.9.5/ircd/res_comp.c --- irc2.9.5.orig/ircd/res_comp.c Wed Sep 3 19:45:53 1997 +++ irc2.9.5/ircd/res_comp.c Wed Mar 18 17:01:03 1998 @@ -100,21 +100,29 @@ case 0: if (dn != exp_dn) { if (dn >= eom) +{ return (-1); +} *dn++ = '.'; } if (dn+n >= eom) +{ return (-1); +} checked += n + 1; while (--n >= 0) { if (((c = *cp++) == '.') || (c == '\\')) { if (dn + n + 2 >= eom) +{ return (-1); +} *dn++ = '\\'; } *dn++ = c; if (cp >= eomorig) /* out of range */ +{ return (-1); +} } break; @@ -123,7 +131,9 @@ len = cp - comp_dn + 1; cp = msg + (((n & 0x3f) << 8) | (*cp & 0xff)); if (cp < msg || cp >= eomorig) /* out of range */ +{ return (-1); +} checked += 2; /* * Check for loops in the compressed name; @@ -131,7 +141,9 @@ * there must be a loop. */ if (checked >= eomorig - msg) +{ return (-1); +} break; default: diff -ru irc2.9.5.orig/ircd/res_def.h irc2.9.5/ircd/res_def.h --- irc2.9.5.orig/ircd/res_def.h Wed Sep 3 19:45:54 1997 +++ irc2.9.5/ircd/res_def.h Tue Mar 17 09:33:16 1998 @@ -20,7 +20,11 @@ int h_addrtype; /* host address type */ int h_length; /* length of address */ /* list of addresses from name server */ +#ifdef INET6 + struct in6_addr h_addr_list[MAXADDRS]; +#else struct in_addr h_addr_list[MAXADDRS]; +#endif #define h_addr h_addr_list[0] /* address, for backward compatiblity */ }; @@ -35,7 +39,11 @@ char resend; /* send flag. 0 == dont resend */ time_t sentat; time_t timeout; +#ifdef INET6 + struct in6_addr addr; +#else struct in_addr addr; +#endif char *name; struct reslist *next; Link cinfo; diff -ru irc2.9.5.orig/ircd/res_init.c irc2.9.5/ircd/res_init.c --- irc2.9.5.orig/ircd/res_init.c Wed Sep 24 20:40:56 1997 +++ irc2.9.5/ircd/res_init.c Thu Mar 12 12:06:24 1998 @@ -97,7 +97,11 @@ #ifdef RESOLVSORT static const char sort_mask[] = "/&"; #define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL) +#ifdef INET6 static u_int32_t ircd_net_mask __P((struct in_addr)); +#else +static u_int32_t ircd_net_mask __P((struct in_addr)); +#endif #endif #if !defined(isascii) /* XXX - could be a function */ @@ -186,6 +190,7 @@ if (!ircd_res.id) ircd_res.id = ircd_res_randomid(); +/*ifdef INET6 not, because of IPv4 DNS serving */ #ifdef USELOOPBACK ircd_res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); #else diff -ru irc2.9.5.orig/ircd/resolv_def.h irc2.9.5/ircd/resolv_def.h --- irc2.9.5.orig/ircd/resolv_def.h Wed Sep 24 20:40:57 1997 +++ irc2.9.5/ircd/resolv_def.h Thu Mar 12 11:04:34 1998 @@ -80,7 +80,7 @@ #define MAXRESOLVSORT 10 /* number of net to sort on */ #define RES_MAXNDOTS 15 /* should reflect bit field size */ -struct __res_state { +struct my__res_state { int retrans; /* retransmition time interval */ int retry; /* number of times to retransmit */ u_long options; /* option flags - see below. */ @@ -146,21 +146,29 @@ typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } res_sendhookact; +#ifdef INET6 +typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr_in6 * const *ns, +#else typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr_in * const *ns, +#endif const u_char **query, int *querylen, u_char *ans, int anssiz, int *resplen)); +#ifdef INET6 +typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in6 *ns, +#else typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr_in *ns, +#endif const u_char *query, int querylen, u_char *ans, int anssiz, int *resplen)); -struct res_sym { +struct my_res_sym { int number; /* Identifying number, like T_MX */ char * name; /* Its symbolic name, like "MX" */ char * humanname; /* Its fun name, like "mail exchanger" */ diff -ru irc2.9.5.orig/ircd/s_auth.c irc2.9.5/ircd/s_auth.c --- irc2.9.5.orig/ircd/s_auth.c Wed Sep 3 19:45:56 1997 +++ irc2.9.5/ircd/s_auth.c Sat Mar 14 14:38:06 1998 @@ -17,6 +17,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +char mydummy[256]; #ifndef lint static char rcsid[] = "@(#)$Id: s_auth.c,v 1.4 1997/09/03 17:45:56 kalt Exp $"; #endif @@ -40,12 +41,20 @@ Reg aClient *cptr; { #ifndef NO_IDENT +#ifdef INET6 + struct sockaddr_in6 us, them; +#else struct sockaddr_in us, them; +#endif SOCK_LEN_TYPE ulen, tlen; Debug((DEBUG_NOTICE,"start_auth(%x) fd %d status %d", cptr, cptr->fd, cptr->status)); +#ifdef INET6 + if ((cptr->authfd = socket(AF_INET6, SOCK_STREAM, 0)) == -1) +#else if ((cptr->authfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) +#endif { #ifdef USE_SYSLOG syslog(LOG_ERR, "Unable to create auth socket for %s:%m", @@ -71,32 +80,66 @@ /* get remote host peer - so that we get right interface -- jrg */ tlen = ulen = sizeof(us); +#ifdef INET6 + (void)getpeername(cptr->fd, (struct sockaddr_in6 *)&them, &tlen); + + them.sin6_port = htons(113); + them.sin6_family = AF_INET6; +#else (void)getpeername(cptr->fd, (struct sockaddr *)&them, &tlen); them.sin_port = htons(113); them.sin_family = AF_INET; +#endif /* We must bind the local end to the interface that they connected to: The local system might have more than one network address, and RFC931 check only sends port numbers: server takes IP addresses from query socket -- jrg */ +#ifdef INET6 + (void)getsockname(cptr->fd, (struct sockaddr_in6 *)&us, &ulen); + us.sin6_port = htons(0); /* bind assigns us a port */ + us.sin6_family = AF_INET6; +#else (void)getsockname(cptr->fd, (struct sockaddr *)&us, &ulen); us.sin_port = htons(0); /* bind assigns us a port */ us.sin_family = AF_INET; +#endif Debug((DEBUG_NOTICE,"auth(%x) from %s", +#ifdef INET6 + cptr, inet_ntop(AF_INET6,(char *)&us.sin6_addr,mydummy))); + if (bind(cptr->authfd, (struct sockaddr_in6 *)&us, ulen) >= 0) +#else cptr, inetntoa((char *)&us.sin_addr))); if (bind(cptr->authfd, (struct sockaddr *)&us, ulen) >= 0) +#endif { +#ifdef INET6 + (void)getsockname(cptr->fd, (struct sockaddr_in6 *)&us, &ulen); +#else (void)getsockname(cptr->fd, (struct sockaddr *)&us, &ulen); +#endif Debug((DEBUG_NOTICE,"auth(%x) to %s", +#ifdef INET6 + cptr, inet_ntop(AF_INET6,(char *)&them.sin6_addr,mydummy))); +#else cptr, inetntoa((char *)&them.sin_addr))); +#endif (void)alarm((unsigned)4); +#ifdef INET6 + if (connect(cptr->authfd, (struct sockaddr_in6 *)&them, +#else if (connect(cptr->authfd, (struct sockaddr *)&them, +#endif tlen) == -1 && errno != EINPROGRESS) { Debug((DEBUG_ERROR, "auth(%x) connect failed to %s - %d", cptr, +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&them.sin6_addr,mydummy), errno)); +#else inetntoa((char *)&them.sin_addr), errno)); +#endif ircstp->is_abad++; /* * No error report from this... @@ -115,8 +158,13 @@ report_error("binding stream socket for auth request %s:%s", cptr); Debug((DEBUG_ERROR,"auth(%x) bind failed on %s port %d - %d", +#ifdef INET6 + cptr, inet_ntop(AF_INET6,(char *)&us.sin6_addr,mydummy), + ntohs(us.sin6_port), errno)); +#else cptr, inetntoa((char *)&us.sin_addr), ntohs(us.sin_port), errno)); +#endif } cptr->flags |= (FLAGS_WRAUTH|FLAGS_AUTH); @@ -138,15 +186,24 @@ void send_authports(cptr) aClient *cptr; { +#ifdef INET6 + struct sockaddr_in6 us, them; +#else struct sockaddr_in us, them; +#endif char authbuf[32]; SOCK_LEN_TYPE ulen, tlen; Debug((DEBUG_NOTICE,"write_authports(%x) fd %d authfd %d stat %d", cptr, cptr->fd, cptr->authfd, cptr->status)); tlen = ulen = sizeof(us); +#ifdef INET6 + if (getsockname(cptr->fd, (struct sockaddr_in6 *)&us, &ulen) || + getpeername(cptr->fd, (struct sockaddr_in6 *)&them, &tlen)) +#else if (getsockname(cptr->fd, (struct sockaddr *)&us, &ulen) || getpeername(cptr->fd, (struct sockaddr *)&them, &tlen)) +#endif { #ifdef USE_SYSLOG syslog(LOG_ERR, "auth get{sock,peer}name error for %s:%m", @@ -156,11 +213,20 @@ } SPRINTF(authbuf, "%u , %u\r\n", +#ifdef INET6 + (unsigned int)ntohs(them.sin6_port), + (unsigned int)ntohs(us.sin6_port)); +#else (unsigned int)ntohs(them.sin_port), (unsigned int)ntohs(us.sin_port)); +#endif Debug((DEBUG_SEND, "sending [%s] to auth port %s.113", +#ifdef INET6 + authbuf, inet_ntop,(AF_INET6,(char *)&them.sin6_addr,mydummy))); +#else authbuf, inetntoa((char *)&them.sin_addr))); +#endif if (write(cptr->authfd, authbuf, strlen(authbuf)) != strlen(authbuf)) { authsenderr: diff -ru irc2.9.5.orig/ircd/s_bsd.c irc2.9.5/ircd/s_bsd.c --- irc2.9.5.orig/ircd/s_bsd.c Wed Feb 18 19:42:21 1998 +++ irc2.9.5/ircd/s_bsd.c Wed Mar 18 18:00:55 1998 @@ -34,6 +34,8 @@ * Added SO_REUSEADDR fix from zessel@informatik.uni-kl.de */ +char mydummy[256]; + #ifndef lint static char rcsid[] = "@(#)$Id: s_bsd.c,v 1.22 1998/02/18 18:42:21 kalt Exp $"; #endif @@ -52,17 +54,29 @@ FdAry fdas, fdaa, fdall; int highest_fd = 0, readcalls = 0, udpfd = -1, resfd = -1; time_t timeofday; +#ifdef INET6 +static struct sockaddr_in6 mysk; +#else static struct sockaddr_in mysk; +#endif static void polludp(); +#ifdef INET6 +static struct sockaddr_in6 *connect_inet __P((aConfItem *, aClient *, int *)); +#else static struct sockaddr *connect_inet __P((aConfItem *, aClient *, int *)); +#endif static int completed_connection __P((aClient *)); static int check_init __P((aClient *, char *)); static int check_ping __P((char *, int)); static void do_dns_async __P(()); static int set_sock_opts __P((int, aClient *)); #ifdef UNIXPORT +#ifdef INET6 +static struct sockaddr_in6 *connect_unix __P((aConfItem *, aClient *, int *)); +#else static struct sockaddr *connect_unix __P((aConfItem *, aClient *, int *)); +#endif static void add_unixconnection __P((aClient *, int)); static char unixpath[256]; #endif @@ -184,7 +198,11 @@ char *ipmask, *ip; int port; { +#ifdef INET6 + static struct sockaddr_in6 server; +#else static struct sockaddr_in server; +#endif int ad[4]; SOCK_LEN_TYPE len = sizeof(server); char ipname[20]; @@ -207,7 +225,11 @@ * At first, open a new socket */ if (cptr->fd == -1) +#ifdef INET6 + cptr->fd = socket(AF_INET6, SOCK_STREAM, 0); +#else cptr->fd = socket(AF_INET, SOCK_STREAM, 0); +#endif if (cptr->fd < 0) { report_error("opening stream socket %s:%s", cptr); @@ -227,12 +249,28 @@ */ if (port) { +#ifdef INET6 + server.sin6_family = AF_INET6; +#else server.sin_family = AF_INET; +#endif if (!ip || !isdigit(*ip)) +#ifdef INET6 + server.sin6_addr = in6addr_any; +#else server.sin_addr.s_addr = INADDR_ANY; +#endif else +#ifdef INET6 + inet_pton(ip,server.sin6_addr); +#else server.sin_addr.s_addr = inetaddr(ip); +#endif +#ifdef INET6 + server.sin6_port = htons(port); +#else server.sin_port = htons(port); +#endif /* * Try 10 times to bind the socket with an interval of 20 * seconds. Do this so we dont have to keep trying manually @@ -249,7 +287,11 @@ } } +#ifdef INET6 + if (getsockname(cptr->fd, (struct sockaddr_in6 *)&server, &len)) +#else if (getsockname(cptr->fd, (struct sockaddr *)&server, &len)) +#endif { report_error("getsockname failed for %s:%s",cptr); (void)close(cptr->fd); @@ -261,13 +303,21 @@ char buf[1024]; (void)sprintf(buf, rpl_str(RPL_MYPORTIS, "*"), +#ifdef INET6 + ntohs(server.sin6_port)); +#else ntohs(server.sin_port)); +#endif (void)write(0, buf, strlen(buf)); } if (cptr->fd > highest_fd) highest_fd = cptr->fd; +#ifdef INET6 + bcopy(server.sin6_addr.s6_addr,cptr->ip.s6_addr,16); +#else cptr->ip.s_addr = server.sin_addr.s_addr; /* broken on linux at least*/ +#endif cptr->port = port; (void)listen(cptr->fd, LISTENQUEUE); local[cptr->fd] = cptr; @@ -493,7 +543,8 @@ if (bootopt & BOOT_TTY) /* debugging is going to a tty */ goto init_dgram; if (!(bootopt & BOOT_DEBUG)) - (void)close(2); + fprintf(stderr,"iik\n");/* (void)close(2);*/ +fflush(stdout); if (((bootopt & BOOT_CONSOLE) || isatty(0)) && !(bootopt & (BOOT_INETD|BOOT_OPER))) @@ -557,8 +608,13 @@ Reg aClient *cptr; Reg char *sockn; { +#ifdef INET6 + struct sockaddr_in6 sk; + SOCK_LEN_TYPE len = sizeof(struct sockaddr_in6); +#else struct sockaddr_in sk; SOCK_LEN_TYPE len = sizeof(struct sockaddr_in); +#endif #ifdef UNIXPORT if (IsUnixSocket(cptr)) @@ -573,22 +629,37 @@ if (isatty(cptr->fd)) { strncpyzt(sockn, me.sockhost, HOSTLEN); +#ifdef INET6 + bzero((char *)&sk, sizeof(struct sockaddr_in6)); +#else bzero((char *)&sk, sizeof(struct sockaddr_in)); +#endif } else if (getpeername(cptr->fd, (SAP)&sk, &len) == -1) { report_error("connect failure: %s %s", cptr); return -1; } +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&sk.sin6_addr,sockn); + if (inetnetof(sk.sin6_addr) == IN_LOOPBACKNET) +#else (void)strcpy(sockn, (char *)inetntoa((char *)&sk.sin_addr)); if (inetnetof(sk.sin_addr) == IN_LOOPBACKNET) +#endif { cptr->hostp = NULL; strncpyzt(sockn, me.sockhost, HOSTLEN); } +#ifdef INET6 + bcopy((char *)&sk.sin6_addr, (char *)&cptr->ip, + sizeof(struct in6_addr)); + cptr->port = (int)(ntohs(sk.sin6_port)); +#else bcopy((char *)&sk.sin_addr, (char *)&cptr->ip, sizeof(struct in_addr)); cptr->port = (int)(ntohs(sk.sin_port)); +#endif return 0; } @@ -608,8 +679,15 @@ Reg int i; ClearAccess(cptr); +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&cptr->ip,mydummy); +#endif Debug((DEBUG_DNS, "ch_cl: check access for %s[%s]", +#ifdef INET6 + cptr->name, mydummy)); +#else cptr->name, inetntoa((char *)&cptr->ip))); +#endif if (check_init(cptr, sockname)) return -1; @@ -624,12 +702,23 @@ { for (i = 0; hp->h_addr_list[i]; i++) if (!bcmp(hp->h_addr_list[i], (char *)&cptr->ip, +#ifdef INET6 + sizeof(struct in6_addr))) +#else sizeof(struct in_addr))) +#endif break; if (!hp->h_addr_list[i]) { +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&cptr->ip,mydummy); +#endif sendto_flag(SCH_ERROR, "IP# Mismatch: %s != %s[%08x]", +#ifdef INET6 + mydummy, hp->h_name, +#else inetntoa((char *)&cptr->ip), hp->h_name, +#endif *((unsigned long *)hp->h_addr)); hp = NULL; } @@ -646,8 +735,13 @@ cptr->name, sockname)); if (inetnetof(cptr->ip) == IN_LOOPBACKNET || IsUnixSocket(cptr) || +#ifdef INET6 + inetnetof(cptr->ip) == inetnetof(mysk.sin6_addr)) +#else inetnetof(cptr->ip) == inetnetof(mysk.sin_addr)) +#endif { + ircstp->is_loc++; cptr->flags |= FLAGS_LOCAL; } @@ -768,12 +862,23 @@ { for (i = 0; hp->h_addr_list[i]; i++) if (!bcmp(hp->h_addr_list[i], (char *)&cptr->ip, +#ifdef INET6 + sizeof(struct in6_addr))) +#else sizeof(struct in_addr))) +#endif break; if (!hp->h_addr_list[i]) { +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&cptr->ip,mydummy); +#endif sendto_flag(SCH_ERROR, "IP# Mismatch: %s != %s[%08x]", +#ifdef INET6 + mydummy, hp->h_name, +#else inetntoa((char *)&cptr->ip), hp->h_name, +#endif *((unsigned long *)hp->h_addr)); hp = NULL; } @@ -867,9 +972,17 @@ (void)attach_conf(cptr, c_conf); (void)attach_confs(cptr, name, CONF_HUB|CONF_LEAF); +#ifdef INET6 + if ((c_conf->ipnum.s6_addr == -1) && !IsUnixSocket(cptr)) +#else if ((c_conf->ipnum.s_addr == -1) && !IsUnixSocket(cptr)) +#endif bcopy((char *)&cptr->ip, (char *)&c_conf->ipnum, +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif if (!IsUnixSocket(cptr)) get_sockhost(cptr, c_conf->host); @@ -935,7 +1048,11 @@ #if 0 /* code and variables declarations are removed, this avoids compiler warnings */ +#ifdef INET6 + struct sockaddr_in6 sin; +#else struct sockaddr_in sin; +#endif aConfItem *aconf; aClient *acptr; int fd; @@ -955,7 +1072,11 @@ if (!aconf->port) return -1; +#ifdef INET6 + fd = socket(AF_INET6, SOCK_STREAM, 0); +#else fd = socket(AF_INET, SOCK_STREAM, 0); +#endif if (fd >= MAXCLIENTS) { @@ -977,9 +1098,15 @@ set_non_blocking(acptr->fd, acptr); (void)set_sock_opts(acptr->fd, acptr); bzero((char *)&sin, sizeof(sin)); +#ifdef INET6 + sin.sin6_family = AF_INET6; + sin.sin6_port = htons(aconf->port); + bcopy((char *)&cptr->ip, (char *)&sin.sin6_addr, sizeof(cptr->ip)); +#else sin.sin_family = AF_INET; sin.sin_port = htons(aconf->port); bcopy((char *)&cptr->ip, (char *)&sin.sin_addr, sizeof(cptr->ip)); +#endif bcopy((char *)&cptr->ip, (char *)&acptr->ip, sizeof(cptr->ip)); if (connect(acptr->fd, (SAP)&sin, sizeof(sin)) < 0 && @@ -1306,7 +1433,11 @@ aClient *cptr; { struct abacklog { +#ifdef INET6 + struct in6_addr ip; +#else struct in_addr ip; +#endif time_t PT; struct abacklog *next; }; @@ -1370,8 +1501,13 @@ get_sockhost(acptr, cptr->sockhost); else { +#ifdef INET6 + struct sockaddr_in6 addr; + SOCK_LEN_TYPE len = sizeof(struct sockaddr_in6); +#else struct sockaddr_in addr; SOCK_LEN_TYPE len = sizeof(struct sockaddr_in); +#endif if (getpeername(fd, (SAP)&addr, &len) == -1) { @@ -1389,15 +1525,33 @@ /* Copy ascii address to 'sockhost' just in case. Then we * have something valid to put into error messages... */ +#ifdef INET6 +/* + get_sockhost(acptr, (char *)inet_ntop((char *)&addr.sin6_addr)); +*/ + inet_ntop(AF_INET6,(char *)&addr.sin6_addr,mydummy); + get_sockhost(acptr, (char *)mydummy); + bcopy ((char *)&addr.sin6_addr, (char *)&acptr->ip, + sizeof(struct in6_addr)); + acptr->port = ntohs(addr.sin6_port); +#else get_sockhost(acptr, (char *)inetntoa((char *)&addr.sin_addr)); bcopy ((char *)&addr.sin_addr, (char *)&acptr->ip, sizeof(struct in_addr)); acptr->port = ntohs(addr.sin_port); +#endif lin.flags = ASYNC_CLIENT; lin.value.cptr = acptr; +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&addr.sin6_addr,mydummy); +#endif Debug((DEBUG_DNS, "lookup %s", +#ifdef INET6 + mydummy)); +#else inetntoa((char *)&addr.sin_addr))); +#endif acptr->hostp = gethost_byaddr((char *)&acptr->ip, &lin); if (!acptr->hostp) SetDNS(acptr); @@ -1468,7 +1622,11 @@ add_fd(fd, &fdall); acptr->acpt = cptr; SetUnixSock(acptr); +#ifdef INET6 + bcopy((char *)&me.ip, (char *)&acptr->ip, sizeof(struct in6_addr)); +#else bcopy((char *)&me.ip, (char *)&acptr->ip, sizeof(struct in_addr)); +#endif add_client_to_list(acptr); set_non_blocking(acptr->fd, acptr); @@ -1738,10 +1896,11 @@ if (IsListening(cptr)) { #ifndef SLOW_ACCEPT - if (IsUnixSocket(cptr)) - { + if (IsUnixSocket(cptr)) + { + fprintf(stderr,"I here 1.332\n"); #endif - if ((timeofday > cptr->lasttime + 2)) + if ((timeofday > cptr->lasttime + 2)) { SET_READ_EVENT( fd ); } @@ -1923,9 +2082,15 @@ "All connections in use. (%s)", get_client_name(cptr, TRUE)); find_bounce(NULL, 0, fdnew); +#ifdef INET6 + (void)sendto(fdnew, + "ERROR :All connections in use\r\n", + 32, 0, 0, 0); +#else (void)send(fdnew, "ERROR :All connections in use\r\n", 32, 0); +#endif (void)close(fdnew); continue; } @@ -2047,13 +2212,24 @@ aClient *by; struct hostent *hp; { +#ifdef INET6 + Reg struct sockaddr_in6 *svp; +#else Reg struct sockaddr *svp; +#endif Reg aClient *cptr, *c2ptr; Reg char *s; int i, len; +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&aconf->ipnum,mydummy); +#endif Debug((DEBUG_NOTICE,"Connect to %s[%s] @%s", +#ifdef INET6 + aconf->name, aconf->host, mydummy)); +#else aconf->name, aconf->host, inetntoa((char *)&aconf->ipnum))); +#endif if ((c2ptr = find_server(aconf->name, NULL))) { @@ -2071,7 +2247,11 @@ * If we dont know the IP# for this host and itis a hostname and * not a ip# string, then try and find the appropriate host record. */ +#ifdef INET6 + if (!aconf->ipnum.s6_addr && *aconf->host != '/') +#else if (!aconf->ipnum.s_addr && *aconf->host != '/') +#endif { Link lin; @@ -2080,16 +2260,28 @@ nextdnscheck = 1; s = (char *)index(aconf->host, '@'); s++; /* should NEVER be NULL */ +#ifdef INET6 + if (inet_pton(s,aconf->ipnum.s6_addr) == -1) +#else if ((aconf->ipnum.s_addr = inetaddr(s)) == -1) +#endif { +#ifdef INET6 + bzero(aconf->ipnum.s6_addr,16); +#else aconf->ipnum.s_addr = 0; +#endif hp = gethost_byname(s, &lin); Debug((DEBUG_NOTICE, "co_sv: hp %x ac %x na %s ho %s", hp, aconf, aconf->name, s)); if (!hp) return 0; bcopy(hp->h_addr, (char *)&aconf->ipnum, +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif } } cptr = make_client(NULL); @@ -2195,12 +2387,20 @@ return 0; } +#ifdef INET6 +static struct sockaddr_in6 *connect_inet(aconf, cptr, lenp) +#else static struct sockaddr *connect_inet(aconf, cptr, lenp) +#endif Reg aConfItem *aconf; Reg aClient *cptr; int *lenp; { +#ifdef INET6 + static struct sockaddr_in6 server; +#else static struct sockaddr_in server; +#endif Reg struct hostent *hp; aClient *acptr; int i; @@ -2209,16 +2409,28 @@ * Might as well get sockhost from here, the connection is attempted * with it so if it fails its useless. */ +#ifdef INET6 + cptr->fd = socket(AF_INET6, SOCK_STREAM, 0); +#else cptr->fd = socket(AF_INET, SOCK_STREAM, 0); +#endif if (cptr->fd >= MAXCLIENTS) { sendto_flag(SCH_NOTICE, "No more connections allowed (%s)", cptr->name); return NULL; } +#ifdef INET6 + mysk.sin6_port = 0; +#else mysk.sin_port = 0; +#endif bzero((char *)&server, sizeof(server)); +#ifdef INET6 + server.sin6_family = AF_INET6; +#else server.sin_family = AF_INET; +#endif get_sockhost(cptr, aconf->host); if (cptr->fd == -1) @@ -2242,9 +2454,14 @@ * conf line, whether as a result of the hostname lookup or the ip# * being present instead. If we dont know it, then the connect fails. */ +#ifdef INET6 + if (isdigit(*aconf->host) && (aconf->ipnum.s6_addr == -1)) + if (inet_pton(aconf->host,aconf->ipnum.s6_addr) == -1 ) +#else if (isdigit(*aconf->host) && (aconf->ipnum.s_addr == -1)) aconf->ipnum.s_addr = inetaddr(aconf->host); if (aconf->ipnum.s_addr == -1) +#endif { hp = cptr->hostp; if (!hp) @@ -2253,13 +2470,25 @@ return NULL; } bcopy(hp->h_addr, (char *)&aconf->ipnum, +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif } +#ifdef INET6 + bcopy((char *)&aconf->ipnum, (char *)&server.sin6_addr, + sizeof(struct in6_addr)); + bcopy((char *)&aconf->ipnum, (char *)&cptr->ip, + sizeof(struct in6_addr)); + server.sin6_port = htons((aconf->port > 0) ? aconf->port : portnum); +#else bcopy((char *)&aconf->ipnum, (char *)&server.sin_addr, sizeof(struct in_addr)); bcopy((char *)&aconf->ipnum, (char *)&cptr->ip, sizeof(struct in_addr)); server.sin_port = htons((aconf->port > 0) ? aconf->port : portnum); +#endif /* * Look for a duplicate IP#,port pair among already open connections * (This caters for unestablished connections). @@ -2267,10 +2496,18 @@ for (i = highest_fd; i >= 0; i--) if ((acptr = local[i]) && !bcmp((char *)&cptr->ip, (char *)&acptr->ip, +#ifdef INET6 + sizeof(cptr->ip)) && server.sin6_port == acptr->port) +#else sizeof(cptr->ip)) && server.sin_port == acptr->port) +#endif return NULL; *lenp = sizeof(server); +#ifdef INET6 + return (struct sockaddr_in6 *)&server; +#else return (struct sockaddr *)&server; +#endif } #ifdef UNIXPORT @@ -2279,7 +2516,11 @@ * Build a socket structure for cptr so that it can connet to the unix * socket defined by the conf structure aconf. */ +#ifdef INET6 +static struct sockaddr_in6 *connect_unix(aconf, cptr, lenp) +#else static struct sockaddr *connect_unix(aconf, cptr, lenp) +#endif aConfItem *aconf; aClient *cptr; int *lenp; @@ -2485,10 +2726,18 @@ ** Setup local socket structure to use for binding to. */ bzero((char *)&mysk, sizeof(mysk)); +#ifdef INET6 + mysk.sin6_family = AF_INET6; +#else mysk.sin_family = AF_INET; +#endif if ((aconf = find_me())->passwd && isdigit(*aconf->passwd)) +#ifdef INET6 + inet_pton(aconf->passwd, mysk.sin6_addr); +#else mysk.sin_addr.s_addr = inetaddr(aconf->passwd); +#endif if (gethostname(name, len) == -1) return; @@ -2529,8 +2778,13 @@ else strncpyzt(name, tmp, len); if (!aconf->passwd) +#ifdef INET6 + bcopy(hp->h_addr, (char *)&mysk.sin6_addr, + sizeof(struct in6_addr)); +#else bcopy(hp->h_addr, (char *)&mysk.sin_addr, sizeof(struct in_addr)); +#endif Debug((DEBUG_DEBUG,"local name is %s", get_client_name(&me,TRUE))); } @@ -2543,20 +2797,41 @@ int setup_ping(aconf) aConfItem *aconf; { +#ifdef INET6 + struct sockaddr_in6 from; +#else struct sockaddr_in from; +#endif int on = 1; if (udpfd != -1) return udpfd; bzero((char *)&from, sizeof(from)); if (aconf->passwd && isdigit(*aconf->passwd)) +#ifdef INET6 + inet_pton(aconf->passwd,from.sin6_addr); +#else from.sin_addr.s_addr = inetaddr(aconf->passwd); +#endif else +#ifdef INET6 + from.sin6_addr = in6addr_any; +#else from.sin_addr.s_addr = htonl(INADDR_ANY); /* hmmpf */ +#endif +#ifdef INET6 + from.sin6_port = htons((u_short) aconf->port); + from.sin6_family = AF_INET6; +#else from.sin_port = htons((u_short) aconf->port); from.sin_family = AF_INET; +#endif +#ifdef INET6 + if ((udpfd = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) +#else if ((udpfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) +#endif { Debug((DEBUG_ERROR, "socket udp : %s", strerror(errno))); return -1; @@ -2577,8 +2852,12 @@ { #ifdef USE_SYSLOG syslog(LOG_ERR, "bind udp.%d fd %d : %m", +#ifdef INET6 + ntohs(from.sin6_port), udpfd); +#else ntohs(from.sin_port), udpfd); #endif +#endif Debug((DEBUG_ERROR, "bind : %s", strerror(errno))); (void)close(udpfd); return udpfd = -1; @@ -2590,7 +2869,11 @@ return udpfd = -1; } Debug((DEBUG_INFO, "udpfd = %d, port %d", udpfd, +#ifdef INET6 + ntohs(from.sin6_port))); +#else ntohs(from.sin_port))); +#endif return udpfd; } @@ -2599,10 +2882,18 @@ aConfItem *aconf; { Ping pi; +#ifdef INET6 + struct sockaddr_in6 sin; +#else struct sockaddr_in sin; +#endif aCPing *cp = aconf->ping; +#ifdef INET6 + if (!aconf->ipnum.s6_addr || aconf->ipnum.s6_addr == -1 || !cp->port) +#else if (!aconf->ipnum.s_addr || aconf->ipnum.s_addr == -1 || !cp->port) +#endif return; if (aconf->class->conFreq == 0) /* avoid flooding */ return; @@ -2628,12 +2919,22 @@ } bzero((char *)&sin, sizeof(sin)); +#ifdef INET6 + bcopy(aconf->ipnum.s6_addr,sin.sin6_addr,16); + sin.sin6_port = htons(cp->port); + sin.sin6_family = AF_INET6; +#else sin.sin_addr.s_addr = aconf->ipnum.s_addr; sin.sin_port = htons(cp->port); sin.sin_family = AF_INET; +#endif (void)gettimeofday(&pi.pi_tv, NULL); Debug((DEBUG_SEND,"Send ping to %s,%d fd %d, %d bytes", +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&aconf->ipnum,mydummy), cp->port, +#else inetntoa((char *)&aconf->ipnum), cp->port, +#endif udpfd, sizeof(pi))); (void)sendto(udpfd, (char *)&pi, sizeof(pi), 0,(SAP)&sin,sizeof(sin)); } @@ -2692,7 +2993,11 @@ static time_t last = 0; static int cnt = 0, mlen = 0, lasterr = 0; Reg char *s; +#ifdef INET6 + struct sockaddr_in6 from; +#else struct sockaddr_in from; +#endif Ping pi; int n; SOCK_LEN_TYPE fromlen = sizeof(from); @@ -2730,8 +3035,13 @@ { sendto_flag(SCH_NOTICE, "udp packet dropped: %d bytes from %s.%d", +#ifdef INET6 + n,inet_ntop(AF_INET6,(char *)&from.sin6_addr,mydummy), + ntohs(from.sin6_port)); +#else n,inetntoa((char *)&from.sin_addr), ntohs(from.sin_port)); +#endif lasterr = timeofday; } ircstp->is_udpdrop++; @@ -2742,7 +3052,11 @@ cnt = 0, last = timeofday; Debug((DEBUG_NOTICE, "udp (%d) %d bytes from %s,%d", cnt, n, +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&from.sin6_addr,mydummy), ntohs(from.sin6_port))); +#else inetntoa((char *)&from.sin_addr), ntohs(from.sin_port))); +#endif readbuf[n] = '\0'; ircstp->is_udpok++; @@ -2823,7 +3137,11 @@ if (hp && aconf) { bcopy(hp->h_addr, (char *)&aconf->ipnum, +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif (void)connect_server(aconf, NULL, hp); } else @@ -2835,7 +3153,11 @@ aconf = ln.value.aconf; if (hp && aconf) bcopy(hp->h_addr, (char *)&aconf->ipnum, +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif break; default : break; diff -ru irc2.9.5.orig/ircd/s_conf.c irc2.9.5/ircd/s_conf.c --- irc2.9.5.orig/ircd/s_conf.c Wed Feb 11 00:19:01 1998 +++ irc2.9.5/ircd/s_conf.c Fri Mar 13 12:48:56 1998 @@ -97,7 +97,12 @@ } lmask = htonl(0xfffffffful << (32 - m)); /* /24 -> 0xffffff00ul */ baseip = htonl(i1 * 0x1000000 + i2 * 0x10000 + i3 * 0x100 + i4); +#ifdef INET6 +return 1; +/* return ((cptr->ip.s6_addr & lmask) == baseip) ? 0 : 1;*/ +#else return ((cptr->ip.s_addr & lmask) == baseip) ? 0 : 1; +#endif } /* @@ -584,7 +589,11 @@ continue; } *s = '@'; +#ifdef INET6 + if (!bcmp((char *)&tmp->ipnum, ip, sizeof(struct in6_addr))) +#else if (!bcmp((char *)&tmp->ipnum, ip, sizeof(struct in_addr))) +#endif return tmp; } return NULL; @@ -1189,17 +1198,34 @@ ln.flags = ASYNC_CONF; if (isdigit(*s)) +#ifdef INET6 + inet_pton(s,aconf->ipnum.s6_addr); +#else aconf->ipnum.s_addr = inetaddr(s); +#endif else if ((hp = gethost_byname(s, &ln))) bcopy(hp->h_addr, (char *)&(aconf->ipnum), +#ifdef INET6 + sizeof(struct in6_addr)); +#else sizeof(struct in_addr)); +#endif +#ifdef INET6 + if (aconf->ipnum.s6_addr == -1) +#else if (aconf->ipnum.s_addr == -1) +#endif goto badlookup; return 0; badlookup: - if (aconf->ipnum.s_addr == -1) +#ifdef INET6 + bzero((char *)&aconf->ipnum, sizeof(struct in6_addr)); + if (aconf->ipnum.s6_addr == -1) +#else bzero((char *)&aconf->ipnum, sizeof(struct in_addr)); + if (aconf->ipnum.s_addr == -1) +#endif Debug((DEBUG_ERROR,"Host/server name error: (%s) (%s)", aconf->host, aconf->name)); return -1; @@ -1542,7 +1568,11 @@ SPRINTF(rpl, rpl_str(RPL_BOUNCE,"unknown"), aconf->name, aconf->port); strcat(rpl, "\r\n"); +#ifdef INET6 + sendto(class, rpl, strlen(rpl), 0, 0, 0); +#else send(class, rpl, strlen(rpl), 0); +#endif return; } else diff -ru irc2.9.5.orig/ircd/s_debug.c irc2.9.5/ircd/s_debug.c --- irc2.9.5.orig/ircd/s_debug.c Tue Nov 11 20:11:52 1997 +++ irc2.9.5/ircd/s_debug.c Sat Mar 14 11:53:05 1998 @@ -27,6 +27,7 @@ #define S_DEBUG_C #include "s_externs.h" #undef S_DEBUG_C +#define S_DEBUG_C /* * Option string. Must be before #ifdef DEBUGMODE. @@ -168,7 +169,7 @@ #else va_list va; va_start(va, form); - vsyslog(LOG_ERR, form, va); + syslog(LOG_ERR, form, va); va_end(va); #endif } diff -ru irc2.9.5.orig/ircd/s_misc.c irc2.9.5/ircd/s_misc.c --- irc2.9.5.orig/ircd/s_misc.c Wed Jan 7 20:13:29 1998 +++ irc2.9.5/ircd/s_misc.c Wed Mar 18 17:10:48 1998 @@ -189,6 +189,9 @@ ** to internal buffer (nbuf). *NEVER* use the returned pointer ** to modify what it points!!! */ + +char mydummy[256]; + char *get_client_name(sptr, showip) aClient *sptr; int showip; @@ -213,7 +216,11 @@ sptr->name, USERLEN, (!(sptr->flags & FLAGS_GOTID)) ? "" : sptr->auth, +#ifdef INET6 + inet_ntop(AF_INET6,(char *)&sptr->ip,mydummy)); +#else inetntoa((char *)&sptr->ip)); +#endif else { if (mycmp(sptr->name, sptr->sockhost)) @@ -866,11 +873,28 @@ /* Remove sptr from the client list */ if (del_from_client_hash_table(sptr->name, sptr) != 1) - Debug((DEBUG_ERROR, "%#x !in tab %s[%s] %#x %#x %#x %d %d %#x", +{ + fprintf(stderr, "%x !in tab %x[%x] %x\n", sptr, sptr->name, +#ifdef INET6 + sptr->from, +#else sptr->from ? sptr->from->sockhost : "??host", +#endif + sptr->from); + fprintf(stderr, "%x !in tab %x[%x] %x %x\n", sptr->next, sptr->prev, sptr->fd, + sptr->status, sptr->user); +/* debug((DEBUG_ERROR, "%#x !in tab %s[%s] %#x %#x %#x %d %d %#x", + sptr, sptr->name, +#ifdef INET6 + sptr->from ? "??host" : sptr->from->sockhost, +#else + sptr->from ? sptr->from->sockhost : "??host", +#endif sptr->from, sptr->next, sptr->prev, sptr->fd, sptr->status, sptr->user)); +*/ +} remove_client_from_list(sptr); return; } diff -ru irc2.9.5.orig/ircd/sys_def.h irc2.9.5/ircd/sys_def.h --- irc2.9.5.orig/ircd/sys_def.h Wed Sep 3 19:46:07 1997 +++ irc2.9.5/ircd/sys_def.h Wed Mar 18 17:57:40 1998 @@ -18,9 +18,9 @@ */ #if defined(DEBUGMODE) && !defined(CLIENT_COMPILE) && defined(DO_DEBUG_MALLOC) -# define free(x) MyFree(x) -#else # define MyFree(x) if ((x) != NULL) free(x) +#else +# define free(x) MyFree(x) #endif #define SETSOCKOPT(fd, o1, o2, p1, o3) setsockopt(fd, o1, o2, (char *)p1,\ Only in irc2.9.5: tmp