repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 44b7ff02fd34731c6ed0d552dbde5c9981d53127:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 44b7ff02fd34731c6ed0d552dbde5c9981d53127
Author: Alexander Barton 
Date:   Mon Nov 5 23:46:26 2012 +0100

    Don't cloak already cloaked hostname when using METADATA

    A client for which a METADATA command has been received from one of
    its peers got the client flag "M" set. So it's safe to assume that
    such a client gets "METADATA host" commands for its cloaked hostname
    and the server must not cloak the hostname on its own, even when the
    client mode "+x" is set.

diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 92262b5d8b00c0ae3248c3010032ee8ff13ac0e1..
index ..2f8d771cc2ff81253cf62925757d7645ce39d539 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -702,9 +702,16 @@ Client_HostnameCloaked(CLIENT *Client)

 	assert(Client != NULL);

+	/* Client isn't cloaked at all, return real hostname: */
 	if (!Client_HasMode(Client, 'x'))
 		return Client_Hostname(Client);

+	/* Client has received METADATA command, so it got the eventually
+	 * cloaked hostname set correctly and this server doesn't need
+	 * to cloak it on its own: */
+	if (strchr(Client_Flags(Client), 'M'))
+		return Client_Hostname(Client);
+
 	/* Do simple mapping to the server ID? */
 	if (!*Conf_CloakHostModeX)
 		return Client_ID(Client->introducer);

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