diff -ubrN irc2.10.3p5/README-jp irc2.10.3p5+jp6/README-jp --- irc2.10.3p5/README-jp 1970-01-01 09:00:00.000000000 +0900 +++ irc2.10.3p5+jp6/README-jp 2004-01-09 03:59:40.000000000 +0900 @@ -0,0 +1,85 @@ +IRC server jp-patched version (2004/01/09 irc2.10.3p5+jp6) + + このjp-patched versionは、IRC server (ftp://ftp.irc.org/irc/server/) に + 対して主に以下のような機能を付加したものです。 + + ・日本語対応IRCクライアントの多くが持っている不備を補うため、 + 多くのケースでユーザが不便な状態になるのを防ぐための機能。 + (最終的には、各クライアントの実装で解決するべき部分。) + ・IRCサーバの元々の仕様のために日本語を用いる上でユーザの利便性が + 失われている面を部分的に解決するための機能。 + + 最新のjp6版においては、いままではチャネル名に使用することができなかった、 + あるいは、使用において制限されていた、ISO-2022-JPにおける数百文字の漢字を + チャネル名の中ですべて使用することができるように対応しています。(いわゆる + #がが 問題への対応、および、#ずず 問題への対応。) この機能はjp6版以降の + 対応サーバ間でのみ有効となりますが、該当するチャネルはちょうどマスク付 + チャネル(例えば、#abc:*.jpなど)と同じ位置付けになるため、同じIRC網内に + 非対応サーバとの接続があっても相互接続上のプロトコルに影響がないように + 実装されています。 + + 今後も、本体の irc2.x と矛盾なく実現可能な機能について可能な限り実装を + 行なっていく予定です。要望や改善案などがありましたらよろしくお願いします。 + また、bug情報および不具合や問題点なども可能な限り対応したいと思いますので、 + それらについてもみなさまからの情報をお待ちしております。 + +変更履歴 + + jp6 ← jp5 + irc2.10.3対応 + ircd/s_user.cにおけるチャネル名正規化洩れをfix + split時に発生するチャネルマスク関係の伝播洩れbugをfix + GOOD_USERNAMEを A-Z,a-z,0-9,_,-,. へと増加 + いわゆる #がが 問題に対応して利用可能へ + いわゆる #ずず 問題に対応して利用可能へ + + jp5 ← jp4 + ircd/channel.cにおけるチャネル名正規化bugをfix + + jp4 ← jp3 + irc2.9.5対応 + common/send.cにおけるdeliver_it()でのエラー時にエラー情報を返すため、 + common/bsd.cでのdeliver_it()の戻り値を-1ではなく-errnoを返すようにした。 + + jp3 ← jp2 + irc2.9.4対応 + GOOD_USERNAMEでのjp2y1b版に合わせた。 + A-Z,a-z,0-9,_,- の任意の組み合わせでOKと緩和 + +注意事項 + + 入手先: http://www.ircnet.jp/dist/server/jp-patch/ + 告知先: http://www.ircnet.jp/server/jp-patch/ + 連絡先: mailto:jp-patch@ircnet.jp + + このjp-patched版は 菊地高広 が作成管理しています。 + 不具合などがありましたら jp-patch@ircnet.jp までお願いします。 + 今後の情報などは http://www.ircnet.jp/server/jp-patch/ で告知する予定です。 + + 本体及びpatchともにGPLに従います。詳しくはdoc/の下の文書類をどうぞ。 + ただし、このpatchを利用したものを改変して再配布する場合は、この文書を + そのまま付けるとともに jp-patch@ircnet.jp まで連絡をいただけると幸いです。 + 改変なくそのまま再配布する場合は自由にしてくださって結構です。 + +その他の関連情報 + + JIRCC (Japan Internet-Relay-Chat Club) + JIRCCは日本におけるIRCの普及とIRCer間の交流ををはかるために + 1990年3月にできたIRCのユーザ会です。メーリングリストがあり、 + IRCに関する種々の情報交換や議論や告知が行なわれてきています。 + + jircc mailing list + IRC全般に関するメーリングリストです。 + jircc-request@ircnet.jp へメールを送ると参加方法が + 自動返送されてきます。メールの内容はあっても空でも大丈夫です。 + + http://www.ircnet.jp/ + IRCに関する情報を集めたページです。 + +謝辞 + + 本patchの開発及びdebuggingにおいて、開発環境や多くの便宜を与えてくれた + 情報技術開発株式会社京都ネットワーク技術研究所 http://www.tdi.co.jp/ + 及び、その皆様方に感謝の意を表わしたいと思います。また、動作確認など + 実運用に際して利用させていただいたIRCnet、及び、その多くのユーザの皆様方に + 対し、ここに感謝の意を表わしたいと思います。 diff -ubrN irc2.10.3p5/common/bsd.c irc2.10.3p5+jp6/common/bsd.c --- irc2.10.3p5/common/bsd.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/common/bsd.c 2004-01-04 07:06:01.000000000 +0900 @@ -106,6 +106,10 @@ (void)alarm(WRITEWAITDELAY); #endif retval = send(cptr->fd, str, len, 0); + + if (retval < 0) + retval = -errno; + /* ** Convert WOULDBLOCK to a return of "0 bytes moved". This ** should occur only if socket was non-blocking. Note, that diff -ubrN irc2.10.3p5/common/send.c irc2.10.3p5+jp6/common/send.c --- irc2.10.3p5/common/send.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/common/send.c 2004-01-08 00:35:10.000000000 +0900 @@ -345,7 +345,13 @@ msg = dbuf_map(&to->sendQ, &len); /* Returns always len > 0 */ if ((rlen = deliver_it(to, msg, len)) < 0) - return dead_link(to,"Write error to %s, closing link"); + { + char linebuf[1024]; + (void)sprintf(linebuf, + "Write error (%s) to %%s, closing link", + sys_errlist[-rlen]); + return dead_link(to, linebuf); + } (void)dbuf_delete(&to->sendQ, rlen); to->lastsq = DBufLength(&to->sendQ)/1024; if (rlen < len) /* ..or should I continue until rlen==0? */ @@ -1058,7 +1064,7 @@ { if (*chptr->chname == '&') return; - if ((mask = (char *)rindex(chptr->chname, ':'))) + if ((mask = get_channelmask(chptr->chname))) mask++; } else @@ -1071,6 +1077,8 @@ continue; if (!BadPtr(mask) && match(mask, cptr->name)) continue; + if (!valid_channel(cptr, chptr, 0)) + continue; if (chptr && *chptr->chname == '!' && !(cptr->serv->version & SV_NJOIN)) continue; @@ -1113,7 +1121,7 @@ { if (*chptr->chname == '&') return 0; - if ((mask = (char *)rindex(chptr->chname, ':'))) + if ((mask = get_channelmask(chptr->chname))) mask++; } else @@ -1126,6 +1134,8 @@ continue; if (!BadPtr(mask) && match(mask, cptr->name)) continue; + if (!valid_channel(cptr, chptr, 0)) + continue; if (chptr && *chptr->chname == '!' && !(cptr->serv->version & SV_NJOIN)) continue; @@ -1174,7 +1184,7 @@ { if (*chptr->chname == '&') return 0; - if ((mask = (char *)rindex(chptr->chname, ':'))) + if ((mask = get_channelmask(chptr->chname))) mask++; } else @@ -1187,6 +1197,8 @@ continue; if (!BadPtr(mask) && match(mask, cptr->name)) continue; + if (!valid_channel(cptr, chptr, 0)) + continue; if (chptr && *chptr->chname == '!' && !(cptr->serv->version & SV_NJOIN)) continue; diff -ubrN irc2.10.3p5/common/struct_def.h irc2.10.3p5+jp6/common/struct_def.h --- irc2.10.3p5/common/struct_def.h 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/common/struct_def.h 2004-01-08 00:35:10.000000000 +0900 @@ -167,6 +167,7 @@ #define FLAGS_ZIPRQ 0x800000 /* zip requested */ #define FLAGS_ZIPSTART 0x1000000 /* start of zip (ignore any CRLF) */ #define FLAGS_HELD 0x8000000 /* connection held and reconnect try */ +#define FLAGS_JP 0x10000000 /* jp version */ #define FLAGS_OPER 0x0001 /* Operator */ #define FLAGS_LOCOP 0x0002 /* Local operator -- SRB */ @@ -577,6 +578,7 @@ Link *clist; /* list of local! connections which are members */ time_t history; /* channel history (aka channel delay) */ time_t reop; /* server reop stamp for !channels */ + int flags; char chname[1]; }; diff -ubrN irc2.10.3p5/common/support.c irc2.10.3p5+jp6/common/support.c --- irc2.10.3p5/common/support.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/common/support.c 2004-01-09 01:03:46.000000000 +0900 @@ -61,6 +61,10 @@ { char *pos = *save; /* keep last position across calls */ Reg char *tmp; + int flag = 0; + + if (fs[0] == ',' && fs[1] == '\0') + flag = 1; if (str) pos = str; /* new string scan */ @@ -73,8 +77,25 @@ tmp = pos; /* now, keep position of the token */ + if (flag) { + flag = 0; + while (*pos) { + if (!flag && *pos == ',') { + break; + } else if (pos[0] == '\033' && pos[1] == '$' && pos[2] == 'B') { + pos += 3; + flag = 1; + } else if (pos[0] == '\033' && pos[1] == '(' && pos[2] == 'B') { + pos += 3; + flag = 0; + } else { + pos++; + } + } + } else { while (*pos && index(fs, *pos) == NULL) pos++; /* skip content of the token */ + } if (*pos) *pos++ = '\0'; /* remove first sep after the token */ @@ -849,7 +870,7 @@ char *make_version() { int ve, re, mi, dv, pl; - char ver[15]; + char ver[20]; sscanf(PATCHLEVEL, "%2d%2d%2d%2d%2d", &ve, &re, &mi, &dv, &pl); /* version & revision */ @@ -861,6 +882,7 @@ sprintf(ver + strlen(ver), "%c%d", DEVLEVEL, dv); if (pl) /* patchlevel */ sprintf(ver + strlen(ver), "p%d", pl); + strcat(ver,"+jp6"); return mystrdup(ver); } diff -ubrN irc2.10.3p5/ircd/channel.c irc2.10.3p5+jp6/ircd/channel.c --- irc2.10.3p5/ircd/channel.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/channel.c 2004-01-08 05:30:08.000000000 +0900 @@ -47,6 +47,7 @@ static int can_join __P((aClient *, aChannel *, char *)); void channel_modes __P((aClient *, char *, char *, aChannel *)); static int check_channelmask __P((aClient *, aClient *, char *)); +static int special_channel __P((char *)); static aChannel *get_channel __P((aClient *, char *, int)); static int set_mode __P((aClient *, aClient *, aChannel *, int *, int,\ char **, char *,char *)); @@ -543,6 +544,45 @@ return 0; } +char *get_channelmask(chname) +char *chname; +{ + char *mask; + + mask = rindex(chname, ':'); + if (mask && !index(mask, '\033')) + return mask; + + return NULL; +} + +int special_channel(chname) +char *chname; +{ + char *mask; + + mask = rindex(chname, ':'); + if (mask && index(mask, '\033')) + return 1; + if (index(chname, ',')) + return 1; + + return 0; +} + +int valid_channel(cptr, chptr, chname) +aClient *cptr; +aChannel *chptr; +char *chname; +{ + if (((chptr && (chptr->flags & FLAGS_JP)) || + (chname && special_channel(chname))) && + (!cptr || (IsServer(cptr) && !(cptr->flags & FLAGS_JP)))) + return 0; + + return 1; +} + aChannel *find_channel(chname, chptr) Reg char *chname; Reg aChannel *chptr; @@ -759,6 +799,8 @@ if (check_channelmask(&me, cptr, chptr->chname)) return; + if (!valid_channel(cptr, chptr, 0)) + return; *modebuf = *parabuf = '\0'; channel_modes(cptr, modebuf, parabuf, chptr); @@ -806,6 +848,8 @@ if (check_channelmask(&me, cptr, chptr->chname) == -1) return; + if (!valid_channel(cptr, chptr, 0)) + return; if (*chptr->chname == '!' && !(cptr->serv->version & SV_NCHAN)) return; @@ -912,7 +956,7 @@ modebuf[1] = '\0'; channel_modes(sptr, modebuf, parabuf, chptr); sendto_one(sptr, rpl_str(RPL_CHANNELMODEIS, parv[0]), - name, modebuf, parabuf); + chptr->chname, modebuf, parabuf); penalty += 1; } else /* Check parameters for the channel */ @@ -957,7 +1001,7 @@ { sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s", - parv[0], name, + parv[0], chptr->chname, modebuf, parabuf); #ifdef USE_SERVICES *modebuf = *parabuf = '\0'; @@ -1788,11 +1832,24 @@ void clean_channelname(cn) Reg char *cn; { - for (; *cn; cn++) - if (*cn == '\007' || *cn == ' ' || *cn == ',') - { + int flag = 0; + + while (*cn) { + if (*cn == '\007' || *cn == ' ') { *cn = '\0'; return; + } else if (!flag && *cn == ',') { + *cn = '\0'; + return; + } else if (cn[0] == '\033' && cn[1] == '$' && cn[2] == 'B') { + cn += 3; + flag = 1; + } else if (cn[0] == '\033' && cn[1] == '(' && cn[2] == 'B') { + cn += 3; + flag = 0; + } else { + cn++; + } } } @@ -1807,7 +1864,7 @@ if (*chname == '&' && IsServer(cptr)) return -1; - s = rindex(chname, ':'); + s = get_channelmask(chname); if (!s) return 0; if ((t = index(s, '\007'))) @@ -1848,6 +1905,8 @@ { len = CHANNELLEN; *(chname+CHANNELLEN) = '\0'; + if (check_channelmask(cptr, cptr, chname) == -1) + return NULL; } if ((chptr = find_channel(chname, (aChannel *)NULL))) return (chptr); @@ -1861,6 +1920,9 @@ chptr->prevch = NULL; chptr->nextch = channel; chptr->history = 0; + chptr->flags = 0; + if (special_channel(chname)) + chptr->flags = FLAGS_JP; channel = chptr; (void)add_to_channel_hash_table(chname, chptr); } @@ -2223,6 +2285,8 @@ chptr = get_channel(sptr, name, CREATE); + if (!chptr) + continue; if (IsMember(sptr, chptr)) continue; if (!chptr || @@ -2275,14 +2339,15 @@ ** notify all users on the channel */ sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", - parv[0], name); + parv[0], chptr->chname); if (s && UseModes(name)) { /* no need if user is creating the channel */ if (chptr->users != 1) sendto_channel_butserv(chptr, sptr, ":%s MODE %s +%s %s %s", - cptr->name, name, s, + cptr->name, + chptr->chname, s, parv[0], *(s+1)=='v'?parv[0]:""); *--s = '\007'; @@ -2299,8 +2364,8 @@ del_invite(sptr, chptr); if (chptr->topic[0] != '\0') sendto_one(sptr, rpl_str(RPL_TOPIC, parv[0]), - name, chptr->topic); - parv[1] = name; + chptr->chname, chptr->topic); + parv[1] = chptr->chname; (void)m_names(cptr, sptr, 2, parv); if (IsAnonymous(chptr) && !IsQuiet(chptr)) { @@ -2311,7 +2376,8 @@ /* ** notify other servers */ - if (index(name, ':') || *chptr->chname == '!') /* compat */ + if (!valid_channel(0, chptr, 0) || get_channelmask(name) + || *chptr->chname == '!') /* compat */ sendto_match_servs(chptr, cptr, ":%s JOIN :%s%s", parv[0], name, chop); else if (*chptr->chname != '&') @@ -2459,7 +2525,7 @@ ""); /* send join to local users on channel */ sendto_channel_butserv(chptr, acptr, ":%s JOIN %s", name, - parv[1]); + chptr->chname); /* build MODE for local users on channel, eventually send it */ if (*mbuf) { @@ -2491,7 +2557,8 @@ case 2: sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s%c %s %s", - sptr->name, parv[1], + sptr->name, + chptr->chname, modebuf, mbuf[1], parabuf, name); if (mbuf[2]) @@ -2508,7 +2575,8 @@ { sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s %s", - sptr->name, parv[1], + sptr->name, + chptr->chname, modebuf, parabuf); cnt = 0; } @@ -2517,7 +2585,8 @@ /* send eventual MODE leftover */ if (cnt) sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s %s", - sptr->name, parv[1], modebuf, parabuf); + sptr->name, chptr->chname, + modebuf, parabuf); /* send NJOIN to capable servers */ *q = '\0'; @@ -2576,7 +2645,8 @@ /* ** Remove user from the old channel (if any) */ - if (!index(name, ':') && (*chptr->chname != '!')) + if (valid_channel(0, chptr, 0) + && !get_channelmask(name) && (*chptr->chname != '!')) { /* channel:*.mask */ if (*name != '&') { @@ -2589,7 +2659,7 @@ sendto_match_servs(chptr, cptr, PartFmt, parv[0], name, comment); sendto_channel_butserv(chptr, sptr, PartFmt, - parv[0], name, comment); + parv[0], chptr->chname, comment); remove_user_from_channel(sptr, chptr); } if (*buf) @@ -2681,7 +2751,8 @@ { sendto_channel_butserv(chptr, sptr, ":%s KICK %s %s :%s", parv[0], - name, who->name, comment); + chptr->chname, + who->name, comment); /* Don't send &local kicks out */ /* Send !channels and #chan:*.els kicks only to servers that understand those channels. @@ -2692,7 +2763,9 @@ upon chptr being &channel --Beeth */ if (*chptr->chname != '&' && *chptr->chname != '!' && - index(chptr->chname, ':') == NULL) { + !get_channelmask(chptr->chname) && + valid_channel(0, chptr, 0)) + { if (*nickbuf) (void)strcat(nickbuf, ","); (void)strcat(nickbuf, who->name); @@ -2863,6 +2936,12 @@ if (*parv[2] == '&' && !MyClient(acptr)) return 1; chptr = find_channel(parv[2], NullChn); + if (!valid_channel(acptr->from, chptr, parv[2])) + { + sendto_one(sptr, err_str(ERR_BADCHANMASK, parv[0]), + chptr ? chptr->chname : parv[2]); + return 1; + } if (!chptr) { @@ -2961,7 +3040,7 @@ if (chptr && ShowChannel(sptr, chptr) && sptr->user) { rlen += sendto_one(sptr, rpl_str(RPL_LIST, - parv[0]), name, + parv[0]), chptr->chname, chptr->users, chptr->topic); if (!MyConnect(sptr) && rlen > CHREPLLEN) break; @@ -3025,10 +3104,12 @@ mlen += strlen(parv[0]); if (!BadPtr(para)) { - s = index(para, ','); + para = strtoken(&s, para, ","); + if (!para) + para = parv[1]; if (s && MyConnect(sptr) && s != para) { - parv[1] = ++s; + parv[1] = s; (void)m_names(cptr, sptr, parc, parv); } clean_channelname(para); @@ -3126,7 +3207,8 @@ if (!MyConnect(sptr) && (rlen > CHREPLLEN)) sendto_one(sptr, err_str(ERR_TOOMANYMATCHES, parv[0]), para); - sendto_one(sptr, rpl_str(RPL_ENDOFNAMES, parv[0]), para); + sendto_one(sptr, rpl_str(RPL_ENDOFNAMES, parv[0]), + ch2ptr ? ch2ptr->chname : para); return(1); } @@ -3189,6 +3271,7 @@ return 2; } + void send_user_joins(cptr, user) aClient *cptr, *user; { @@ -3210,9 +3293,11 @@ if (*chptr->chname == '!' && !(cptr->serv->version & SV_NCHAN)) /* in reality, testing SV_NCHAN here is pointless */ continue; - if ((mask = rindex(chptr->chname, ':'))) + if ((mask = get_channelmask(chptr->chname))) if (match(++mask, cptr->name)) continue; + if (!valid_channel(cptr, chptr, 0)) + continue; clen = strlen(chptr->chname); if ((clen + len) > (size_t) BUFSIZE - 7) { diff -ubrN irc2.10.3p5/ircd/channel_ext.h irc2.10.3p5+jp6/ircd/channel_ext.h --- irc2.10.3p5/ircd/channel_ext.h 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/channel_ext.h 2004-01-08 00:35:10.000000000 +0900 @@ -38,6 +38,8 @@ EXTERN int is_chan_op __P((aClient *cptr, aChannel *chptr)); EXTERN int has_voice __P((aClient *cptr, aChannel *chptr)); EXTERN int can_send __P((aClient *cptr, aChannel *chptr)); +EXTERN char *get_channelmask __P((char *)); +EXTERN int valid_channel __P((aClient *, aChannel *, char *)); EXTERN aChannel *find_channel __P((Reg char *chname, Reg aChannel *chptr)); EXTERN void setup_server_channels __P((aClient *mp)); EXTERN void channel_modes __P((aClient *cptr, Reg char *mbuf, Reg char *pbuf, diff -ubrN irc2.10.3p5/ircd/ircd.c irc2.10.3p5+jp6/ircd/ircd.c --- irc2.10.3p5/ircd/ircd.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/ircd.c 2004-01-08 00:35:10.000000000 +0900 @@ -804,9 +804,8 @@ } #endif -#if !defined(CHROOTDIR) (void)setuid((uid_t)euid); -# if defined(IRC_UID) && defined(IRC_GID) +#if defined(IRC_UID) && defined(IRC_GID) if ((int)getuid() == 0) { /* run as a specified user */ @@ -816,8 +815,7 @@ (void)setgid(IRC_GID); (void)setuid(IRC_UID); } -# endif -#endif /*CHROOTDIR/UID/GID*/ +#endif #if defined(USE_IAUTH) if ((bootopt & BOOT_NOIAUTH) == 0) diff -ubrN irc2.10.3p5/ircd/s_bsd.c irc2.10.3p5+jp6/ircd/s_bsd.c --- irc2.10.3p5/ircd/s_bsd.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/s_bsd.c 2004-01-08 00:35:10.000000000 +0900 @@ -1076,11 +1076,11 @@ } if (!BadPtr(aconf->passwd)) #ifndef ZIP_LINKS - sendto_one(cptr, "PASS %s %s IRC|%s %s", aconf->passwd, + sendto_one(cptr, "PASS %s %s IRC|%s %sj", aconf->passwd, pass_version, serveropts, (bootopt & BOOT_STRICTPROT) ? "P" : ""); #else - sendto_one(cptr, "PASS %s %s IRC|%s %s%s", aconf->passwd, + sendto_one(cptr, "PASS %s %s IRC|%s %s%sj", aconf->passwd, pass_version, serveropts, (bootopt & BOOT_STRICTPROT) ? "P" : "", (aconf->status == CONF_ZCONNECT_SERVER) ? "Z" : ""); diff -ubrN irc2.10.3p5/ircd/s_serv.c irc2.10.3p5+jp6/ircd/s_serv.c --- irc2.10.3p5/ircd/s_serv.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/s_serv.c 2004-01-08 00:35:10.000000000 +0900 @@ -350,6 +350,9 @@ } } + if (link && strchr(link, 'j')) /* jp version */ + cptr->flags |= FLAGS_JP; + /* right now, I can't code anything good for this */ /* Stop whining, and do it! ;) */ if (link && strchr(link, 'Z')) /* Compression requested */ @@ -754,11 +757,11 @@ { if (bconf->passwd[0]) #ifndef ZIP_LINKS - sendto_one(cptr, "PASS %s %s IRC|%s %s", bconf->passwd, - pass_version, serveropts, + sendto_one(cptr, "PASS %s %s IRC|%s %sj", + bconf->passwd, pass_version, serveropts, (bootopt & BOOT_STRICTPROT) ? "P" : ""); #else - sendto_one(cptr, "PASS %s %s IRC|%s %s%s", + sendto_one(cptr, "PASS %s %s IRC|%s %s%sj", bconf->passwd, pass_version, serveropts, (bconf->status == CONF_ZCONNECT_SERVER) ? "Z" : "", (bootopt & BOOT_STRICTPROT) ? "P" : ""); diff -ubrN irc2.10.3p5/ircd/s_user.c irc2.10.3p5+jp6/ircd/s_user.c --- irc2.10.3p5/ircd/s_user.c 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/s_user.c 2004-01-08 05:49:52.000000000 +0900 @@ -587,9 +587,53 @@ /* *user->tok = '1'; user->tok[1] = '\0';*/ sp = user->servp; + +#ifdef GOOD_USERNAME + for (i = 0; i < USERLEN; i++) + { + if (!user->username[i]) + break; + if (i == 0 && prefix) + continue; + if (!isalnum(user->username[i]) && + !strchr("-_.", user->username[i])) + { + sendto_flag(SCH_LOCAL, "Bad username %s@%s.", + user->username, sptr->sockhost); + ircstp->is_ref++; + sptr->exitc = EXITC_REF; +#if defined(USE_SYSLOG) && defined(SYSLOG_CONN) + syslog(LOG_NOTICE, "%s (%s): %s@%s [%s] %c\n", + myctime(sptr->firsttime), " Badname ", + user->username, user->host, + sptr->auth, '-'); +#endif +#ifdef FNAME_CONNLOG + sendto_flog(sptr, " Badname ", user->username, + user->host); +#endif + sprintf(buf, "Bad username: %s", + user->username); + return exit_client(cptr, sptr, &me, buf); + } + } +#endif + } else + { +#ifdef GOOD_USERNAME + for (i = 0; i < USERLEN; i++) + { + if (!username[i]) + break; + if (!isalnum(username[i]) && + !strchr("^~+=-_.", username[i])) + username[i] = '.'; + } +#endif strncpyzt(user->username, username, USERLEN+1); + } SetClient(sptr); if (!MyConnect(sptr)) @@ -1176,7 +1220,8 @@ if (can_send(sptr, chptr) == 0 || IsServer(sptr)) sendto_channel_butone(cptr, sptr, chptr, ":%s %s %s :%s", - parv[0], cmd, nick, + parv[0], cmd, + chptr->chname, parv[2]); else if (!notice) sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN, @@ -1479,6 +1524,7 @@ match(mask, acptr->info) == 0)) who_one(sptr, acptr, ch2ptr, NULL); } + } /* @@ -1512,6 +1558,7 @@ mask && penalty <= MAXPENALTY; mask = strtoken(&p, NULL, ",")) { + chptr = NULL; channame = NULL; penalty += 1; @@ -1608,7 +1655,8 @@ } } sendto_one(sptr, rpl_str(RPL_ENDOFWHO, parv[0]), - BadPtr(mask) ? "*" : mask); + BadPtr(mask) ? "*" : + (chptr ? chptr->chname : mask)); } return penalty; } diff -ubrN irc2.10.3p5/ircd/version.c.SH.in irc2.10.3p5+jp6/ircd/version.c.SH.in --- irc2.10.3p5/ircd/version.c.SH.in 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/ircd/version.c.SH.in 2004-01-09 03:59:40.000000000 +0900 @@ -106,6 +106,10 @@ "Thanks also to those who provide the kind sys admins who let me and", "others continue to develop IRC.", "", + "This program is a jp-patched version. The jp-patch was written by", + "KIKUCHI Takahiro . You can find it in", + "http://www.ircnet.jp/dist/server/jp-patch/.", + "", "[$sumsserv] [$sumchan] [$sumsbsd] [$sumsuser]", "[$sumhash] [$sumsmisc] [$sumircd]", 0, diff -ubrN irc2.10.3p5/support/config.h.dist irc2.10.3p5+jp6/support/config.h.dist --- irc2.10.3p5/support/config.h.dist 2003-10-14 00:20:11.000000000 +0900 +++ irc2.10.3p5+jp6/support/config.h.dist 2004-01-08 00:35:10.000000000 +0900 @@ -98,7 +98,7 @@ * mode "i" (i == invisible). Invisibility means people dont showup in * WHO or NAMES unless they are on the same channel as you. */ -#undef NO_DEFAULT_INVISIBLE +#define NO_DEFAULT_INVISIBLE /* OPER_KILL * @@ -121,7 +121,7 @@ #undef OPER_KILL #define OPER_REHASH #undef OPER_RESTART -#define OPER_DIE +#undef OPER_DIE #undef OPER_REMOTE #undef LOCOP_REHASH #undef LOCOP_RESTART @@ -271,7 +271,7 @@ * define this if you want to use crypted passwords for operators in your * ircd.conf file. See contrib/mkpasswd/README for more details on this. */ -#undef CRYPT_OPER_PASSWORD +#define CRYPT_OPER_PASSWORD /* * If you want to store encrypted passwords in N-lines for server links, @@ -344,7 +344,7 @@ * Some people believe a bot can exactly time the delay and don't like it, * I think this is a useless concern. -krys */ -#undef RANDOM_NDELAY +#define RANDOM_NDELAY /* * You've read the BOFH saga and you liked it, then define the following. @@ -389,6 +389,12 @@ */ #define SIXBONE_HACK +/* + * Defining this will make the server accept a only good username. + * (isalnum(c) || strchr("-_.", c)) + */ +#define GOOD_USERNAME + /* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */ /* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */ /* STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP */