Module: ngircd.git
Branch: master
Commit: 33fae67579eeab31d7f96f9e53f0529f584b0b1f
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=33fae675…
Author: Alexander Barton <alex(a)barton.de>
Date: Tue Aug 28 23:26:43 2012 +0200
Always cloak client hostname, if needed
Not only cloak the hostname in Client_MaskCloaked(), but also in
Client_HostnameCloaked() -- so move the actual cloaking to this function
and call it in Client_MaskCloaked() to get the (cloaked) hostname.
This fixes USERHOST not displaying the correctly cloaked hostname,
for example.
---
src/ngircd/client.c | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 0d2d414..4728c7a 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -687,18 +687,35 @@ Client_Hostname(CLIENT *Client)
/**
* Get potentially cloaked hostname of a client.
+ *
* If the client has not enabled cloaking, the real hostname is used.
+ * Please note that this function uses a global static buffer, so you can't
+ * nest invocations without overwriting earlier results!
+ *
* @param Client Pointer to client structure
* @return Pointer to client hostname
*/
GLOBAL char *
Client_HostnameCloaked(CLIENT *Client)
{
+ static char Cloak_Buffer[CLIENT_HOST_LEN];
+
assert(Client != NULL);
- if (Client_HasMode(Client, 'x'))
- return Client_ID(Client->introducer);
- else
+
+ if (!Client_HasMode(Client, 'x'))
return Client_Hostname(Client);
+
+ /* Do simple mapping to the server ID? */
+ if (!*Conf_CloakHostModeX)
+ return Client_ID(Client->introducer);
+
+ strlcpy(Cloak_Buffer, Client->host, CLIENT_HOST_LEN);
+ strlcat(Cloak_Buffer, Conf_CloakHostSalt, CLIENT_HOST_LEN);
+
+ snprintf(Cloak_Buffer, CLIENT_HOST_LEN, Conf_CloakHostModeX,
+ Hash(Cloak_Buffer));
+
+ return Cloak_Buffer;
} /* Client_HostnameCloaked */
@@ -792,10 +809,12 @@ Client_Mask( CLIENT *Client )
/**
* Return ID of a client with cloaked hostname: "client!user@server-name"
+ *
* This client ID is used for IRC prefixes, for example.
* Please note that this function uses a global static buffer, so you can't
* nest invocations without overwriting earlier results!
* If the client has not enabled cloaking, the real hostname is used.
+ *
* @param Client Pointer to client structure
* @return Pointer to global buffer containing the client ID
*/
@@ -803,7 +822,6 @@ GLOBAL char *
Client_MaskCloaked(CLIENT *Client)
{
static char Mask_Buffer[GETID_LEN];
- char Cloak_Buffer[GETID_LEN];
assert (Client != NULL);
@@ -811,16 +829,8 @@ Client_MaskCloaked(CLIENT *Client)
if (!Client_HasMode(Client, 'x'))
return Client_Mask(Client);
- if(*Conf_CloakHostModeX) {
- strlcpy(Cloak_Buffer, Client->host, GETID_LEN);
- strlcat(Cloak_Buffer, Conf_CloakHostSalt, GETID_LEN);
- snprintf(Cloak_Buffer, GETID_LEN, Conf_CloakHostModeX, Hash(Cloak_Buffer));
- } else {
- strncpy(Cloak_Buffer, Client_ID(Client->introducer), GETID_LEN);
- }
-
- snprintf(Mask_Buffer, GETID_LEN, "%s!%s@%s",
- Client->id, Client->user, Cloak_Buffer);
+ snprintf(Mask_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user,
+ Client_HostnameCloaked(Client));
return Mask_Buffer;
} /* Client_MaskCloaked */
Module: ngircd.git
Branch: master
Commit: 1d3def0cc6271ff77b39deec07eee240e1968d52
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=1d3def0c…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Aug 27 23:27:30 2012 +0200
Merge branch 'umode-B'
This patch series allows ngIRCd to support the user mode "B" ("Bot flasg"):
it is settable and unsettable by every (non-restricted) client.
According to DNS777, this is how Unreal and InspIRCd do behave, so do we :-)
By Alexander Barton (1) and DNS777 (1)
* umode-B:
Add new user mode "B" to doc/Modes.txt
Implement an Unreal-like user mode "B" ("Bot mode")
---
Module: ngircd.git
Branch: master
Commit: a26e37b7463d21e12be69b0bbdfdd74c8737dc36
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=a26e37b7…
Author: Alexander Barton <alex(a)barton.de>
Date: Sun Aug 26 16:03:00 2012 +0200
Add new user mode "B" to doc/Modes.txt
---
doc/Modes.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/Modes.txt b/doc/Modes.txt
index e47e270..99d731a 100644
--- a/doc/Modes.txt
+++ b/doc/Modes.txt
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2011 Alexander Barton and Contributors.
+ (c)2001-2012 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
@@ -22,6 +22,7 @@ channels he is using at the moment.
mode since description
a 0.3.0 User is away.
+ B 20 User is flagged as a "bot".
c 17 IRC operator wants to receive connect/disconnect NOTICEs.
C 19 Only users that share a channel are allowed to send messages.
i 0.0.1 User is "invisible".
Module: ngircd.git
Branch: master
Commit: e01e8f1cb6812ac24821fa540fd6ce4e61ccbc12
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=e01e8f1c…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Aug 27 23:21:28 2012 +0200
Merge branch 'recognize-umode-R'
By Alexander Barton (1) and DNS777 (1)
* recognize-umode-R:
Only allow IRC services to modify user mode "R"
Recognize user mode "R"
---