1
0
mirror of https://github.com/osmarks/ngircd.git synced 2025-08-28 16:32:20 +00:00

cleanups [from HEAD]

This commit is contained in:
Florian Westphal 2006-12-02 13:54:10 +00:00
parent 254bf129dc
commit ab7bb74581

View File

@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-login.c,v 1.49 2005/09/01 10:51:24 alex Exp $"; static char UNUSED id[] = "$Id: irc-login.c,v 1.49.2.1 2006/12/02 13:54:10 fw Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -44,22 +44,28 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.49 2005/09/01 10:51:24 alex Exp
static bool Hello_User PARAMS(( CLIENT *Client )); static bool Hello_User PARAMS(( CLIENT *Client ));
static void Kill_Nick PARAMS(( char *Nick, char *Reason )); static void Kill_Nick PARAMS(( char *Nick, char *Reason ));
/**
* Handler for the IRC command "PASS".
* See RFC 2813 section 4.1.1, and RFC 2812 section 3.1.1.
*/
GLOBAL bool GLOBAL bool
IRC_PASS( CLIENT *Client, REQUEST *Req ) IRC_PASS( CLIENT *Client, REQUEST *Req )
{ {
assert( Client != NULL ); assert( Client != NULL );
assert( Req != NULL ); assert( Req != NULL );
/* Fehler liefern, wenn kein lokaler 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_Conn(Client) <= NONE)
return IRC_WriteStrClient(Client, ERR_UNKNOWNCOMMAND_MSG,
Client_ID(Client), Req->command);
if(( Client_Type( Client ) == CLIENT_UNKNOWN ) && ( Req->argc == 1)) if (Client_Type(Client) == CLIENT_UNKNOWN && Req->argc == 1) {
{ /* Not yet registered "unknown" connection, PASS with one
/* noch nicht registrierte unbekannte Verbindung */ * argument: either a regular client, service, or server
Log( LOG_DEBUG, "Connection %d: got PASS command ...", Client_Conn( Client )); * using the old RFC 1459 section 4.1.1 syntax. */
LogDebug("Connection %d: got PASS command ...",
Client_Conn(Client));
/* Passwort speichern */
Client_SetPassword( Client, Req->argv[0] ); Client_SetPassword( Client, Req->argv[0] );
Client_SetType( Client, CLIENT_GOTPASS ); Client_SetType( Client, CLIENT_GOTPASS );
@ -102,31 +108,32 @@ IRC_PASS( CLIENT *Client, REQUEST *Req )
/* Implementation, Version und ngIRCd-Flags */ /* Implementation, Version und ngIRCd-Flags */
impl = Req->argv[2]; impl = Req->argv[2];
ptr = strchr( impl, '|' ); ptr = strchr(impl, '|');
if( ptr ) *ptr = '\0'; if (ptr)
*ptr = '\0';
if( type && ( strcmp( type, PROTOIRCPLUS ) == 0 )) if (type && (strcmp( type, PROTOIRCPLUS ) == 0)) {
{ /* The peer seems to be a server which supports the
/* auf der anderen Seite laeuft ein Server, der * IRC+ protocol (see doc/Protocol.txt). */
* ebenfalls das IRC+-Protokoll versteht */
serverver = ptr + 1; serverver = ptr + 1;
flags = strchr( serverver, ':' ); flags = strchr(serverver, ':');
if( flags ) if (flags) {
{
*flags = '\0'; *flags = '\0';
flags++; flags++;
} } else
else flags = ""; flags = "";
Log( LOG_INFO, "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags ); Log(LOG_INFO,
} "Peer announces itself as %s-%s using protocol %d.%d/IRC+ (flags: \"%s\").", impl, serverver, protohigh, protolow, flags );
else } else {
{ /* The peer seems to be a server supporting the
/* auf der anderen Seite laeuft ein Server, der * "original" IRC protocol (RFC 2813). */
* nur das Originalprotokoll unterstuetzt */
serverver = ""; serverver = "";
if( strchr( ircflags, 'Z' )) flags = "Z"; if (strchr(ircflags, 'Z' ))
else flags = ""; flags = "Z";
Log( LOG_INFO, "Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags ); else
flags = "";
Log(LOG_INFO,
"Peer announces itself as \"%s\" using protocol %d.%d (flags: \"%s\").", impl, protohigh, protolow, flags );
} }
Client_SetType( Client, CLIENT_GOTPASSSERVER ); Client_SetType( Client, CLIENT_GOTPASSSERVER );
@ -598,7 +605,8 @@ Hello_User( CLIENT *Client )
if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return false; if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return false;
#endif #endif
/* Features */ /* Features supported by this server (005 numeric, ISUPPORT),
* see <http://www.irc.org/tech_docs/005.html> for details. */
if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1,
COMMAND_LEN - 23, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED; COMMAND_LEN - 23, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;