extern int ms_end_of_burst_ack(struct Client*, struct Client*, int, char*[]);
extern int ms_error(struct Client*, struct Client*, int, char*[]);
extern int ms_fakehost(struct Client*, struct Client*, int, char*[]);
+extern int ms_fakehost2(struct Client*, struct Client*, int, char*[]);
extern int ms_fakehost_old(struct Client*, struct Client*, int, char*[]);
extern int ms_gline(struct Client*, struct Client*, int, char*[]);
extern int ms_hidehost(struct Client*, struct Client*, int, char*[]);
#define TOK_FAKEHOST "FH"
#define CMD_FAKEHOST MSG_FAKEHOST, TOK_FAKEHOST
+#define MSG_FAKEHOST2 "FAKEHOST2"
+#define TOK_FAKEHOST2 "FH2"
+#define CMD_FAKEHOST2 MSG_FAKEHOST2, TOK_FAKEHOST2
+
#define MSG_FAKEHOST_OLD "FAKE"
#define TOK_FAKEHOST_OLD "FA"
#define CMD_FAKEHOST_OLD MSG_FAKEHOST_OLD, TOK_FAKEHOST_OLD
/* RPL_END_USERS 394 Dalnet/EFnet/IRCnet */
/* RPL_NOUSERS 395 Dalnet/EFnet/IRCnet */
#define RPL_HOSTHIDDEN 396 /* UMODE +x completed succesfuly */
+#define RPL_HOSTIDENTHIDDEN 397 /* UMODE +x completed succesfuly (with USERNAME change) */
/*
* Errors are in the range from 400-599 currently and are grouped by what
return 0;
}
+/* ms_fakehost2 - new fakehost server message handler (SRVX initialized)
+ *
+ * parv[0] = sender prefix
+ * parv[1] = target user numeric
+ * parv[2] = target user's new ident
+ * parv[3] = target user's new fake host
+ * parv[4] = FORCE (optional)
+ */
+/** Remote fakehost
+ * Allows servers to force a fakehost on remote users.
+ *
+ * The FAKEHOST request can be generated by EVERY server. It is forwarded to the server
+ * of the user which then sets the fakehost and broadcasts the new fakehost.
+ */
+int ms_fakehost2(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
+ struct Client *target, *acptr;
+ int i;
+
+ if(parc < 4) {
+ return need_more_params(sptr, "FAKEHOST");
+ }
+
+ if(!(target = findNUser(parv[1]))) {
+ /* Silently ignore FAKEHOSTs for disconnected users. */
+ return 0;
+ }
+
+ /* 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) {
+ return 0;
+ }
+
+ /* Set fakehost and propagate the changed host. */
+ ircd_strncpy(cli_user(target)->username, parv[2], USERLEN);
+ ircd_strncpy(cli_user(target)->fakehost, parv[3], HOSTLEN);
+ hide_hostmask(target, FLAG_FAKEHOST);
+
+ sendcmdto_serv_butone(sptr, CMD_FAKEHOST2, cptr, "%C %s %s", target, parv[2], parv[3]);
+
+ return 0;
+}
+
/*
* ms_fakehost_old - old fakehost server message handler
*
/* UNREG, CLIENT, SERVER, OPER, SERVICE */
{ m_ignore, m_not_oper, ms_fakehost, m_fakehost, m_ignore }
},
+ {
+ MSG_FAKEHOST2,
+ TOK_FAKEHOST2,
+ 0, MAXPARA, MFLG_SLOW, 0, NULL,
+ /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+ { m_ignore, m_ignore, ms_fakehost2, m_ignore, m_ignore }
+ },
{
MSG_FAKEHOST_OLD,
TOK_FAKEHOST_OLD,
/* 396 */
{ RPL_HOSTHIDDEN, "%s :is now your hidden host", "396" },
/* 397 */
- { 0 },
+ { RPL_HOSTIDENTHIDDEN, "%s@%s :is now your hidden username@host", "397" },
/* 398 */
{ 0 },
/* 399 */
* @param[in] flag Some flag that affects host-hiding (FLAG_HIDDENHOST, FLAG_ACCOUNT, FLAG_FAKEHOST).
* @return Zero.
*/
+
int
-hide_hostmask(struct Client *cptr, unsigned int flag)
+hide_hostmask(struct Client *cptr, unsigned int flag) {
+ return hide_hostmask(chptr, flag, NULL);
+}
+
+int
+hide_hostmask(struct Client *cptr, unsigned int flag, char *username)
{
struct Membership *chan;
char buf[HOSTLEN];
sendcmdto_common_channels_butone(cptr, CMD_QUIT, cptr, ":Registered");
ircd_strncpy(cli_user(cptr)->host, buf, HOSTLEN);
- /* ok, the client is now fully hidden, so let them know -- hikari */
- if (MyConnect(cptr))
- send_reply(cptr, RPL_HOSTHIDDEN, cli_user(cptr)->host);
+ /* spoof also the username if username is passed */
+ if(username) {
+ ircd_strncpy(cli_user(cptr)->username, username, 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);
+ } else {
+ /* ok, the client is now fully hidden, so let them know -- hikari */
+ if (MyConnect(cptr))
+ send_reply(cptr, RPL_HOSTHIDDEN, cli_user(cptr)->host);
+ }
/*
* Go through all channels the client was on, rejoin him