summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2016-12-08 01:01:40 +0100
committerAlexander Barton <alex@barton.de>2016-12-08 01:01:40 +0100
commit77861f6fe24a7a6be85c6f8112f08172ad7ffa67 (patch)
tree8e66db862866d79711ebd37a31756ffeccbf92f5 /src
parente9e3df27b70b7d3c7de2f0208431c8b8803a4da9 (diff)
downloadngircd-77861f6fe24a7a6be85c6f8112f08172ad7ffa67.tar.gz
ngircd-77861f6fe24a7a6be85c6f8112f08172ad7ffa67.zip
Immediately shut down connection on receiving ERROR
Don't wait for the peer to close the connection. This allows us to
forward the ERROR mesage in the network, instead of the very generic
"client closed connection" message.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index 72caf7d5..d5e4bde3 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -85,6 +85,8 @@ IRC_CheckListTooBig(CLIENT *From, const int Count, const int Limit,
 GLOBAL bool
 IRC_ERROR(CLIENT *Client, REQUEST *Req)
 {
+	char *msg;
+
 	assert( Client != NULL );
 	assert( Req != NULL );
 
@@ -99,12 +101,20 @@ IRC_ERROR(CLIENT *Client, REQUEST *Req)
 		return CONNECTED;
 	}
 
-	if (Req->argc < 1)
+	if (Req->argc < 1) {
+		msg = "Got ERROR command";
 		Log(LOG_NOTICE, "Got ERROR from \"%s\"!",
 		    Client_Mask(Client));
-	else
+	} else {
+		msg = Req->argv[0];
 		Log(LOG_NOTICE, "Got ERROR from \"%s\": \"%s\"!",
-		    Client_Mask(Client), Req->argv[0]);
+		    Client_Mask(Client), msg);
+	}
+
+	if (Client_Conn(Client) != NONE) {
+		Client_Destroy(Client, NULL, msg, false);
+		return DISCONNECTED;
+	}
 
 	return CONNECTED;
 } /* IRC_ERROR */