View Issue Details

IDProjectCategoryView StatusLast Update
0003572unrealircdpublic2008-02-11 16:11
Reporterguigui Assigned Tosyzop  
Status resolvedResolutionfixed 
Platformi386OSLinuxOS Version2.4.27
Product Version3.2.7 
Fixed in Version3.2.8 
Summary0003572: Zline with IPv6
DescriptionThere is a problem using /(g)zline to add an IPv6 address with letters, IPv6 address with only digits works. I get the following error:
* ERROR: (g)zlines must be placed at *@IPMASK, not *@HOSTMASK (so for example *@192.168.* is ok, but *@* is not). This is because (g)zlines are processed BEFORE dns and ident lookups are done. If you want to use hostmasks instead of ipmasks, use a KLINE/GLINE instead.

CIDR doesn't work better.
Steps To ReproduceProblem with this one, with just one letter:
/gzline +*@2000:2000:2000:2000:2000:2000:2000:200A

No problem with this one, with only digits
/gzline +*@2000:2000:2000:2000:2000:2000:2000:2000
Additional InformationNote that adding it with anope services works, with letters or not, the Z:line is added right on the ircd, and the user get Killed/Z:lined:
/os szline add 2000:2000:2000:2000:2000:2000:200A:200A test
* *** Global Z:line added for *@2000:2000:2000:2000:2000:2000:200A:200A on Sat Jan 5 22:32:21 2008 GMT (from Guigui to expire at Mon Jan 7 22:32:21 2008 GMT: test)
-OperServ- 2000:2000:2000:2000:2000:2000:200A:200A ajouté à la liste de SZLINEs.
* *** Global -- from OperServ: Guigui added an SZLINE for 2000:2000:2000:2000:2000:2000:200A:200A (expires in 30 days)

CIDR works in this case
TagsNo tags attached.
3rd party modules


child of 0003454 resolvedsyzop Unreal3.2.8 TODO 



2008-01-05 22:51

reporter   ~0014957

Last edited: 2008-01-05 22:55

After looking in source code, I think the problem is located in src/modules/m_tkl.c, line 566 :

for (p=hostmask; *p; p++)
    if (isalpha(*p))
        sendnotice(sptr, "ERROR: (g)zlines must be placed at *@\037IPMASK\037, not *@\037HOSTMASK\037 "
                         "(so for example *@192.168.* is ok, but *@* is not). "
                         "This is because (g)zlines are processed BEFORE dns and ident lookups are done. "
                         "If you want to use hostmasks instead of ipmasks, use a KLINE/GLINE instead.");
        return -1;

I think we have to allow letters from A to F, and not from G to Z, remember IPv6 is base16.

I think too this part of code could be changed, because I don't understand with allowing everything but letters, I am able to add an IPv6 address with # \ { or other caracters that didn't have their place in IPv4 or IPv6 address... I can too add invalid IPv4 address like 999.999.999.999 :
* *** Global Z:line added for *@999.999.999.999 on Sat Jan 5 22:52:11 2008 GMT (from Guigui!~guigui@E3CE8175:B4B4307E:19A48145:IP to expire at Sat Jan 5 22:52:16 2008 GMT: boom)


2008-01-05 23:01

reporter   ~0014960

It made a long time I have not write one line of code, but why not using isxdigit() and some checks of numbers of ":" found (not more than 7 for a valid IPv6), "." (not more than 3), not ":" and "." in the same string etc...

Maybe there is a better and nicest way to do this.


2008-01-06 19:02

administrator   ~0014963

thanks for the report. this has priority.


2008-02-11 16:10

administrator   ~0015083

fixed in .699, thanks for the report! (btw, my fix sucks and is a bad example ;p)

- Fixed (G)ZLINE check.. it was incorrectly rejecting many IPv6 bans.
  Reported by guigui (0003572).

- if (isalpha(*p))
+ if (isalpha(*p) && !isxdigit(*p))

Issue History

Date Modified Username Field Change
2008-01-05 22:38 guigui New Issue
2008-01-05 22:51 guigui Note Added: 0014957
2008-01-05 22:55 guigui Note Edited: 0014957
2008-01-05 23:01 guigui Note Added: 0014960
2008-01-06 19:02 syzop Note Added: 0014963
2008-01-06 19:02 syzop Status new => acknowledged
2008-01-06 19:02 syzop Relationship added child of 0003454
2008-02-11 16:10 syzop QA => Not touched yet by developer
2008-02-11 16:10 syzop U4: Need for upstream patch => No need for upstream InspIRCd patch
2008-02-11 16:10 syzop Status acknowledged => resolved
2008-02-11 16:10 syzop Fixed in Version => 3.2.8
2008-02-11 16:10 syzop Resolution open => fixed
2008-02-11 16:10 syzop Assigned To => syzop
2008-02-11 16:10 syzop Note Added: 0015083