repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 147e424d98091a3627091edbfdab9fca52f21938:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 147e424d98091a3627091edbfdab9fca52f21938
Author: JRMU 
Date:   Wed Sep 4 06:48:54 2019 +0200

    Fix hostmask cloaking bug, don't cloak multiple times

    Previously, each server would cloak every user's hostmask. The problem
    is that if a network has more than one server, then a user's hostmask
    would get cloaked twice. This patch ensures that a server only cloaks
    the hostmask if it has not yet been cloaked (the period indicates it's
    still an IP address).

    Closes #228.

diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 7e6ff68afd4b8cf84e68d116f2ebe3bcd64d0fc3..
index ..a453312c3e93473a8a0ee7c2c8cf1c4a5b652660 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -337,7 +337,9 @@ Client_SetHostname( CLIENT *Client, const char *Hostname )
 	assert(Client != NULL);
 	assert(Hostname != NULL);

-	if (Conf_CloakHost[0]) {
+	/* Only cloak the hostmask if it has not yet been cloaked (the period
+	 * indicates it's still an IP address). */
+	if (Conf_CloakHost[0] && strchr(Client->host, '.')) {
 		char cloak[GETID_LEN];

 		strlcpy(cloak, Hostname, GETID_LEN);

-----END OF PAGE-----