FLAG_ACCOUNT, /**< account name has been set */
FLAG_HIDDENHOST, /**< user's host is hidden */
FLAG_FAKEHOST, /**< user has a fakehost */
+ FLAG_FAKEIDENT, /**< user has a fakeident */
FLAG_NOCHAN, /**< hide user's channels for non-opers */
FLAG_NOIDLE, /**< hide user's idle time for non-opers */
FLAG_XTRAOP, /**< allow overriding +k */
#define IsSecurityServ(x) HasFlag(x, FLAG_SECURITY_SERV)
/** Return non-zero if the client has a fakehost. */
#define IsFakeHost(x) HasFlag(x, FLAG_FAKEHOST)
+#define IsFakeIdent(x) HasFlag(x, FLAG_FAKEIDENT)
/** Return non-zero if the client has operator or server privileges. */
#define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
#define SetHiddenHost(x) SetFlag(x, FLAG_HIDDENHOST)
/** Mark a client as having a fakehost. */
#define SetFakeHost(x) SetFlag(x, FLAG_FAKEHOST)
+#define SetFakeIdent(x) SetFlag(x, FLAG_FAKEIDENT)
/** Mark a client as having a pending PING. */
#define SetPingSent(x) SetFlag(x, FLAG_PINGSENT)
/** Mark a client as having mode +n. */
#define ClearHiddenHost(x) ClrFlag(x, FLAG_HIDDENHOST)
/** Remove fakehost flag from the flient. */
#define ClearFakeHost(x) ClrFlag(x, FLAG_FAKEHOST)
+#define ClearFakeIdent(x) ClrFlag(x, FLAG_FAKEIDENT)
/** Clear the client's pending PING flag. */
#define ClearPingSent(x) ClrFlag(x, FLAG_PINGSENT)
/** Clear the client's HUB flag. */
#define TOK_FAKEHOST "FH"
#define CMD_FAKEHOST MSG_FAKEHOST, TOK_FAKEHOST
-#define MSG_FAKEHOST2 "FAKEHOST2"
-#define TOK_FAKEHOST2 "FH2"
+#define MSG_FAKEHOST2 "NEWFAKEHOST"
+#define TOK_FAKEHOST2 "NFH"
#define CMD_FAKEHOST2 MSG_FAKEHOST2, TOK_FAKEHOST2
#define MSG_FAKEHOST_OLD "FAKE"
* overwritten with the ident response.
*/
char username[USERLEN + 1];
+ char fakeuser[USERLEN + 1];
char host[HOSTLEN + 1]; /**< displayed hostname */
char realhost[HOSTLEN + 1]; /**< actual hostname */
char fakehost[HOSTLEN + 1]; /**< fakehost */
#include "s_bsd.h"
#include "s_conf.h"
#include "s_user.h"
+#include "s_debug.h"
#include "send.h"
-
/*
* m_fakehost - fakehost user message handler
*
}
/* Ignore the assignment if it changes nothing. */
- if(IsFakeHost(target) && strcmp(cli_user(target)->fakehost, parv[3]) == 0 && strcmp(cli_user(target)->username, parv[2]) == 0) {
+ if(IsFakeHost(target) && strcmp(cli_user(target)->fakehost, parv[3]) == 0 && strcmp(cli_user(target)->fakeuser, parv[2]) == 0) {
return 0;
}
/* Set fakehost and propagate the changed host. */
ircd_strncpy(cli_user(target)->fakehost, parv[3], HOSTLEN);
- hide_ident_hostmask(target, FLAG_FAKEHOST, parv[2]);
+ ircd_strncpy(cli_user(target)->fakeuser, parv[2], USERLEN);
+ hide_hostmask(target, FLAG_FAKEHOST | FLAG_FAKEIDENT);
- sendcmdto_serv_butone(sptr, CMD_FAKEHOST2, cptr, "%C %s %s", target, parv[2], parv[3]);
+ sendcmdto_serv_butone(sptr, CMD_FAKEHOST2, cptr, "%C %s %s", target, cli_user(target)->fakeuser, cli_user(target)->fakehost);
return 0;
}
* parv[0] = sender prefix
* parv[1] = target user numeric
* parv[2] = target user's new fake host
+ * parv[3] = target user's new fake ident
*/
int ms_fakehost_old(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) {
struct Client *target;
*/
int
-hide_hostmask(struct Client *cptr, unsigned int flag) {
- return hide_ident_hostmask(cptr, flag, NULL);
-}
-
-int
-hide_ident_hostmask(struct Client *cptr, unsigned int flag, char *username)
+hide_hostmask(struct Client *cptr, unsigned int flag)
{
struct Membership *chan;
char buf[HOSTLEN];
break;
case FLAG_ACCOUNT:
case FLAG_FAKEHOST:
+ case FLAG_FAKEIDENT:
/* Invalidate all bans against the user so we check them again */
for (chan = (cli_user(cptr))->channel; chan;
chan = chan->next_channel)
if(IsFakeHost(cptr)) ircd_strncpy(buf, cli_user(cptr)->fakehost, HOSTLEN);
else if (IsAccount(cptr)) ircd_snprintf(0, buf, HOSTLEN, "%s.%s", cli_user(cptr)->account, feature_str(FEAT_HIDDEN_HOST));
else return 0;
- if(strncmp(buf, cli_user(cptr)->host, HOSTLEN) == 0) return 0;
+ if(strncmp(buf, cli_user(cptr)->host, HOSTLEN) == 0 && (!IsFakeIdent(cptr) || strncmp(cli_user(cptr)->fakeuser, cli_user(cptr)->username, USERLEN) == 0)) return 0;
/* Remove all "valid" marks on the bans. This forces them to be
* rechecked if the ban is accessed again.
ircd_strncpy(cli_user(cptr)->host, buf, HOSTLEN);
/* spoof also the username if username is passed */
- if(username) {
- ircd_strncpy(cli_user(cptr)->username, username, USERLEN);
+ if(IsFakeIdent(cptr)) {
+ ircd_strncpy(cli_user(cptr)->username, cli_user(cptr)->fakeuser, USERLEN);
/* ok, the client is now fully hidden, so let them know -- hikari */
if (MyConnect(cptr))
send_reply(cptr, RPL_HOSTUSERHIDDEN, cli_user(cptr)->username, cli_user(cptr)->host);