X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fparse.c;h=1857e726b308fdbcd4416148b3daa80850049098;hp=ac24dbf985f2c5b5f215e321099ceca158e66d01;hb=2152e377226509a6b3c5f6cd9c8c4a88a9487091;hpb=17f7c6d3edf26e644b98e2b11fd3b1959ac8c0e6 diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index ac24dbf9..1857e726 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $"; +static char UNUSED id[] = "$Id: parse.c,v 1.59 2003/01/15 13:49:20 alex Exp $"; #include "imp.h" #include @@ -24,7 +24,7 @@ static char UNUSED id[] = "$Id: parse.c,v 1.52 2002/12/18 13:53:20 alex Exp $"; #include "ngircd.h" #include "defines.h" -#include "conn.h" +#include "conn-func.h" #include "client.h" #include "channel.h" #include "log.h" @@ -54,7 +54,9 @@ COMMAND My_Commands[] = { "AWAY", IRC_AWAY, CLIENT_USER, 0, 0, 0 }, { "CONNECT", IRC_CONNECT, CLIENT_USER, 0, 0, 0 }, { "DIE", IRC_DIE, CLIENT_USER, 0, 0, 0 }, + { "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 }, { "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 }, + { "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 }, { "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 }, { "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -83,6 +85,7 @@ COMMAND My_Commands[] = { "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, + { "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "USER", IRC_USER, 0xFFFF, 0, 0, 0 }, { "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 }, { "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, @@ -163,7 +166,7 @@ Parse_Request( CONN_ID Idx, CHAR *Request ) *ptr = '\0'; #ifndef STRICT_RFC /* multiple Leerzeichen als Trenner vor - *Parametertrennern ignorieren */ + * Parametern ignorieren */ while( *(ptr + 1) == ' ' ) ptr++; #endif } @@ -326,46 +329,50 @@ Handle_Request( CONN_ID Idx, REQUEST *Req ) client = Client_GetFromConn( Idx ); assert( client != NULL ); - /* Statuscode, der geforwarded werden muss? */ - if(( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 )) + /* Statuscode? */ + if(( Client_Type( client ) == CLIENT_SERVER ) && ( strlen( Req->command ) == 3 ) && ( atoi( Req->command ) > 100 )) { - /* Befehl ist ein Statuscode */ + /* Command is a status code from an other server */ - /* Zielserver ermitteln */ - if(( Client_Type( client ) == CLIENT_SERVER ) && ( Req->argc > 0 )) target = Client_Search( Req->argv[0] ); + /* Determine target */ + if( Req->argc > 0 ) target = Client_Search( Req->argv[0] ); else target = NULL; if( ! target ) { + /* Status code without target!? */ if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0] ); else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command ); return TRUE; } if( target == Client_ThisServer( )) { + /* This server is the target, ignore it */ Log( LOG_DEBUG, "Ignored status code %s from \"%s\".", Req->command, Client_ID( client )); return TRUE; } - /* Quell-Client ermitteln */ + /* Determine source */ if( ! Req->prefix[0] ) { - Log( LOG_WARNING, "Got status code without prefix!?" ); + /* Oops, no prefix!? */ + Log( LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", Req->command, Client_ID( client )); return TRUE; } else prefix = Client_Search( Req->prefix ); if( ! prefix ) { - Log( LOG_WARNING, "Got status code from unknown source: \"%s\"", Req->prefix ); + /* Oops, unknown prefix!? */ + Log( LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix ); return TRUE; } - /* Statuscode weiterleiten */ - strcpy( str, Req->command ); + /* Forward status code */ + strlcpy( str, Req->command, sizeof( str )); for( i = 0; i < Req->argc; i++ ) { - if( i < Req->argc - 1 ) strcat( str, " " ); - else strcat( str, " :" ); - strcat( str, Req->argv[i] ); + if( i < Req->argc - 1 ) strlcat( str, " ", sizeof( str )); + else strlcat( str, " :", sizeof( str )); + strlcat( str, Req->argv[i], sizeof( str )); } return IRC_WriteStrClientPrefix( target, prefix, "%s", str ); }