diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-05-29 19:36:51 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-05-29 19:36:51 +0000 |
commit | cead4299606b2512732879e6d377cdef777dc659 (patch) | |
tree | 6e82c5e77655f49be6c9515c63d6ab0a31af5dbd /src | |
parent | 6c9292470dfdd5508a7bc0d28c3702e6188f4575 (diff) |
- Finished proper implementation of usermode 'x' (UMODE_HIDDENHOST)
Only services may set a fakehost via SVSMODE.
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2136 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r-- | src/numeric.c | 2 | ||||
-rw-r--r-- | src/s_user.c | 27 |
2 files changed, 22 insertions, 7 deletions
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() |