summary refs log tree commit diff
path: root/src/ngircd/irc-server.c
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2006-10-01 19:05:00 +0000
committerAlexander Barton <alex@barton.de>2006-10-01 19:05:00 +0000
commit27d947fb7d36de5cb843404ddcdd99862ecb457b (patch)
treedcc4eacfb5c550121d1e46ba2a9067e30cc0c6b1 /src/ngircd/irc-server.c
parentbed98979dc0865677c88c82d6074d3438e67b882 (diff)
downloadngircd-27d947fb7d36de5cb843404ddcdd99862ecb457b.tar.gz
ngircd-27d947fb7d36de5cb843404ddcdd99862ecb457b.zip
Allow PASS syntax defined in RFC 1459 for server links, too.
Removed client status CLIENT_GOTPASSSERVER.
Diffstat (limited to 'src/ngircd/irc-server.c')
-rw-r--r--src/ngircd/irc-server.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c
index 2c153064..b8681b9c 100644
--- a/src/ngircd/irc-server.c
+++ b/src/ngircd/irc-server.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp $";
+static char UNUSED id[] = "$Id: irc-server.c,v 1.40 2006/10/01 19:05:02 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -41,6 +41,10 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp
 #include "irc-server.h"
 
 
+/**
+ * Handler for the IRC command "SERVER".
+ * See RFC 2813 section 4.1.2.
+ */
 GLOBAL bool
 IRC_SERVER( CLIENT *Client, REQUEST *Req )
 {
@@ -55,13 +59,17 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
 	assert( Client != NULL );
 	assert( Req != NULL );
 
-	/* Fehler liefern, wenn kein lokaler Client */
-	if( Client_Conn( Client ) <= NONE ) return IRC_WriteStrClient( Client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( Client ), Req->command );
-
-	if( Client_Type( Client ) == CLIENT_GOTPASSSERVER )
-	{
-		/* Verbindung soll als Server-Server-Verbindung registriert werden */
-		Log( LOG_DEBUG, "Connection %d: got SERVER command (new server link) ...", Client_Conn( Client ));
+	/* Return an error if this is not a local client */
+	if (Client_Conn(Client) <= NONE)
+		return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
+					  Client_ID(Client), Req->command);
+
+	if (Client_Type(Client) == CLIENT_GOTPASS) {
+		/* We got a PASS command from the peer, and now a SERVER
+		 * command: the peer tries to register itself as a server. */
+		Log(LOG_DEBUG,
+		    "Connection %d: got SERVER command (new server link) ...",
+		    Client_Conn(Client));
 
 		/* Falsche Anzahl Parameter? */
 		if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );