[IRCServices] ircservices 5.1.11 RFC 1459 protocol module broken?

Alexander Barton alex at barton.de
Fri Nov 7 08:07:41 PST 2008


Hello!

I'm working on getting ngIRCd connected to the ircservices 5.1.11  
package, at the moment I'm using the RFC 1459 protocol module and  
enhanced ngIRCd to understand server and user registration according  
to this older RFC.

Thereby I encountered a problem: ircservices all the time answered  
with the following error message:

----------> cut here <----------
debug: Received: :a.irc.net PASS srvPWD 0210-IRC+ ngircd|dev:CHLZ PZ
debug: Received: :a.irc.net SERVER a.irc.net 1 :A Server Info Text
debug: Received: NICK test :1
debug: Received: :test USER ~alex localhost a.irc.net :Alex
debug: Received: :test MODE test :+w
debug: user: MODE +w for nonexistent nick test from test: test +w
----------> cut here <----------

"nonexistent nick test" ... hm!?

Digging through the source code of ircservices, I found the folowing  
code in modules/protocol/rfc1459.c, line 42 ff.:

----------> cut here <----------
static void m_user(char *source, int ac, char **av)
{
    char *new_av[7];
    if (ac != 5)
        return;
----------> cut here <----------

So this function checks if the USER command das 5(!) parameters. BUT:  
according to RFC 1459 the USER command only has 4 parameters, see  
section 4.1.3:

----------> cut here <----------
4.1.3 User message

      Command: USER
   Parameters: <username> <hostname> <servername> <realname>

[...]
----------> cut here <----------

So the above mentioned test in ircservices always silently failed.

Proposed patch:

----------> cut here <----------
--- rfc1459.c.ORIG	2008-08-13 21:28:33.000000000 +0200
+++ rfc1459.c	2008-08-13 21:27:51.000000000 +0200
@@ -43,8 +43,11 @@ static void m_user(char *source, int ac,
{
     char *new_av[7];

-    if (ac != 5)
+    if (ac != 4) {
+        module_log_debug(1, "USER message: wrong number of parameters"
+                         " (%d) for source `%s'", ac, source ?  
source : "?");
         return;
+    }
     new_av[0] = source;      /* Nickname */
     new_av[1] = (char *)"0"; /* # of hops (was in NICK command... we  
lose) */
     new_av[2] = (char *)"0"; /* Timestamp */
----------> cut here <----------

Can you tell me if I'm correct? Or do I overlook something?

And can you tell me which protocol module is the "most advanced" or  
"best"?

Thanks a lot!
Alex