diff options
| author | Alexander Barton <alex@barton.de> | 2012-01-25 17:11:00 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-01-25 17:11:00 +0100 |
| commit | 48889844299e036515e567aa5f992df18ccdf2d7 (patch) | |
| tree | 6bc5e424179bdeb7c40cb5d2f8727ea8394610c3 /src | |
| parent | 44bb22d23ec6841457db41732caa6f5f9129b615 (diff) | |
| download | ngircd-48889844299e036515e567aa5f992df18ccdf2d7.tar.gz ngircd-48889844299e036515e567aa5f992df18ccdf2d7.zip | |
Client_SetHostname(): Code cleanup, more debug logging
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/client.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 1aaf687c..078449c0 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -313,16 +313,29 @@ Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool Sen } /* Client_Destroy */ +/** + * Set client hostname. + * + * If global hostname cloaking is in effect, don't set the real hostname + * but the configured one. + * + * @param Client The client of which the hostname should be set. + * @param Hostname The new hostname. + */ GLOBAL void Client_SetHostname( CLIENT *Client, const char *Hostname ) { - assert( Client != NULL ); - assert( Hostname != NULL ); + assert(Client != NULL); + assert(Hostname != NULL); if (strlen(Conf_CloakHost)) { - strlcpy( Client->host, Conf_CloakHost, sizeof( Client->host )); + LogDebug("Updating hostname of \"%s\": \"%s\" -> \"%s\"", + Client_ID(Client), Client->host, Conf_CloakHost); + strlcpy(Client->host, Conf_CloakHost, sizeof(Client->host)); } else { - strlcpy( Client->host, Hostname, sizeof( Client->host )); + LogDebug("Updating hostname of \"%s\": \"%s\" -> \"%s\"", + Client_ID(Client), Client->host, Hostname); + strlcpy(Client->host, Hostname, sizeof(Client->host)); } } /* Client_SetHostname */ |