View Issue Details

IDProjectCategoryView StatusLast Update
0002922unrealircdpublic2006-05-22 16:04
Reporterrave Assigned To 
PrioritynormalSeveritycrashReproducibilityrandom
Status closedResolutionno change required 
Product Version3.2.4 
Summary0002922: Crash in server to server protocol (NICKIP + NICKv2)
DescriptionI looks like Unreal 2.3.4 crashes upoun recving a NICKIP NICK message.
I reasendly downloaded Unreal3.2.4 because Unreal3.2 kept on crashing and kept on bugging about fd`s.

My Intended work todo whas, updating my own ircd to Unreal`s server to server protocol so i started reading the "serverprotocol.html" file and implanted support to NICKIP but to my supprice

A) Unreal 3.2.4 didnt send me NICKIP alike NICK messages
B) IT crashed when i did send my NICK message.

Data from Unreal3.2.4:


21:01:27: Client: PASS :xxxx
21:01:27: Client: PROTOCTL NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS SJB64 TKLEXT NICKIP CHANMODES=beIqa,kfL,lj,psmntirRcOAQKVCuzNSMTG NICKCHARS=
21:01:27: Client: SERVER xxx.xxx.xxx 1 :U2307-FhiXOoE-1 rsn

Then from Unreal.

C)
21:01:27: Server: xx.xx.xx SMO o :(link) Link xx.xx.xx -> xx.xx.xx2[@127.0.0.1.0] established
21:01:27: Server: NICK rave 1 1148324436 rave localhost xx.xx.xx 0 :Dylan delain
21:01:27: handling nick for xx.xx.xx <-- From my server


Here is Unreal`s crash message:

=================== START HERE ======================
BACKTRACE:
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
Core was generated by `/Unreal3.2/src/ircd'.
Program terminated with signal 6, Aborted.

warning: Can't read pathname for load map: Input/output error.
#0 0xffffe410 in __kernel_vsyscall ()
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7da19a1 in raise () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7da32b9 in abort () from /lib/tls/i686/cmov/libc.so.6
#3 0x080877f5 in decode_ip (buf=0x8170abc "nLEJCJASs7coeLS/PCOyt3xkCgj8YwoIPA==") at support.c:1929
#4 0xb7d59fb2 in _register_user (cptr=0x8170980, sptr=0x8170ef0, nick=0x8170f19 "rave_", username=0x8170a7c "rave", umode=0x8170a9f "+inwx",
    virthost=0x8170aa5 "822A.7381.0AC6.3E46.IP", ip=0x8170abc "nLEJCJASs7coeLS/PCOyt3xkCgj8YwoIPA==") at m_nick.c:1143
#5 0xb7d5ae27 in m_user (cptr=0x8170980, sptr=0x8170ef0, parc=9, parv=0x811be0c) at m_user.c:214
#6 0xb7d587a7 in m_nick (cptr=0x8170980, sptr=0x8170ef0, parc=12, parv=0x811be00) at m_nick.c:756
#7 0x08066e84 in parse (cptr=0x8170980, buffer=0x8170a64 "NICK", bufend=0x8170aee "") at parse.c:440
0000008 0x08065e0d in dopacket (cptr=0x8170980,
    buffer=0x80ae0e0 ":irc.rosiello.net 501: rave :Unknown mode flag\r\n:irc.rosiello.net 421 rave :SETHOST :Unknown command\r\n:irc.rosiello.net2 421 irc.rosiello.net :SWHOIS :Unknown command\r\n:irc.rosiello.net 432 rave :Chan"..., length=128) at packet.c:138
#9 0x0805654a in read_message (delay=1, listp=0x8132760) at s_bsd.c:1477
#10 0x080623ad in main (argc=<value optimized out>, argv=0xbfe1cea4) at ircd.c:1564

#0 0xffffe410 in __kernel_vsyscall ()

0x8134560 <backupbuf>: "NICK rave_ 0 1148324429 rave 127.0.0.1 irc.rosiello.net2 0 +inwx 822A.7381.0AC6.3E46.IP nLEJCJASs7coeLS/PCOyt3xkCgj8YwoIPA== :Dylan delain"

#0 0xffffe410 in __kernel_vsyscall ()
No symbol table info available.
#1 0xb7da19a1 in raise () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
#2 0xb7da32b9 in abort () from /lib/tls/i686/cmov/libc.so.6
No symbol table info available.
GCC: gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
UNAME: Linux ubuntu 2.6.15-21-386 #1 PREEMPT Fri Apr 21 16:43:33 UTC 2006 i686 GNU/Linux
UNREAL: Unreal3.2.4 build 1.1.1.1.2.22 2006/02/05 18:03:15
CORE: -rw------- 1 root root 1179648 2006-05-22 21:01 core


Ps. This is the origional Unreal code not a line recoded.
Unreal was downloaded from www.unrealircd.com
3rd party modules

Activities

syzop

2006-05-22 14:47

administrator   ~0011754

Last edited: 2006-05-22 14:50

char *decode_ip(char *buf)
{
    int len = strlen(buf);
    char targ[25];

    b64_decode(buf, targ, 25);
    if (len == 24) /* IPv6 */
    {
        static char result[64];
        return inetntop(AF_INET6, targ, result, 64);
    }
    else if (len == 8) /* IPv4 */
        return inet_ntoa(*(struct in_addr *)targ);
    else /* Error?? */
        abort(); <===== crashes here
}

So, basically, you are sending an invalid nickip message.
Which is correct since the string "nLEJCJASs7coeLS/PCOyt3xkCgj8YwoIPA==" you send is 36 characters long... What is that.. IPv8? ;)

Don't know about your server not *receiving* NICKIP messages.. Find it hard to believe, maybe you could recheck your code that it really isn't receiving it? :P

Since you are on *NIX, you can also download/install 'ngrep' and then use something like: ngrep -d lo -W byline '' 'port 6667'
to sniff traffic...
eg: to check the PROTOCTL really is sent, and/or the nick messages really contain no nickip/nickv2.

rave

2006-05-22 15:18

reporter   ~0011755

Im possitive syzop, the server (my own) reads the PROTOCTL very wel as you can see.

int linking::protoctl (void)
{
 

 if (_srv ->cmd.argc < 1)
 {
   this->err = ERR_PARAMS;
   return this->err;
 }
 

 /*
 ** PROTCTL alias protocol controle
 ** Defines the times of command that the connection
 ** uses, there fore we need to extract those who
 ** The other server has send to keep the connection compatible. */
 for (int i = 1; i < _srv->cmd.argc; i++)
 {
  for (int j = 0; j < PROT_END; j++)
  {
    if ((_srv->cmd.argv[i].compare(prot[j].name)) == 0)
     flags |= prot[j].value;
  }
 }


 /* There done, we know knows how the server
 ** wants to be spoken to. This is very important
 ** in every step of a server to server protocol. */
 return ERR_NONE;
}

If protctl didnt contain NICKIP then my server would not send NICK ip a like NICK messages.

----- Unreal code ---
    else if (len == 8) /* IPv4 */
        return inet_ntoa(*(struct in_addr *)targ);
----------------------

So i see the length needs to be 8 or 24 i see,


Ok ngrep Dump:

Unreals PROTCTL + SERVER
PROTOCTL NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS SJB64 TKLEXT NICKIP CHANMODES=beIqa,kfL,lj,psmntirRcOAQKVCuzNSMTG NICKCHARS=.
SERVER xxx.xxx.xx 1 :U2307-FhiXOoE-1 rsn.

My PROTOCTL LINE:

SERVER irc.xxx.xxx 1 :U2303xxx-1 No description.
PROTCTL NOQUIT NICKv2 SJOIN2 UMODE2 VL SJ3 NICKIP .

Unreals NICKIP message

NICK rave 1 1148325050 rave localhost irc.rosiello.net 0 :Dylan delain.

syzop

2006-05-22 15:32

administrator   ~0011756

Last edited: 2006-05-22 15:32

You need to send the 'PROTOCTL' line before the 'SERVER' line.

EDIT: typo

rave

2006-05-22 15:45

reporter   ~0011757

Yes, noticed that, but when i send the password then protoctl and then server i recv this message from unreal.

MySERVER ->PASS :xxxx.

MYServer ->PROTCTL NOQUIT NICKv2 SJOIN2 UMODE2 VL SJ3 NICKIP .
MyServer ->SERVER xx.xx.xx 1 :U2303xxx-1 No description.

Unreal ->:irc.rosiello.net 451 PROTCTL :You have not registered.

this could be because of the fact that my VL flags are not proper and the protocol version in server is diffrent as the 2307 that unreal 2.3.4 uses.

IS this correct ? and why do i get the "you didnt register" messsage".

syzop

2006-05-22 15:47

administrator   ~0011758

I guess that explains my typo as well (indirect influence :P), you are sending PROTCTL, you must send PROTOCTL.. and also in the right sequence... that is, before SERVER.

rave

2006-05-22 15:55

reporter   ~0011759

Unreal Sends:
Server: NICK rave 1 1148331228 rave localhost xx.xx.xx 0 +owghaAxNt netadmin.xx.xx fwAAAQ== :Dylan delain

That did it your the best !!:) thanks..

syzop

2006-05-22 16:04

administrator   ~0011760

roger

Issue History

Date Modified Username Field Change
2006-05-22 14:22 rave New Issue
2006-05-22 14:47 syzop Note Added: 0011754
2006-05-22 14:50 syzop Note Edited: 0011754
2006-05-22 15:18 rave Note Added: 0011755
2006-05-22 15:32 syzop Note Added: 0011756
2006-05-22 15:32 syzop Note Edited: 0011756
2006-05-22 15:45 rave Note Added: 0011757
2006-05-22 15:47 syzop Note Added: 0011758
2006-05-22 15:55 rave Note Added: 0011759
2006-05-22 16:04 syzop Status new => closed
2006-05-22 16:04 syzop Note Added: 0011760
2006-05-22 16:04 syzop Resolution open => no change required