diff -burN irc2.11.0/doc/README-jp irc2.11.0+jp8/doc/README-jp --- irc2.11.0/doc/README-jp Thu Jan 1 09:00:00 1970 +++ irc2.11.0+jp8/doc/README-jp Mon Jan 10 08:35:57 2005 @@ -0,0 +1,101 @@ +IRC server jp-patched version (2005/01/07 irc2.11.0-irc2.11.0+jp8.patch) + + このjp-patched versionは、IRC server (ftp://ftp.irc.org/irc/server/) に + 対して主に以下のような機能を付加したものです。 + + ・日本語対応IRCクライアントの多くが持っている不備を補うため、 + 多くのケースでユーザが不便な状態になるのを防ぐための機能。 + (最終的には、各クライアントの実装で解決するべき部分。) + ・IRCサーバの元々の仕様のために日本語を用いる上でユーザの利便性が + 失われている面を部分的に解決するための機能。 + + 最新のjp6版においては、いままではチャネル名に使用することができなかった、 + あるいは、使用において制限されていた、ISO-2022-JPにおける数百文字の漢字を + チャネル名の中ですべて使用することができるように対応しています。(いわゆる + #がが 問題への対応、および、#ずず 問題への対応。) この機能はjp6版以降の + 対応サーバ間でのみ有効となりますが、該当するチャネルはちょうどマスク付 + チャネル(例えば、#abc:*.jpなど)と同じ位置付けになるため、同じIRC網内に + 非対応サーバとの接続があっても相互接続上のプロトコルに影響がないように + 実装されています。 + + 今後も、本体の irc2.x と矛盾なく実現可能な機能について可能な限り実装を + 行なっていく予定です。要望や改善案などがありましたらよろしくお願いします。 + また、bug情報および不具合や問題点なども可能な限り対応したいと思いますので、 + それらについてもみなさまからの情報をお待ちしております。 + +変更履歴 + + jp8 ← jp7 + irc2.11.0対応 + + jp7 ← jp6 + irc2.10.3p3対応 + + 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/ + 連絡先: mailto:jp-patch@ircnet.jp + + このjp-patched版は 菊地高広 が作成管理しています。 + 不具合などがありましたら jp-patch@ircnet.jp までお願いします。 + 今後の情報などは http://www.ircnet.jp/ で告知する予定です。 + + 本体及びpatchともにGPLに従います。詳しくはdoc/の下の文書類をどうぞ。 + ただし、このpatchを利用したものを改変して再配布する場合は、この文書を + そのまま付けるとともに jp-patch@kyoto.wide.ad.jp まで連絡をいただける + と幸いです。改変なくそのまま再配布する場合は自由にしてくださって結構です。 + +その他の関連情報 + + JIRCC (Japan Internet-Relay-Chat Club) + JIRCCは日本におけるIRCの普及とIRCer間の交流ををはかるために + 1990年3月にできたIRCのユーザ会です。メーリングリストがあり、 + IRCに関する種々の情報交換や議論や告知が行なわれてきています。 + + jircc mailing list + IRC全般に関するメーリングリストです。 + jircc-request@irc.kyoto-u.ac.jp へメールを送ると参加方法が + 自動返送されてきます。メールの内容はあっても空でも大丈夫です。 + + jircc-oper mailing list + IRC運用に関するメーリングリストです。 + jircc-oper-request@irc.kyoto-u.ac.jp へメールを送ると参加方法が + 自動返送されてきます。メールの内容はあっても空でも大丈夫です。 + なお、jircc-operメーリングリストは jirccメーリングリストの + サブリスト的な位置付けとなっており特にサーバや網の運用を扱います。 + 内容に応じて jirccメーリングリスト本体へ戻って行なうことがあり + ますので、jirccメーリングリストのほうへも参加をしておいて下さい。 + + http://www.ircnet.jp/ + (旧) http://irc.kyoto-u.ac.jp/ + IRCに関する情報を集めたページです。 + +謝辞 + + 本patchの開発及びdebuggingにおいて、開発環境や多くの便宜を与えてくれた + 情報技術開発株式会社京都ネットワーク技術研究所 http://www.rcac.tdi.co.jp/ + 及び、その皆様方に感謝の意を表わしたいと思います。また、動作確認など + 実運用に際して利用させていただいたIRCnet、及び、その多くのユーザの皆様方に + 対し、ここに感謝の意を表わしたいと思います。 Exit 1 diff -burN irc2.11.0/ircd/channel.c irc2.11.0+jp8/ircd/channel.c --- irc2.11.0/ircd/channel.c Wed Dec 15 10:23:45 2004 +++ irc2.11.0+jp8/ircd/channel.c Mon Jan 10 10:34:42 2005 @@ -53,6 +53,11 @@ static int can_join (aClient *, aChannel *, char *); void channel_modes (aClient *, char *, char *, aChannel *); static int check_channelmask (aClient *, aClient *, char *); + +#ifdef JAPANESE +static int special_channel __P((char *)); +#endif + static aChannel *get_channel (aClient *, char *, int); static int set_mode (aClient *, aClient *, aChannel *, int *, int, char **); @@ -619,6 +624,83 @@ return 0; } +#ifdef JAPANESE +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; + char *cn; + int flag=0; + mask = rindex(chname, ':'); + if (mask && index(mask, '\033')) + return 1; + if (index(chname, ',')) + return 1; + + cn=chname; + while (*cn) + { + switch (*cn) + { + case '\033': + if (cn[1] == '$' && cn[2] == 'B') { + cn += 3; + flag = 1; + break; + } else if (cn[1] == '(' && cn[2] == 'B') { + cn += 3; + flag = 0; + break; + }else{ + cn++; break; + } + /* Never Reach Here */ + + case '{': + case '}': + case '~': + case '\\': + if (flag ==1){ + return 1; + }else{ + cn++; + break; + } + /* Never Reach Here */ + + default: + cn++; break; + } + } + 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; +} +#endif + aChannel *find_channel(char *chname, aChannel *chptr) { aChannel *achptr = chptr; @@ -844,6 +926,10 @@ if (check_channelmask(&me, cptr, chptr->chname)) return; +#ifdef JAPANESE + if (!valid_channel (cptr, chptr, 0)) + return; +#endif *modebuf = *parabuf = '\0'; channel_modes(cptr, modebuf, parabuf, chptr); @@ -900,6 +986,10 @@ if (check_channelmask(&me, cptr, chptr->chname) == -1) return; +#ifdef JAPANESE + if (!valid_channel(cptr, chptr, 0)) + return; +#endif sprintf(buf, ":%s NJOIN %s :", me2, chptr->chname); len = strlen(buf); @@ -992,8 +1082,13 @@ *modebuf = *parabuf = '\0'; modebuf[1] = '\0'; channel_modes(sptr, modebuf, parabuf, chptr); +#ifdef JAPANESE + sendto_one(sptr, replies[RPL_CHANNELMODEIS], ME, BadTo(parv[0]), + chptr->chname, modebuf, parabuf); +#else sendto_one(sptr, replies[RPL_CHANNELMODEIS], ME, BadTo(parv[0]), name, modebuf, parabuf); +#endif penalty += 1; } else /* Check parameters for the channel */ @@ -1952,12 +2047,34 @@ void clean_channelname(char *cn) { +#ifdef JAPANESE + 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++; + } + } +#else for (; *cn; cn++) if (*cn == '\007' || *cn == ' ' || *cn == ',') { *cn = '\0'; return; } +#endif } /* @@ -1973,6 +2090,57 @@ */ static void convert_scandinavian(Reg char *cn, aClient *cptr) { +#ifdef JAPANESE + int flag=0; + if (ST_NOTUID(cptr) || MyPerson(cptr)) + { + while (*cn) + { + switch (*cn) + { + case '{': + if(flag==0){ + *cn = '['; + } + cn++; + break; + case '}': + if (flag==0){ + *cn = ']'; + } + cn++; + break; + case '~': + if (flag==0){ + *cn = '^'; + } + cn++; + break; + case '\\': + if (flag==0){ + *cn = '|'; + } + cn++; + break; + case '\033': + if (cn[1] == '$' && cn[2] == 'B') { + cn += 3; + flag = 1; + break; + } else if (cn[1] == '(' && cn[2] == 'B') { + cn += 3; + flag = 0; + break; + }else{ + cn++; break; + } + default: + cn++; break; + } + } + } + +#else if (ST_NOTUID(cptr) || MyPerson(cptr)) { for (; *cn; cn++) @@ -1990,6 +2158,8 @@ } } } + +#endif } /* @@ -2001,7 +2171,11 @@ if (*chname == '&' && IsServer(cptr)) return -1; +#ifdef JAPANESE + s = get_channelmask(chname); +#else s = rindex(chname, ':'); +#endif if (!s) return 0; if ((t = index(s, '\007'))) @@ -2016,8 +2190,14 @@ if (match(s, ME) || (IsServer(cptr) && match(s, cptr->name))) { if (MyClient(sptr)) +#ifdef JAPANESE + sendto_one(sptr, replies[ERR_BADCHANMASK], + ME, BadTo(sptr->name), + chname); +#else sendto_one(sptr, replies[ERR_BADCHANMASK], ME, BadTo(sptr->name), chname); +#endif if (t) *t = '\007'; return -1; @@ -2044,6 +2224,10 @@ { len = CHANNELLEN; *(chname+CHANNELLEN) = '\0'; +#ifdef JAPANESE + if (check_channelmask(cptr, cptr, chname) == -1) + return NULL; +#endif } if ((chptr = find_channel(chname, (aChannel *)NULL))) return (chptr); @@ -2057,6 +2241,12 @@ chptr->prevch = NULL; chptr->nextch = channel; chptr->history = 0; + +#ifdef JAPANESE + chptr->flags = 0; + if (special_channel(chname)) + chptr->flags = FLAGS_JP; +#endif channel = chptr; (void)add_to_channel_hash_table(chname, chptr); } @@ -2513,17 +2703,31 @@ /* ** notify all users on the channel */ +#ifdef JAPANESE + sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", + parv[0], chptr->chname); +#else sendto_channel_butserv(chptr, sptr, ":%s JOIN :%s", parv[0], name); +#endif if (s && UseModes(name)) { /* no need if user is creating the channel */ if (chptr->users != 1) +#ifdef JAPANESE + sendto_channel_butserv(chptr, sptr, + ":%s MODE %s +%s %s %s", + cptr->name, + chptr->chname, s, + parv[0], + *(s+1)=='v'?parv[0]:""); +#else sendto_channel_butserv(chptr, sptr, ":%s MODE %s +%s %s %s", cptr->name, name, s, parv[0], *(s+1)=='v'?parv[0]:""); +#endif } /* ** If s wasn't set to chop+1 above, name is now #chname^Gov @@ -2539,17 +2743,31 @@ del_invite(sptr, chptr); if (chptr->topic[0] != '\0') { +#ifdef JAPANESE + sendto_one(sptr, replies[RPL_TOPIC], ME, + BadTo(parv[0]), chptr->chname, chptr->topic); +#else sendto_one(sptr, replies[RPL_TOPIC], ME, BadTo(parv[0]), name, chptr->topic); +#endif #ifdef TOPIC_WHO_TIME if (chptr->topic_t > 0) { +#ifdef JAPANESE + sendto_one(sptr, replies[RPL_TOPIC_WHO_TIME], + ME, BadTo(parv[0]), + chptr->chname, IsAnonymous(chptr) ? + "anonymous!anonymous@anonymous." : + chptr->topic_nuh, + chptr->topic_t); +#else sendto_one(sptr, replies[RPL_TOPIC_WHO_TIME], ME, BadTo(parv[0]), name, IsAnonymous(chptr) ? "anonymous!anonymous@anonymous." : chptr->topic_nuh, chptr->topic_t); +#endif } #endif } @@ -2564,7 +2782,12 @@ /* ** notify other servers */ +#ifdef JAPANESE + if (!valid_channel(0,chptr, 0) || get_channelmask(name) + || *chptr->chname == '!') /* compat */ +#else if (index(name, ':') || *chptr->chname == '!') /* compat */ +#endif { sendto_match_servs_v(chptr, cptr, SV_UID, ":%s NJOIN %s :%s%s", me.serv->sid, name, @@ -2800,8 +3023,13 @@ ** join from netjoin. 2.10.x is using NJOIN only during ** burst, but 2.11 always. Hence we check for EOB from 2.11 ** to know what kind of NJOIN it is. --B. */ +#ifdef JAPANESE + sendto_channel_butserv(chptr, acptr, ":%s JOIN %s%s", acptr->name, + (ST_NOTUID(sptr) || IsBursting(sptr)) ? "" : ":", chptr->chname); +#else sendto_channel_butserv(chptr, acptr, ":%s JOIN %s%s", acptr->name, (ST_NOTUID(sptr) || IsBursting(sptr)) ? "" : ":", parv[1]); +#endif /* build MODE for local users on channel, eventually send it */ if (*mbuf) { @@ -2831,11 +3059,20 @@ } break; case 2: +#ifdef JAPANESE sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s%c %s %s", sptr->name, parv[1], modebuf, mbuf[1], parabuf, acptr->name); +#else + sendto_channel_butserv(chptr, &me, + ":%s MODE %s +%s%c %s %s", + sptr->name, + chptr->chname, + modebuf, mbuf[1], + parabuf, acptr->name); +#endif if (mbuf[2]) { strcpy(modebuf, mbuf+2); @@ -2848,18 +3085,32 @@ } if (cnt == MAXMODEPARAMS) { +#ifdef JAPANESE sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s %s", sptr->name, parv[1], modebuf, parabuf); +#else + sendto_channel_butserv(chptr, &me, + ":%s MODE %s +%s %s", + sptr->name, + chptr->chname, + modebuf, parabuf); +#endif cnt = 0; } } } /* send eventual MODE leftover */ if (cnt) +#ifdef JAPANESE + sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s %s", + sptr->name, chptr->chname, + modebuf, parabuf); +#else sendto_channel_butserv(chptr, &me, ":%s MODE %s +%s %s", sptr->name, parv[1], modebuf, parabuf); +#endif /* send NJOIN */ *q = '\0'; @@ -2925,7 +3176,12 @@ /* ** Remove user from the old channel (if any) */ +#ifdef JAPANESE + if (valid_channel(0, chptr, 0) + && !get_channelmask(name) && (*chptr->chname != '!')) +#else if (!index(name, ':') && (*chptr->chname != '!')) +#endif { /* channel:*.mask */ if (*name != '&') { @@ -2949,8 +3205,13 @@ else sendto_match_servs(chptr, cptr, PartFmt, parv[0], name, comment); +#ifdef JAPANESE + sendto_channel_butserv(chptr, sptr, PartFmt, + parv[0], chptr->chname, comment); +#else sendto_channel_butserv(chptr, sptr, PartFmt, parv[0], name, comment); +#endif remove_user_from_channel(sptr, chptr); } if (*buf) @@ -3057,9 +3318,16 @@ if (IsMember(who, chptr)) { /* Local clients. */ +#ifdef JAPANESE + sendto_channel_butserv(chptr, sptr, + ":%s KICK %s %s :%s", sptr->name, + chptr->chname, + who->name, comment); +#else sendto_channel_butserv(chptr, sptr, ":%s KICK %s %s :%s", sptr->name, name, who->name, comment); +#endif /* nick buffer to kick out, build for 2.11 */ /* as we need space for ",nick", we should add @@ -3278,6 +3546,14 @@ if (*parv[2] == '&' && !MyClient(acptr)) return 1; chptr = find_channel(parv[2], NullChn); +#ifdef JAPANESE + if(!valid_channel(acptr->from, chptr, parv[2])) + { + sendto_one(sptr, replies[ERR_BADCHANMASK], ME, + chptr ? chptr->chname : parv[2]); + return 1; + } +#endif if (!chptr && parv[2][0] == '!') { /* Try to find !channel using shortname */ @@ -3448,9 +3724,15 @@ chptr = find_channel(name, NullChn); if (chptr && ShowChannel(sptr, chptr) && sptr->user) { +#ifdef JAPANESE + rlen += sendto_one(sptr, replies[RPL_LIST], + ME, BadTo(parv[0]), chptr->chname, + chptr->users, chptr->topic); +#else rlen += sendto_one(sptr, replies[RPL_LIST], ME, BadTo(parv[0]), name, chptr->users, chptr->topic); +#endif if (!MyConnect(sptr) && rlen > CHREPLLEN) break; } diff -burN irc2.11.0/ircd/channel_ext.h irc2.11.0+jp8/ircd/channel_ext.h --- irc2.11.0/ircd/channel_ext.h Sat Oct 18 06:28:18 2003 +++ irc2.11.0+jp8/ircd/channel_ext.h Mon Jan 10 08:35:57 2005 @@ -38,6 +38,12 @@ EXTERN int is_chan_op (aClient *cptr, aChannel *chptr); EXTERN int has_voice (aClient *cptr, aChannel *chptr); EXTERN int can_send (aClient *cptr, aChannel *chptr); + +#ifdef JAPANESE +EXTERN char *get_channelmask __P((char *)); +EXTERN int valid_channel __P((aClient *, aChannel *, char *)); +#endif + EXTERN aChannel *find_channel (Reg char *chname, Reg aChannel *chptr); EXTERN void setup_server_channels (aClient *mp); EXTERN void channel_modes (aClient *cptr, Reg char *mbuf, Reg char *pbuf, diff -burN irc2.11.0/ircd/s_bsd.c irc2.11.0+jp8/ircd/s_bsd.c --- irc2.11.0/ircd/s_bsd.c Sat Nov 20 00:42:08 2004 +++ irc2.11.0+jp8/ircd/s_bsd.c Mon Jan 10 08:35:57 2005 @@ -1231,14 +1231,27 @@ } if (!BadPtr(aconf->passwd)) #ifndef ZIP_LINKS +#ifdef JAPANESE + 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", aconf->passwd, pass_version, serveropts, (bootopt & BOOT_STRICTPROT) ? "P" : ""); +#endif +#else +#ifdef JAPANESE + 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" : ""); #else sendto_one(cptr, "PASS %s %s IRC|%s %s%s", aconf->passwd, pass_version, serveropts, (bootopt & BOOT_STRICTPROT) ? "P" : "", (aconf->status == CONF_ZCONNECT_SERVER) ? "Z" : ""); +#endif #endif aconf = find_conf(cptr->confs, cptr->name, CONF_NOCONNECT_SERVER); diff -burN irc2.11.0/ircd/s_send.c irc2.11.0+jp8/ircd/s_send.c --- irc2.11.0/ircd/s_send.c Sat Oct 9 21:40:29 2004 +++ irc2.11.0+jp8/ircd/s_send.c Mon Jan 10 08:35:57 2005 @@ -367,7 +367,11 @@ { return; } +#ifdef JAPANESE + if ((mask = get_channelmask(chptr->chname))) +#else if ((mask = rindex(chptr->chname, ':'))) +#endif { mask++; } diff -burN irc2.11.0/ircd/s_serv.c irc2.11.0+jp8/ircd/s_serv.c --- irc2.11.0/ircd/s_serv.c Wed Dec 15 10:25:31 2004 +++ irc2.11.0+jp8/ircd/s_serv.c Mon Jan 10 08:35:57 2005 @@ -440,6 +440,11 @@ } } +#ifdef JAPANESE + if (link && strchr(link, 'j')) /* jp version */ + cptr->flags |= FLAGS_JP; +#endif + /* right now, I can't code anything good for this */ /* Stop whining, and do it! ;) */ if (link && strchr(link, 'Z')) /* Compression requested */ @@ -1161,14 +1166,27 @@ if (bconf->passwd[0]) #ifndef ZIP_LINKS - sendto_one(cptr, "PASS %s %s IRC|%s %s", bconf->passwd, - pass_version, serveropts, +#ifdef JAPANESE + 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", + bconf->passwd, pass_version, serveropts, + (bootopt & BOOT_STRICTPROT) ? "P" : ""); +#endif +#else +#ifdef JAPANESE + 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" : ""); #else sendto_one(cptr, "PASS %s %s IRC|%s %s%s", bconf->passwd, pass_version, serveropts, (bconf->status == CONF_ZCONNECT_SERVER) ? "Z" : "", (bootopt & BOOT_STRICTPROT) ? "P" : ""); +#endif #endif /* ** Pass my info to the new server diff -burN irc2.11.0/ircd/s_user.c irc2.11.0+jp8/ircd/s_user.c --- irc2.11.0/ircd/s_user.c Mon Dec 13 02:25:16 2004 +++ irc2.11.0+jp8/ircd/s_user.c Mon Jan 10 08:35:57 2005 @@ -611,9 +611,54 @@ XLINE_EXIT_REASON); } #endif + +#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); +#ifdef GOOD_USERNAME + } +#endif SetClient(sptr); if (!MyConnect(sptr)) diff -burN irc2.11.0/ircd/version.c.SH.in irc2.11.0+jp8/ircd/version.c.SH.in --- irc2.11.0/ircd/version.c.SH.in Sat Oct 2 05:22:16 2004 +++ irc2.11.0+jp8/ircd/version.c.SH.in Mon Jan 10 08:35:57 2005 @@ -111,6 +111,11 @@ "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 , and is ported to 2.11 by", + "MARUYAMA Shin . You can find it in", + "http://www.ircnet.jp/dist/server/jp-patch/.", + "", "[$sumsserv] [$sumchan] [$sumsbsd] [$sumsuser]", "[$sumhash] [$sumsmisc] [$sumircd]", 0, Exit 1 diff -burN irc2.11.0/common/bsd.c irc2.11.0+jp8/common/bsd.c --- irc2.11.0/common/bsd.c Wed Nov 17 01:39:46 2004 +++ irc2.11.0+jp8/common/bsd.c Mon Jan 10 08:35:57 2005 @@ -91,6 +91,12 @@ writecalls++; #endif retval = send(cptr->fd, str, len, 0); + +#ifdef JAPANESE + if (retval < 0) + retval = -errno; +#endif + /* ** Convert WOULDBLOCK to a return of "0 bytes moved". This ** should occur only if socket was non-blocking. Note, that diff -burN irc2.11.0/common/send.c irc2.11.0+jp8/common/send.c --- irc2.11.0/common/send.c Fri Dec 10 23:39:04 2004 +++ irc2.11.0+jp8/common/send.c Mon Jan 10 08:35:57 2005 @@ -803,8 +803,13 @@ { if (*chptr->chname == '&') return; +#ifdef JAPANESE + if ((mask = get_channelmask(chptr->chname))) + mask++; +#else if ((mask = (char *)rindex(chptr->chname, ':'))) mask++; +#endif } else mask = (char *)NULL; @@ -816,6 +821,10 @@ continue; if (!BadPtr(mask) && match(mask, cptr->name)) continue; +#ifdef JAPANESE + if (!valid_channel(cptr, chptr, 0)) + continue; +#endif if (!len) { va_list va; @@ -838,8 +847,14 @@ { if (*chptr->chname == '&') return 0; +#ifdef JAPANESE + if ((mask = get_channelmask(chptr->chname))) + mask++; +#else if ((mask = (char *)rindex(chptr->chname, ':'))) mask++; +#endif + } else mask = (char *)NULL; @@ -851,6 +866,12 @@ continue; if (!BadPtr(mask) && match(mask, cptr->name)) continue; + +#ifdef JAPANESE + if (!valid_channel(cptr, chptr, 0)) + continue; +#endif + if ((ver & cptr->serv->version) == 0) { rc = 1; @@ -879,8 +900,13 @@ { if (*chptr->chname == '&') return 0; +#ifdef JAPANESE + if ((mask = get_channelmask(chptr->chname))) + mask++; +#else if ((mask = (char *)rindex(chptr->chname, ':'))) mask++; +#endif } else mask = (char *)NULL; @@ -892,6 +918,12 @@ continue; if (!BadPtr(mask) && match(mask, cptr->name)) continue; + +#ifdef JAPANESE + if (!valid_channel(cptr, chptr, 0)) + continue; +#endif + if ((ver & cptr->serv->version) != 0) { rc = 1; diff -burN irc2.11.0/common/struct_def.h irc2.11.0+jp8/common/struct_def.h --- irc2.11.0/common/struct_def.h Sat Nov 20 00:12:59 2004 +++ irc2.11.0+jp8/common/struct_def.h Mon Jan 10 08:35:57 2005 @@ -181,6 +181,9 @@ ** a SQUIT. */ #define FLAGS_EOB 0x4000000 /* EOB received */ #define FLAGS_LISTENINACTIVE 0x8000000 /* Listener does not listen() */ +#ifdef JAPANESE +#define FLAGS_JP 0x10000000 /* jp version */ +#endif #define FLAGS_OPER 0x0001 /* operator */ #define FLAGS_LOCOP 0x0002 /* local operator -- SRB */ @@ -688,6 +691,9 @@ 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 */ +#ifdef JAPANESE + int flags; +#endif char chname[1]; }; diff -burN irc2.11.0/common/support.c irc2.11.0+jp8/common/support.c --- irc2.11.0/common/support.c Sat Oct 2 05:22:12 2004 +++ irc2.11.0+jp8/common/support.c Mon Jan 10 08:35:57 2005 @@ -54,6 +54,12 @@ { char *pos = *save; /* keep last position across calls */ Reg char *tmp; +#ifdef JAPANESE + int flag = 0; + + if (fs[0] == ',' && fs[1] == '\0' ) + flag=1; +#endif if (str) pos = str; /* new string scan */ @@ -66,9 +72,30 @@ tmp = pos; /* now, keep position of the token */ +#ifdef JAPANESE + 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 { +#endif while (*pos && index(fs, *pos) == NULL) pos++; /* skip content of the token */ +#ifdef JAPANESE + } +#endif if (*pos) *pos++ = '\0'; /* remove first sep after the token */ else @@ -742,7 +769,11 @@ char *make_version(void) { int ve, re, mi, dv, pl; +#ifdef JAPANESE + char ver[20]; +#else char ver[15]; +#endif sscanf(PATCHLEVEL, "%2d%2d%2d%2d%2d", &ve, &re, &mi, &dv, &pl); /* version & revision */ @@ -754,6 +785,9 @@ sprintf(ver + strlen(ver), "%c%d", DEVLEVEL, dv); if (pl) /* patchlevel */ sprintf(ver + strlen(ver), "p%d", pl); +#ifdef JAPANESE + strcat(ver,"+jp8"); +#endif return mystrdup(ver); } Exit 1 diff -burN irc2.11.0/support/config.h.dist irc2.11.0+jp8/support/config.h.dist --- irc2.11.0/support/config.h.dist Fri Dec 10 23:56:41 2004 +++ irc2.11.0+jp8/support/config.h.dist Mon Jan 10 08:35:57 2005 @@ -693,6 +693,12 @@ #define LISTENER_MAXACCEPT 10 #endif +/* + * 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 */