From 1b835703ea575eb27ee781730192cc8a861d67a5 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 14 May 2004 13:17:08 +0000 Subject: [PATCH] Forward port NICKLEN feature from 2.10.11. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1046 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 24 +++++++++++++++++++++++- doc/example.conf | 1 + doc/readme.features | 9 +++++++++ include/ircd_defs.h | 3 ++- include/ircd_features.h | 1 + include/supported.h | 5 +++-- ircd/ircd_features.c | 1 + ircd/m_nick.c | 7 ++++--- 8 files changed, 44 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index eebf019..aa04a50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,28 @@ +2004-05-14 Kevin L Mitchell + + [Original ChangeLog date: 2003-11-22 -MDP] + + * ircd/m_nick.c (m_nick): truncate the nickname to the minimum of + the maximum allowed length (NICKLEN) or the allowed nickname + length specified as the NICKLEN feature + + * ircd/ircd_features.c: declare NICKLEN and set its default value + to 9 + + * include/supported.h: add MAXNICKLEN to ISUPPORT and do a little + rearranging... + + * include/ircd_features.h: add NICKLEN feature + + * include/ircd_defs.h (NICKLEN): raise max NICKLEN to 15 + + * doc/readme.features: document new NICKLEN feature + + * doc/example.conf: list new NICKLEN F-line + 2004-05-14 Matthias Crauwels - [Original ChangeLog date: 2003-06-08 -MP] + [Original ChangeLog date: 2003-06-08 -MDP] * ircd/gline.c: fixed the counting bug in gline_memory_count diff --git a/doc/example.conf b/doc/example.conf index 38f9c2c..c3cabf2 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -722,6 +722,7 @@ features # "HIDDEN_IP"="127.0.0.1"; # "KILLCHASETIMELIMIT"="30"; # "MAXCHANNELSPERUSER"="10"; +# "NICKLEN" = "9"; # "AVBANLEN"="40"; # "MAXBANS"="30"; # "MAXSILES"="15"; diff --git a/doc/readme.features b/doc/readme.features index eb4c449..8752e1a 100644 --- a/doc/readme.features +++ b/doc/readme.features @@ -1068,3 +1068,12 @@ URL_CLIENTS * Default: "ftp://ftp.undernet.org/pub/irc/clients" This defines a URL that users may visit to find compatible IRC clients. + +NICKLEN + * Type: integer + * Default: 9 + +This is the allowed length of the nickname length. It may not be +larger than the NICKLEN #define, and should usually be the same +length. The real purpose of this feature is to permit easy increases +in nickname length for a network. diff --git a/include/ircd_defs.h b/include/ircd_defs.h index 14978fd..f489f5c 100644 --- a/include/ircd_defs.h +++ b/include/ircd_defs.h @@ -36,9 +36,10 @@ * is a default that can easily be overridden in CFLAGS. Just add * -DNICKLEN=15 to CFLAGS and save your config in .., and you can forget about * it. Thanks for helping debug guys. + * See also F:NICKLEN in ircd.conf. */ #ifndef NICKLEN -#define NICKLEN 9 +#define NICKLEN 15 #endif /* * USERLEN is the maximum length allowed of a user name including an optional diff --git a/include/ircd_features.h b/include/ircd_features.h index 8f9606a..22bd490 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -55,6 +55,7 @@ enum Feature { /* features that probably should not be touched */ FEAT_KILLCHASETIMELIMIT, FEAT_MAXCHANNELSPERUSER, + FEAT_NICKLEN, FEAT_AVBANLEN, FEAT_MAXBANS, FEAT_MAXSILES, diff --git a/include/supported.h b/include/supported.h index d875641..9e6f71a 100644 --- a/include/supported.h +++ b/include/supported.h @@ -43,6 +43,7 @@ " MAXCHANNELS=%i" \ " MAXBANS=%i" \ " NICKLEN=%i" \ + " MAXNICKLEN=%i" \ " TOPICLEN=%i" \ " AWAYLEN=%i" \ " KICKLEN=%i" @@ -55,8 +56,8 @@ #define FEATURESVALUES1 feature_int(FEAT_MAXSILES), MAXMODEPARAMS, \ feature_int(FEAT_MAXCHANNELSPERUSER), \ - feature_int(FEAT_MAXBANS), NICKLEN, TOPICLEN, \ - AWAYLEN, TOPICLEN + feature_int(FEAT_MAXBANS), feature_int(FEAT_NICKLEN), \ + NICKLEN, TOPICLEN, AWAYLEN, TOPICLEN #define FEATURESVALUES2 feature_bool(FEAT_LOCAL_CHANNELS) ? "#&" : "#", "(ov)@+", "b,k,l,imnpstrD", "rfc1459", \ feature_str(FEAT_NETWORK) diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index dbdaa04..8710d2d 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -261,6 +261,7 @@ static struct FeatureDesc { /* features that probably should not be touched */ F_I(KILLCHASETIMELIMIT, 0, 30, 0), F_I(MAXCHANNELSPERUSER, 0, 10, 0), + F_I(NICKLEN, 0, 9, 0), F_I(AVBANLEN, 0, 40, 0), F_I(MAXBANS, 0, 45, 0), F_I(MAXSILES, 0, 15, 0), diff --git a/ircd/m_nick.c b/ircd/m_nick.c index ef31e88..e7b08f7 100644 --- a/ircd/m_nick.c +++ b/ircd/m_nick.c @@ -96,6 +96,7 @@ #include "s_misc.h" #include "s_user.h" #include "send.h" +#include "sys.h" #include #include @@ -163,8 +164,8 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * garbage */ arg = parv[1]; - if (strlen(arg) > NICKLEN) - arg[NICKLEN] = '\0'; + if (strlen(arg) > IRCD_MIN(NICKLEN, feature_int(FEAT_NICKLEN))) + arg[IRCD_MIN(NICKLEN, feature_int(FEAT_NICKLEN))] = '\0'; if ((s = strchr(arg, '~'))) *s = '\0'; @@ -318,7 +319,7 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) * creation) then reject it. If from a server and we reject it, * and KILL it. -avalon 4/4/92 */ - if (strlen(nick) != do_nick_name(nick)) + if (!do_nick_name(nick) || strcmp(nick, parv[1])) { send_reply(sptr, ERR_ERRONEUSNICKNAME, parv[1]); -- 2.20.1