mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-13 02:10:27 +00:00
IRC_SERVER: Make sure that the client sent a prefix
The SERVER command is only valid with a prefix when received from other servers, so make sure that there is one and disconnect the peer if not (instead of crashing ...). This obsoletes PR #275. Thanks Hilko Bengen (hillu) for finding & reporting this as well for the patch & pull request! But I think this is the "more correct" fix.
This commit is contained in:
parent
430bb22376
commit
02cf31c0e2
@ -186,6 +186,15 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
|
|||||||
if (!Client_CheckID(Client, Req->argv[0]))
|
if (!Client_CheckID(Client, Req->argv[0]))
|
||||||
return DISCONNECTED;
|
return DISCONNECTED;
|
||||||
|
|
||||||
|
if (!Req->prefix) {
|
||||||
|
/* We definitely need a prefix here! */
|
||||||
|
Log(LOG_ALERT, "Got SERVER command without prefix! (on connection %d)",
|
||||||
|
Client_Conn(Client));
|
||||||
|
Conn_Close(Client_Conn(Client), NULL,
|
||||||
|
"SERVER command without prefix", true);
|
||||||
|
return DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
from = Client_Search( Req->prefix );
|
from = Client_Search( Req->prefix );
|
||||||
if (! from) {
|
if (! from) {
|
||||||
/* Uh, Server, that introduced the new server is unknown?! */
|
/* Uh, Server, that introduced the new server is unknown?! */
|
||||||
|
Loading…
Reference in New Issue
Block a user