X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fparse.c;h=8f5e6019694a53807d023b4df9010c281ad10d0b;hp=8203dd0ecb2687617af5f911db820733d239d35d;hb=162433398e320c45f3c8a523814518aa6b78372e;hpb=b19f7d73cb3759630072d28d1db5219dc656348b;ds=sidebyside diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index 8203dd0e..8f5e6019 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -82,7 +82,7 @@ static COMMAND My_Commands[] = { "PART", IRC_PART, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "PASS", IRC_PASS, 0xFFFF, 0, 0, 0 }, { "PING", IRC_PING, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, - { "PONG", IRC_PONG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, + { "PONG", IRC_PONG, 0xFFFF, 0, 0, 0 }, { "PRIVMSG", IRC_PRIVMSG, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 }, { "QUIT", IRC_QUIT, 0xFFFF, 0, 0, 0 }, { "REHASH", IRC_REHASH, CLIENT_USER, 0, 0, 0 }, @@ -276,11 +276,24 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed ) *Closed = false; - if( ! Req->prefix ) return true; - client = Conn_GetClient( Idx ); assert( client != NULL ); + if (!Req->prefix && Client_Type(client) == CLIENT_SERVER + && strcasecmp(Req->command, "ERROR") != 0 + && strcasecmp(Req->command, "PING") != 0) + { + Log(LOG_ERR, + "Received command without prefix (connection %d, command \"%s\")!?", + Idx, Req->command); + if (!Conn_WriteStr(Idx, "ERROR :Prefix missing")) + *Closed = true; + return false; + } + + if (!Req->prefix) + return true; + /* only validate if this connection is already registered */ if (Client_Type(client) != CLIENT_USER && Client_Type(client) != CLIENT_SERVER