From aa7db2c0e9e1112591cbdb3d346342d34ca21a6a Mon Sep 17 00:00:00 2001 From: Christoph Biedl Date: Sat, 9 Jun 2012 01:55:22 +0200 Subject: [PATCH 1/3] Introduce new configuration option "CloakModeHost" This closes bug #124. --- src/ngircd/client.c | 3 ++- src/ngircd/conf.c | 8 ++++++++ src/ngircd/conf.h | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 1b356848..9861a0db 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -825,7 +825,8 @@ Client_MaskCloaked(CLIENT *Client) return Client_Mask(Client); snprintf(Mask_Buffer, GETID_LEN, "%s!%s@%s", - Client->id, Client->user, Client_ID(Client->introducer)); + Client->id, Client->user, + *Conf_CloakModeHost ? Conf_CloakModeHost : Client_ID(Client->introducer)); return Mask_Buffer; } /* Client_MaskCloaked */ diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index f274eb82..2a259eb4 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -358,6 +358,7 @@ Conf_Test( void ) printf(" AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper)); printf(" ChrootDir = %s\n", Conf_Chroot); printf(" CloakHost = %s\n", Conf_CloakHost); + printf(" CloakModeHost = %s\n", Conf_CloakModeHost); printf(" CloakUserToNick = %s\n", yesno_to_str(Conf_CloakUserToNick)); #ifdef WANT_IPV6 printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6)); @@ -684,6 +685,7 @@ Set_Defaults(bool InitServers) #endif strlcpy(Conf_Chroot, CHROOT_DIR, sizeof(Conf_Chroot)); strcpy(Conf_CloakHost, ""); + strcpy(Conf_CloakModeHost, ""); Conf_CloakUserToNick = false; Conf_ConnectIPv4 = true; #ifdef WANT_IPV6 @@ -1477,6 +1479,12 @@ Handle_OPTIONS(int Line, char *Var, char *Arg) Config_Error_TooLong(Line, Var); return; } + if (strcasecmp(Var, "CloakModeHost") == 0) { + len = strlcpy(Conf_CloakModeHost, Arg, sizeof(Conf_CloakModeHost)); + if (len >= sizeof(Conf_CloakModeHost)) + Config_Error_TooLong(Line, Var); + return; + } if (strcasecmp(Var, "CloakUserToNick") == 0) { Conf_CloakUserToNick = Check_ArgIsTrue(Arg); return; diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index be19afc6..171a838a 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -166,6 +166,9 @@ GLOBAL bool Conf_AllowRemoteOper; /** Cloaked hostname of the clients */ GLOBAL char Conf_CloakHost[CLIENT_ID_LEN]; +/** Cloaked hostname for clients that did +x */ +GLOBAL char Conf_CloakModeHost[CLIENT_ID_LEN]; + /** Use nick name as user name? */ GLOBAL bool Conf_CloakUserToNick; From 7b6b492bdd259c25c4477e33392510872107ca6a Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 9 Jun 2012 01:57:17 +0200 Subject: [PATCH 2/3] Rename "CloakModeHost" option to "CloakHostModeX" --- src/ngircd/client.c | 3 ++- src/ngircd/conf.c | 10 +++++----- src/ngircd/conf.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 9861a0db..e203cdd0 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -826,7 +826,8 @@ Client_MaskCloaked(CLIENT *Client) snprintf(Mask_Buffer, GETID_LEN, "%s!%s@%s", Client->id, Client->user, - *Conf_CloakModeHost ? Conf_CloakModeHost : Client_ID(Client->introducer)); + *Conf_CloakHostModeX ? Conf_CloakHostModeX + : Client_ID(Client->introducer)); return Mask_Buffer; } /* Client_MaskCloaked */ diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 2a259eb4..5f7b24fc 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -358,7 +358,7 @@ Conf_Test( void ) printf(" AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper)); printf(" ChrootDir = %s\n", Conf_Chroot); printf(" CloakHost = %s\n", Conf_CloakHost); - printf(" CloakModeHost = %s\n", Conf_CloakModeHost); + printf(" CloakHostModeX = %s\n", Conf_CloakHostModeX); printf(" CloakUserToNick = %s\n", yesno_to_str(Conf_CloakUserToNick)); #ifdef WANT_IPV6 printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6)); @@ -685,7 +685,7 @@ Set_Defaults(bool InitServers) #endif strlcpy(Conf_Chroot, CHROOT_DIR, sizeof(Conf_Chroot)); strcpy(Conf_CloakHost, ""); - strcpy(Conf_CloakModeHost, ""); + strcpy(Conf_CloakHostModeX, ""); Conf_CloakUserToNick = false; Conf_ConnectIPv4 = true; #ifdef WANT_IPV6 @@ -1479,9 +1479,9 @@ Handle_OPTIONS(int Line, char *Var, char *Arg) Config_Error_TooLong(Line, Var); return; } - if (strcasecmp(Var, "CloakModeHost") == 0) { - len = strlcpy(Conf_CloakModeHost, Arg, sizeof(Conf_CloakModeHost)); - if (len >= sizeof(Conf_CloakModeHost)) + if (strcasecmp(Var, "CloakHostModeX") == 0) { + len = strlcpy(Conf_CloakHostModeX, Arg, sizeof(Conf_CloakHostModeX)); + if (len >= sizeof(Conf_CloakHostModeX)) Config_Error_TooLong(Line, Var); return; } diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index 171a838a..86f00fe4 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -167,7 +167,7 @@ GLOBAL bool Conf_AllowRemoteOper; GLOBAL char Conf_CloakHost[CLIENT_ID_LEN]; /** Cloaked hostname for clients that did +x */ -GLOBAL char Conf_CloakModeHost[CLIENT_ID_LEN]; +GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN]; /** Use nick name as user name? */ GLOBAL bool Conf_CloakUserToNick; From bf121ae95fa352d74ec710fda33c08148562a52c Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 9 Jun 2012 02:04:50 +0200 Subject: [PATCH 3/3] Describe "CloakHostModeX" in sample-ngircd.conf an ngircd.conf(5) --- doc/sample-ngircd.conf.tmpl | 8 +++++++- man/ngircd.conf.5.tmpl | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/sample-ngircd.conf.tmpl b/doc/sample-ngircd.conf.tmpl index f696dc6d..e8b2fb0d 100644 --- a/doc/sample-ngircd.conf.tmpl +++ b/doc/sample-ngircd.conf.tmpl @@ -127,7 +127,13 @@ # Set this hostname for every client instead of the real one. # Please note: don't use the percentage sign ("%"), it is reserved for # future extensions! - ;CloakHost = irc.example.net + ;CloakHost = cloaked.host + + # Use this hostname for hostname cloaking on clients that have the + # user mode "+x" set, instead of the name of the server. + # Please note: don't use the percentage sign ("%"), it is reserved for + # future extensions! + ;CloakHostModeX = cloaked.user # Set every clients' user name to their nick name ;CloakUserToNick = yes diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl index 85cf73ff..04732060 100644 --- a/man/ngircd.conf.5.tmpl +++ b/man/ngircd.conf.5.tmpl @@ -220,6 +220,17 @@ don't change. Don't use the percentage sign ("%"), it is reserved for future extensions! .RE .TP +\fBCloakHostModeX\fR (string) +Use this hostname for hostname cloaking on clients that have the user mode +"+x" set, instead of the name of the server. Default: empty, use the name +of the server. +.PP +.RS +.B Please note: +.br +Don't use the percentage sign ("%"), it is reserved for future extensions! +.RE +.TP \fBCloakUserToNick\fR (boolean) Set every clients' user name to their nick name and hide the one supplied by the IRC client. Default: no.