mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-11-03 23:43:00 +00:00 
			
		
		
		
	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).
(cherry picked from commit 508ca3044d)
			
			
This commit is contained in:
		@@ -514,10 +514,20 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
 | 
				
			|||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!(client_type & cmd->type))
 | 
							if (!(client_type & cmd->type)) {
 | 
				
			||||||
			return IRC_WriteStrClient(client, ERR_NOTREGISTERED_MSG, Client_ID(client));
 | 
								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();
 | 
							Conn_ResetWCounter();
 | 
				
			||||||
		result = (cmd->function)(client, Req);
 | 
							result = (cmd->function)(client, Req);
 | 
				
			||||||
		cmd->bytes += Conn_WCounter();
 | 
							cmd->bytes += Conn_WCounter();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user