Anope IRC Services

Anope Support => 1.8.x/1.7.x Support (Read Only) => Topic started by: katsklaw on October 31, 2012, 03:45:52 AM

Title: Confusion with UserKeys
Post by: katsklaw on October 31, 2012, 03:45:52 AM
We've seen an issue on the Unreal IRCd forum where an user specified an UserKey that started with a 0 and it seems it failed to pass the parser which tossed back the userkey must be a positive integer error. Thread is at: http://forums.unrealircd.com/viewtopic.php?f=3&t=7685

I know 1.8 is supposedly your stable branch but could a note be added to your example.conf stating the UserKeys shouldn't start with 0?
Title: Re: Confusion with UserKeys
Post by: Denver Freeburn on October 31, 2012, 02:41:28 PM
Hi. Did you add this to the bug tracker?
If not, I'll do it
Title: Re: Confusion with UserKeys
Post by: Charles Kingsley on October 31, 2012, 03:25:15 PM
Agree.
Title: Re: Confusion with UserKeys
Post by: Adam on October 31, 2012, 05:30:24 PM
It looks like this is strtol() reporting this error, I don't think there is a very easy fix for this
Title: Re: Confusion with UserKeys
Post by: katsklaw on October 31, 2012, 05:41:59 PM
It looks like this is strtol() reporting this error, I don't think there is a very easy fix for this

I think simply telling users to not use 0 as the first character in the directive description in example.conf is the easiest solution instead of changing the source code in a stable branch. If someone wants to do a bug report, that would be great.
Title: Re: Confusion with UserKeys
Post by: Charles Kingsley on October 31, 2012, 06:03:28 PM
Denver's done one already, I agree just updating the config is sensible.
Title: Re: Confusion with UserKeys
Post by: Naram Qashat on October 31, 2012, 06:21:43 PM
Making the config say not to put a 0 at the beginning could work.  Because what is happening is that the number is being seen as octal and if you have an 8 or 9 anywhere in the string, the conversion stops there.

After a little digging, it seems that the proper solution is 2 things.  First being that we shouldn't have the base set to 0, but rather to 10.  Second being that we need to be resetting errno before each strtol call we make and then only check the value of errno for it to be 0 or not (right now it's checking the value of *endptr, which is not indicative of an error).
Title: Re: Confusion with UserKeys
Post by: Denver Freeburn on October 31, 2012, 06:56:12 PM
http://bugs.anope.org/view.php?id=1457

Comment from Adam says it's fixed, although his comment up there threw me off
Title: Re: Confusion with UserKeys
Post by: Adam on October 31, 2012, 07:00:11 PM
I didn't think it was easy to fix. CBX then offered some input, I found a solution based on it, and committed it.
Title: Re: Confusion with UserKeys
Post by: Denver Freeburn on October 31, 2012, 07:01:51 PM
Ah right.
Caught up now.
Sorry - braindead today