diff options
| author | Gabor Adam Toth <tg@tgbit.net> | 2011-02-14 16:16:07 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2011-03-16 23:15:50 +0100 |
| commit | 52f59149adf4dbbb7c917225a7c66ac4aa053700 (patch) | |
| tree | ff89379dd4cbda41ed0b51e9bfe682e5adbef421 /src | |
| parent | 5417a72536954927371d597e9a4e0453e70620e3 (diff) | |
| download | ngircd-52f59149adf4dbbb7c917225a7c66ac4aa053700.tar.gz ngircd-52f59149adf4dbbb7c917225a7c66ac4aa053700.zip | |
ClientHost setting
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/client.c | 6 | ||||
| -rw-r--r-- | src/ngircd/conf.c | 9 | ||||
| -rw-r--r-- | src/ngircd/conf.h | 3 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 0bfe73d3..11decc86 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_ClientHost)) { + strlcpy( Client->host, Conf_ClientHost, sizeof( Client->host )); + } else { + strlcpy( Client->host, Hostname, sizeof( Client->host )); + } } /* Client_SetHostname */ diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 3ff5ddd8..622cb9f8 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -295,6 +295,7 @@ Conf_Test( void ) puts( "[GLOBAL]" ); printf(" Name = %s\n", Conf_ServerName); + printf(" ClientHost = %s\n", Conf_ClientHost); printf(" Info = %s\n", Conf_ServerInfo); #ifndef PAM printf(" Password = %s\n", Conf_ServerPwd); @@ -590,6 +591,7 @@ Set_Defaults(bool InitServers) int i; strcpy(Conf_ServerName, ""); + strcpy(Conf_ClientHost, ""); snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION); strcpy(Conf_ServerPwd, ""); @@ -970,6 +972,13 @@ Handle_GLOBAL( int Line, char *Var, char *Arg ) Config_Error_TooLong( Line, Var ); return; } + if( strcasecmp( Var, "ClientHost" ) == 0 ) { + /* Client hostname */ + len = strlcpy( Conf_ClientHost, Arg, sizeof( Conf_ClientHost )); + if (len >= sizeof( Conf_ClientHost )) + Config_Error_TooLong( Line, Var ); + 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..1747139d 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -97,6 +97,9 @@ struct Conf_Channel { /** Name (ID, "nick") of this server */ GLOBAL char Conf_ServerName[CLIENT_ID_LEN]; +/** Hostname of the clients */ +GLOBAL char Conf_ClientHost[CLIENT_ID_LEN]; + /** Server info text */ GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN]; |