diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/client.c | 11 | ||||
| -rw-r--r-- | src/ngircd/conf.c | 19 | ||||
| -rw-r--r-- | src/ngircd/conf.h | 8 | ||||
| -rw-r--r-- | src/ngircd/irc-login.c | 23 | ||||
| -rw-r--r-- | src/ngircd/irc-login.h | 1 | ||||
| -rw-r--r-- | src/ngircd/parse.c | 4 |
6 files changed, 63 insertions, 3 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 0bfe73d3..e01c4240 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -319,7 +319,11 @@ Client_SetHostname( CLIENT *Client, const char *Hostname ) assert( Client != NULL ); assert( Hostname != NULL ); - strlcpy( Client->host, Hostname, sizeof( Client->host )); + if (strlen(Conf_CloakHost)) { + strlcpy( Client->host, Conf_CloakHost, sizeof( Client->host )); + } else { + strlcpy( Client->host, Hostname, sizeof( Client->host )); + } } /* Client_SetHostname */ @@ -331,6 +335,9 @@ Client_SetID( CLIENT *Client, const char *ID ) strlcpy( Client->id, ID, sizeof( Client->id )); + if (Conf_CloakUserToNick) + strlcpy( Client->user, ID, sizeof( Client->user )); + /* Hash */ Client->hash = Hash( Client->id ); } /* Client_SetID */ @@ -344,6 +351,8 @@ Client_SetUser( CLIENT *Client, const char *User, bool Idented ) assert( Client != NULL ); assert( User != NULL ); + if (Conf_CloakUserToNick) return; + if (Idented) { strlcpy(Client->user, User, sizeof(Client->user)); } else { diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 3ff5ddd8..fb8db2c4 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -351,7 +351,9 @@ Conf_Test( void ) printf(" MaxConnections = %ld\n", Conf_MaxConnections); printf(" MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP); printf(" MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1); - printf(" MaxNickLength = %u\n\n", Conf_MaxNickLength - 1); + printf(" MaxNickLength = %u\n", Conf_MaxNickLength - 1); + printf(" CloakHost = %s\n", Conf_CloakHost); + printf(" CloakUserToNick = %s\n\n", yesno_to_str(Conf_CloakUserToNick)); puts("[FEATURES]"); printf(" DNS = %s\n", yesno_to_str(Conf_DNS)); @@ -629,6 +631,9 @@ Set_Defaults(bool InitServers) Conf_MaxJoins = 10; Conf_MaxNickLength = CLIENT_NICK_LEN_DEFAULT; + strcpy(Conf_CloakHost, ""); + Conf_CloakUserToNick = false; + #ifdef SYSLOG #ifdef LOG_LOCAL5 Conf_SyslogFacility = LOG_LOCAL5; @@ -970,6 +975,18 @@ Handle_GLOBAL( int Line, char *Var, char *Arg ) Config_Error_TooLong( Line, Var ); return; } + if( strcasecmp( Var, "CloakHost" ) == 0 ) { + /* Client hostname */ + len = strlcpy( Conf_CloakHost, Arg, sizeof( Conf_CloakHost )); + if (len >= sizeof( Conf_CloakHost )) + Config_Error_TooLong( Line, Var ); + return; + } + if( strcasecmp( Var, "CloakUserToNick" ) == 0 ) { + /* Use client nick name as user name */ + Conf_CloakUserToNick = Check_ArgIsTrue( Arg ); + return; + } if( strcasecmp( Var, "Info" ) == 0 ) { /* Info text of server */ len = strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo )); diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index 8c6aea86..305ccaa1 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2010 Alexander Barton (alex@barton.de) + * Copyright (c)2001-2011 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 @@ -163,6 +163,12 @@ GLOBAL bool Conf_OperServerMode; /** Flag indicating if remote IRC operators are allowed to manage this server */ GLOBAL bool Conf_AllowRemoteOper; +/** Cloaked hostname of the clients */ +GLOBAL char Conf_CloakHost[CLIENT_ID_LEN]; + +/** Use nick name as user name? */ +GLOBAL bool Conf_CloakUserToNick; + /** Enable all DNS functions? */ GLOBAL bool Conf_DNS; diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c index f76a6270..92d54ab1 100644 --- a/src/ngircd/irc-login.c +++ b/src/ngircd/irc-login.c @@ -683,6 +683,29 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req ) } /* IRC_QUIT */ +#ifndef STRICT_RFC + +/** + * Handler for HTTP command, e.g. GET and POST + * + * We handle these commands here to avoid the quite long timeout when + * some user tries to access this IRC daemon using an web browser ... + * + * @param Client The client from which this command has been received. + * @param Req Request structure with prefix and all parameters. + * @returns CONNECTED or DISCONNECTED. + */ +GLOBAL bool +IRC_QUIT_HTTP( CLIENT *Client, REQUEST *Req ) +{ + Req->argc = 1; + Req->argv[0] = "Oops, HTTP request received? This is IRC!"; + return IRC_QUIT(Client, Req); +} /* IRC_QUIT_HTTP */ + +#endif + + /** * Handler for the IRC "PING" command. * diff --git a/src/ngircd/irc-login.h b/src/ngircd/irc-login.h index 7ba53571..f3138f6e 100644 --- a/src/ngircd/irc-login.h +++ b/src/ngircd/irc-login.h @@ -25,6 +25,7 @@ GLOBAL bool IRC_WEBIRC PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_PING PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req)); GLOBAL bool IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req)); +GLOBAL bool IRC_QUIT_HTTP PARAMS((CLIENT *Client, REQUEST *Req)); #endif diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c index 7c56a03d..8203dd0e 100644 --- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -109,6 +109,10 @@ static COMMAND My_Commands[] = #ifdef IRCPLUS { "CHANINFO", IRC_CHANINFO, CLIENT_SERVER, 0, 0, 0 }, #endif +#ifndef STRICT_RFC + { "GET", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 }, + { "POST", IRC_QUIT_HTTP, CLIENT_UNKNOWN, 0, 0, 0 }, +#endif { NULL, NULL, 0x0, 0, 0, 0 } /* Ende-Marke */ }; |