summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2013-01-22 10:54:06 +0100
committerAlexander Barton <alex@barton.de>2013-01-22 10:54:06 +0100
commit508ca3044dd6d1a88686efceda92a7f2a9b4a926 (patch)
tree1fe47a1a4c0ac7dc5023e70abb30a36032dce571 /src
parentd8f2964710985597281de73aecd0a1ece30ecb03 (diff)
downloadngircd-508ca3044dd6d1a88686efceda92a7f2a9b4a926.tar.gz
ngircd-508ca3044dd6d1a88686efceda92a7f2a9b4a926.zip
Return better "Connection not registered as server link" errors
Now ngIRCd returns a more specific error message for numeric
ERR_NOTREGISTERED(451) when a regular user tries to use a command that
isn't allowed for users but for servers: ERR_NOTREGISTEREDSERVER(451).
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/parse.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c
index 5ff9fcc2..46164ce1 100644
--- a/src/ngircd/parse.c
+++ b/src/ngircd/parse.c
@@ -514,10 +514,20 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
 			continue;
 		}
 
-		if (!(client_type & cmd->type))
-			return IRC_WriteStrClient(client, ERR_NOTREGISTERED_MSG, Client_ID(client));
+		if (!(client_type & cmd->type)) {
+			if (client_type == CLIENT_USER
+			    && cmd->type & CLIENT_SERVER)
+				return IRC_WriteStrClient(client,
+						 ERR_NOTREGISTEREDSERVER_MSG,
+						 Client_ID(client));
+			else
+				return IRC_WriteStrClient(client,
+						ERR_NOTREGISTERED_MSG,
+						Client_ID(client));
+		}
 
-		/* Command is allowed for this client: call it and count produced bytes */
+		/* Command is allowed for this client: call it and count
+		 * generated bytes in output */
 		Conn_ResetWCounter();
 		result = (cmd->function)(client, Req);
 		cmd->bytes += Conn_WCounter();