X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=4900d7b803361737de363240867cfec6e001c0df;hp=09f726ca2bf91016d54a8d2b2c7c10029943fa68;hb=0d5de60584f094ef3b7c27806d6cd7f79e861d7b;hpb=e7e47e77a3886c258368a14a8c0bb393280aac64 diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 09f726ca..4900d7b8 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -918,6 +918,20 @@ va_dcl return ok; } /* Conn_WriteStr */ +GLOBAL const char* +Conn_Password( CONN_ID Idx ) +{ + assert( Idx > NONE ); + return My_Connections[Idx].pwd; +} /* Conn_Password */ + +GLOBAL void +Conn_SetPassword( CONN_ID Idx, const char *Pwd ) +{ + assert( Idx > NONE ); + strlcpy( My_Connections[Idx].pwd, Pwd, + sizeof(My_Connections[Idx].pwd) ); +} /* Conn_SetPassword */ /** * Append Data to the outbound write buffer of a connection. @@ -1935,6 +1949,14 @@ New_Server( int Server , ng_ipaddr_t *dest) assert( Server > NONE ); + /* Make sure that the remote server hasn't re-linked to this server + * asynchronously on its own */ + if (Conf_Server[Server].conn_id > NONE) { + Log(LOG_INFO, + "Connection to \"%s\" meanwhile re-established, aborting preparation."); + return; + } + if (!ng_ipaddr_tostr_r(dest, ip_str)) { Log(LOG_WARNING, "New_Server: Could not convert IP to string"); return; @@ -2008,7 +2030,7 @@ New_Server( int Server , ng_ipaddr_t *dest) Client_SetToken( c, TOKEN_OUTBOUND ); /* Register connection */ - Conf_Server[Server].conn_id = new_sock; + Conf_SetServer(Server, new_sock); My_Connections[new_sock].sock = new_sock; My_Connections[new_sock].addr = *dest; My_Connections[new_sock].client = c;