Anope IRC Services

Anope.org => Anope General => Topic started by: lavinpj1 on January 07, 2010, 02:49:38 AM

Title: BOT ADD idents in 1.8 and 1.9
Post by: lavinpj1 on January 07, 2010, 02:49:38 AM
I wasn't exactly sure where to put this as it's an issue in both 1.8 and 1.9 so feel free to move it if it'd fit better elsewhere.

When adding a bot with an ident of any length that contains an apparently invalid character (I have tried - and .) Anope throws BOT_LONG_IDENT (Bot Idents may only contain 9 characters.).

I can see in the language files that BOT_BAD_IDENT is defined but is never used in the code. It seems like this is the error that should be thrown for this.

It'd also be nice if it didn't needlessly restrict the characters that can make up an ident as - and . are certainly not disallowed and I'm sure some other disallowed characters are also allowed.

The problem code in 1.8.2 looks to be on line 125-130 of bs_bot.c which checks if each character is alpha numeric and returns BOT_LONG_IDENT if not.

Suggested fix, to keep me happy is to replace those lines with:

Code: [Select]
           
            for (ch = user; *ch && (ch - user) < USERMAX; ch++) {
                if (!isalnum(*ch) && *ch != '.' && *ch != '-') {
                    notice_lang(s_BotServ, u, BOT_BAD_IDENT);
                    return MOD_CONT;
                }
            }

Not entirely sure if this would break any IRCDs that don't allow those characters and I couldn't find any information in various RFCs about exactly which characters should be allowed however, since some clients take the ident from the username of an e-mail address, it could be safe to assume A-Z 0-9 . _ % + -

Phil
Title: Re: BOT ADD idents in 1.8 and 1.9
Post by: Jan Milants on January 07, 2010, 07:43:49 AM
Valid ident characters would be A-Z 0-9 . _
- is not a valid ident char. While some ircd's may be more tolerant about it, anope supports many so should stick to the standards.

This is a duplicate of bug #1118 on the tracker (which is where bugs should go..)