summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/client.h2
-rw-r--r--include/numeric.h1
-rw-r--r--include/s_user.h2
-rw-r--r--modules/m_svsmode.c4
-rw-r--r--src/numeric.c2
-rw-r--r--src/s_user.c27
6 files changed, 28 insertions, 10 deletions
diff --git a/include/client.h b/include/client.h
index d6734e4..c85de6e 100644
--- a/include/client.h
+++ b/include/client.h
@@ -159,6 +159,7 @@
#define UMODE_OPER 0x00400000 /**< Operator */
#define UMODE_ADMIN 0x00800000 /**< Admin on server */
#define UMODE_FARCONNECT 0x01000000 /**< Can see remote client connects/exits */
+#define UMODE_HIDDENHOST 0x02000000 /**< User's host is hidden */
#define UMODE_ALL UMODE_SERVNOTICE
@@ -257,6 +258,7 @@
#define SetExemptResv(x) ((x)->flags |= FLAGS_EXEMPTRESV)
#define SetIPSpoof(x) ((x)->flags |= FLAGS_IP_SPOOFING)
#define IsIPSpoof(x) ((x)->flags & FLAGS_IP_SPOOFING)
+#define DelIPSpoof(x) ((x)->flags &= ~FLAGS_IP_SPOOFING)
#define IsFloodDone(x) ((x)->flags & FLAGS_FLOODDONE)
#define SetFloodDone(x) ((x)->flags |= FLAGS_FLOODDONE)
diff --git a/include/numeric.h b/include/numeric.h
index 87296dd..0f9bca6 100644
--- a/include/numeric.h
+++ b/include/numeric.h
@@ -108,6 +108,7 @@ extern const char *form_str(unsigned int);
#define RPL_GLOBALUSERS 266
#define RPL_ACCEPTLIST 281
#define RPL_ENDOFACCEPT 282
+#define RPL_NEWHOSTIS 285
/* numeric_replies */
#define RPL_AWAY 301
diff --git a/include/s_user.h b/include/s_user.h
index b6f7a2f..77e5949 100644
--- a/include/s_user.h
+++ b/include/s_user.h
@@ -55,6 +55,6 @@ extern void add_isupport(const char *, const char *, int);
extern void delete_isupport(const char *);
extern void init_isupport(void);
extern void rebuild_isupport_message_line(void);
-extern void user_set_hostmask(struct Client *, const char *);
+extern void user_set_hostmask(struct Client *, const char *, const int);
#endif
diff --git a/modules/m_svsmode.c b/modules/m_svsmode.c
index a045aa1..d54f664 100644
--- a/modules/m_svsmode.c
+++ b/modules/m_svsmode.c
@@ -106,8 +106,8 @@ ms_svsmode(struct Client *client_p, struct Client *source_p,
break;
case 'x':
- if (what == MODE_ADD && extarg)
- user_set_hostmask(target_p, extarg);
+ if (!EmptyString(extarg) && valid_hostname(extarg))
+ user_set_hostmask(target_p, extarg, what);
break;
case 'o':
diff --git a/src/numeric.c b/src/numeric.c
index 5f15738..0d4058f 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -312,7 +312,7 @@ static const char *replies[] = {
/* 282 RPL_ENDOFACCEPT */ ":%s 282 %s :End of /ACCEPT list.",
/* 283 */ NULL,
/* 284 */ NULL,
-/* 285 */ NULL,
+/* 285 RPL_NEWHOSTIS */ ":%s 285 %s :Your new host is - [%s@%s]",
/* 286 */ NULL,
/* 287 */ NULL,
/* 288 */ NULL,
diff --git a/src/s_user.c b/src/s_user.c
index 1d5120d..709e0d9 100644
--- a/src/s_user.c
+++ b/src/s_user.c
@@ -135,7 +135,7 @@ const unsigned int user_modes[256] =
UMODE_UNAUTH, /* u */
0, /* v */
UMODE_WALLOP, /* w */
- 0, /* x */
+ UMODE_HIDDENHOST, /* x */
UMODE_SPY, /* y */
UMODE_OPERWALL, /* z 0x7A */
0,0,0,0,0, /* 0x7B - 0x7F */
@@ -903,6 +903,7 @@ set_user_mode(struct Client *client_p, struct Client *source_p,
break;
case 'r': /* Only services may set +r */
+ case 'x': /* Only services may set +x */
break;
default:
@@ -1052,22 +1053,36 @@ send_umode_out(struct Client *client_p, struct Client *source_p,
}
void
-user_set_hostmask(struct Client *target_p, const char *hostname)
+user_set_hostmask(struct Client *target_p, const char *hostname, const int what)
{
- if (!valid_hostname(hostname))
- return;
-
if (IsUserHostIp(target_p))
delete_user_host(target_p->username, target_p->host, !MyConnect(target_p));
strlcpy(target_p->host, hostname, sizeof(target_p->host));
- SetIPSpoof(target_p);
add_user_host(target_p->username, target_p->host, !MyConnect(target_p));
SetUserHost(target_p);
+ switch (what)
+ {
+ case MODE_ADD:
+ AddUMode(target_p, UMODE_HIDDENHOST);
+ AddFlag(target_p, FLAGS_IP_SPOOFING);
+ break;
+ case MODE_DEL:
+ DelUMode(target_p, UMODE_HIDDENHOST);
+ DelFlag(target_p, FLAGS_IP_SPOOFING);
+ break;
+ default: break;
+ }
+
if (MyClient(target_p))
+ {
+ sendto_one(target_p, form_str(RPL_NEWHOSTIS), me.name,
+ target_p->name, target_p->username,
+ target_p->host);
clear_ban_cache_client(target_p);
+ }
}
/* user_welcome()