]> arthur.barton.de Git - ngircd-alex.git/commitdiff
- Server identifizieren sich nun mit asyncronen Passwoertern.
authorAlexander Barton <alex@barton.de>
Tue, 19 Nov 2002 12:50:20 +0000 (12:50 +0000)
committerAlexander Barton <alex@barton.de>
Tue, 19 Nov 2002 12:50:20 +0000 (12:50 +0000)
src/ngircd/conf.c
src/ngircd/conf.h
src/ngircd/conn.c
src/ngircd/irc-server.c

index 597ac065881d605d42fb559759120f9434eedfbf..ea5e3fd73bfbcb466369b45ba4ef954b01ca8c5c 100644 (file)
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conf.c,v 1.37 2002/11/18 18:47:42 alex Exp $
+ * $Id: conf.c,v 1.38 2002/11/19 12:50:20 alex Exp $
  *
  * conf.h: Konfiguration des ngircd
  */
@@ -138,7 +138,8 @@ Conf_Test( VOID )
                printf( "  Name = %s\n", Conf_Server[i].name );
                printf( "  Host = %s\n", Conf_Server[i].host );
                printf( "  Port = %d\n", Conf_Server[i].port );
-               printf( "  Password = %s\n", Conf_Server[i].pwd );
+               printf( "  MyPassword = %s\n", Conf_Server[i].pwd_in );
+               printf( "  PeerPassword = %s\n", Conf_Server[i].pwd_out );
                printf( "  Group = %d\n", Conf_Server[i].group );
                puts( "" );
        }
@@ -248,7 +249,8 @@ Read_Config( VOID )
                                        strcpy( Conf_Server[Conf_Server_Count].host, "" );
                                        strcpy( Conf_Server[Conf_Server_Count].ip, "" );
                                        strcpy( Conf_Server[Conf_Server_Count].name, "" );
-                                       strcpy( Conf_Server[Conf_Server_Count].pwd, "" );
+                                       strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
+                                       strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
                                        Conf_Server[Conf_Server_Count].port = 0;
                                        Conf_Server[Conf_Server_Count].group = -1;
                                        Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
@@ -492,11 +494,18 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
                Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
                return;
        }
-       if( strcasecmp( Var, "Password" ) == 0 )
+       if( strcasecmp( Var, "MyPassword" ) == 0 )
        {
-               /* Passwort des Servers */
-               strncpy( Conf_Server[Conf_Server_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
-               Conf_Server[Conf_Server_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
+               /* Passwort dieses Servers, welches empfangen werden muss */
+               strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
+               Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
+               return;
+       }
+       if( strcasecmp( Var, "PeerPassword" ) == 0 )
+       {
+               /* Passwort des anderen Servers, welches gesendet werden muss */
+               strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
+               Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
                return;
        }
        if( strcasecmp( Var, "Port" ) == 0 )
index f61dc2469961d6dc9d640980cf7d5d8beb4c4f32..c77a2ac83f2157431343b488ab4cd19b9750160b 100644 (file)
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conf.h,v 1.20 2002/11/02 22:58:41 alex Exp $
+ * $Id: conf.h,v 1.21 2002/11/19 12:50:20 alex Exp $
  *
  * conf.h: Konfiguration des ngircd (Header)
  */
@@ -34,7 +34,8 @@ typedef struct _Conf_Server
        CHAR host[HOST_LEN];            /* Hostname */
        CHAR ip[16];                    /* IP-Adresse (von Resolver) */
        CHAR name[CLIENT_ID_LEN];       /* IRC-Client-ID */
-       CHAR pwd[CLIENT_PASS_LEN];      /* Passwort */
+       CHAR pwd_in[CLIENT_PASS_LEN];   /* Passwort, welches erwartet wird */
+       CHAR pwd_out[CLIENT_PASS_LEN];  /* An die Gegenseite zu sendendes Passwort */
        INT port;                       /* Server-Port */
        INT group;                      /* Gruppe des Servers */
        time_t lasttry;                 /* Letzter Connect-Versuch */
index cbef7f3e6ccf438395b3d0e9a470e32bae815e54..bef5b149f9598d3951fbc4180974a667485139da 100644 (file)
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conn.c,v 1.89 2002/11/11 00:54:25 alex Exp $
+ * $Id: conn.c,v 1.90 2002/11/19 12:50:20 alex Exp $
  *
  * connect.h: Verwaltung aller Netz-Verbindungen ("connections")
  */
@@ -779,7 +779,7 @@ Handle_Write( CONN_ID Idx )
                Log( LOG_DEBUG, "Connection %d with \"%s:%d\" established, now sendig PASS and SERVER ...", Idx, My_Connections[Idx].host, Conf_Server[My_Connections[Idx].our_server].port );
 
                /* PASS und SERVER verschicken */
-               Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[My_Connections[Idx].our_server].pwd, NGIRCd_ProtoID );
+               Conn_WriteStr( Idx, "PASS %s %s", Conf_Server[My_Connections[Idx].our_server].pwd_out, NGIRCd_ProtoID );
                return Conn_WriteStr( Idx, "SERVER %s :%s", Conf_ServerName, Conf_ServerInfo );
        }
 
index 9de2de2b7290dab5e8792beb8b448ebef066b712..ec867ed84f28f06a7d3ce42adaf55cef4f54c2fa 100644 (file)
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: irc-server.c,v 1.19 2002/11/05 14:18:59 alex Exp $
+ * $Id: irc-server.c,v 1.20 2002/11/19 12:50:20 alex Exp $
  *
  * irc-server.c: IRC-Befehle fuer Server-Links
  */
@@ -71,10 +71,10 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
                        Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE );
                        return DISCONNECTED;
                }
-               if( strcmp( Client_Password( Client ), Conf_Server[i].pwd ) != 0 )
+               if( strcmp( Client_Password( Client ), Conf_Server[i].pwd_in ) != 0 )
                {
                        /* Falsches Passwort */
-                       Log( LOG_ERR, "Connection %d: Bad password for server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
+                       Log( LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
                        Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE );
                        return DISCONNECTED;
                }
@@ -93,7 +93,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
                {
                        /* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */
                        ok = TRUE;
-                       if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd, NGIRCd_ProtoID )) ok = FALSE;
+                       if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID )) ok = FALSE;
                        else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo );
                        if( ! ok )
                        {