Commit Diff


commit - 8700f4d93cb50ebe7639e7a32e93b94c36ed3fae
commit + 493ccd57f41bea8c9bca5311ca597b37fadc9e7f
blob - af79c13feddbbb208a2b887aafef7e73a5e4c95f
blob + 032a6e91e08b83f41bfd220ad8d527ddeb76f6c1
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
@@ -980,7 +980,7 @@ Conn_Close( CONN_ID Idx, const char *LogMsg, const cha
 		if (FwdMsg)
 			Conn_WriteStr(Idx, "ERROR :%s", FwdMsg);
 		else
-			Conn_WriteStr(Idx, "ERROR :Closing connection.");
+			Conn_WriteStr(Idx, "ERROR :Closing connection");
 	}
 
 	/* Try to write out the write buffer. Note: Handle_Write() eventually
@@ -1276,7 +1276,7 @@ New_Connection(int Sock)
 		    "Refused connection from %s: too may connections (%ld) from this IP address!",
 		    ip_str, cnt);
 		Simple_Message(new_sock,
-			       "ERROR :Connection refused, too many connections from your IP address!");
+			       "ERROR :Connection refused, too many connections from your IP address");
 		close(new_sock);
 		return -1;
 	}
blob - 479b300450e4dcfd4f601b703bc4a573fc3f8a77
blob + 7c56a03d3478be3fe0111580d294f99e73ae111c
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
@@ -178,7 +178,7 @@ Parse_Request( CONN_ID Idx, char *Request )
 		if( ! ptr )
 		{
 			LogDebug("Connection %d: Parse error: prefix without command!?", Idx);
-			return Conn_WriteStr( Idx, "ERROR :Prefix without command!?" );
+			return Conn_WriteStr(Idx, "ERROR :Prefix without command");
 		}
 		*ptr = '\0';
 #ifndef STRICT_RFC
@@ -278,8 +278,9 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Clos
 	assert( client != NULL );
 
 	/* only validate if this connection is already registered */
-	if(( Client_Type( client ) != CLIENT_USER ) && ( Client_Type( client ) != CLIENT_SERVER ) && ( Client_Type( client ) != CLIENT_SERVICE ))
-	{
+	if (Client_Type(client) != CLIENT_USER
+	    && Client_Type(client) != CLIENT_SERVER
+	    && Client_Type(client) != CLIENT_SERVICE) {
 		/* not registered, ignore prefix */
 		Req->prefix = NULL;
 		return true;
@@ -287,19 +288,25 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Clos
 
 	/* check if client in prefix is known */
 	c = Client_Search( Req->prefix );
-	if( ! c )
-	{
-		Log( LOG_ERR, "Invalid prefix \"%s\", client not known (connection %d, command %s)!?", Req->prefix, Idx, Req->command );
-		if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix \"%s\", client not known!?", Req->prefix )) *Closed = true;
+	if (!c) {
+		Log(LOG_ERR,
+		    "Invalid prefix \"%s\", client not known (connection %d, command \"%s\")!?",
+		    Req->prefix, Idx, Req->command);
+		if (!Conn_WriteStr(Idx,
+				   "ERROR :Invalid prefix \"%s\", client not known",
+				   Req->prefix))
+			*Closed = true;
 		return false;
 	}
 
 	/* check if the client named in the prefix is expected
 	 * to come from that direction */
-	if( Client_NextHop( c ) != client )
-	{
-		Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command %s)!", Req->prefix, Client_Mask( Conn_GetClient( Idx )), Idx, Req->command );
-		Conn_Close( Idx, NULL, "Spoofed prefix", true);
+	if (Client_NextHop(c) != client) {
+		Log(LOG_ERR,
+		    "Spoofed prefix \"%s\" from \"%s\" (connection %d, command \"%s\")!",
+		    Req->prefix, Client_Mask(Conn_GetClient(Idx)), Idx,
+		    Req->command);
+		Conn_Close(Idx, NULL, "Spoofed prefix", true);
 		*Closed = true;
 		return false;
 	}