X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_userhost.c;h=c6654ebcd094a9ecc5ee7f381d22b326ca881cbf;hb=refs%2Fheads%2Fupstream;hp=db862b08cf5947c9b4444a8a4e262ebbf0662ce9;hpb=1b4e637606464f9af948a6e87879565f9fc1b726;p=ircu2.10.12-pk.git diff --git a/ircd/m_userhost.c b/ircd/m_userhost.c index db862b0..c6654eb 100644 --- a/ircd/m_userhost.c +++ b/ircd/m_userhost.c @@ -81,15 +81,8 @@ */ #include "config.h" -#if 0 -/* - * No need to include handlers.h here the signatures must match - * and we don't need to force a rebuild of all the handlers everytime - * we add a new one to the list. --Bleep - */ -#include "handlers.h" -#endif /* 0 */ #include "client.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "msgq.h" @@ -97,15 +90,22 @@ #include "s_user.h" #include "struct.h" -#include +/* #include -- Now using assert in ircd_log.h */ -static void userhost_formatter(struct Client* cptr, struct MsgBuf* mb) +static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb) { assert(IsUser(cptr)); msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr), - HasPriv(cptr, PRIV_DISPLAY) ? "*" : "", + SeeOper(sptr,cptr) ? "*" : "", cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username, - cli_user(cptr)->host); + /* Do not *EVER* change this to give opers the real host. + * Too many scripts rely on this data and can inadvertently + * publish the user's real host, thus breaking the security + * of +x. If an oper wants the real host, he should go to + * /whois to get it. + */ + HasHiddenHost(cptr) && (sptr != cptr) ? + cli_user(cptr)->host : cli_user(cptr)->realhost); } /* @@ -122,49 +122,3 @@ int m_userhost(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) send_user_info(sptr, parv[1], RPL_USERHOST, userhost_formatter); return 0; } - -#if 0 -/* - * m_userhost - * - * Added by Darren Reed 13/8/91 to aid clients and reduce the need for - * complicated requests like WHOIS. - * - * Returns user/host information only (no spurious AWAY labels or channels). - * - * Rewritten to speed it up by Carlo Wood 3/8/97. - */ -int m_userhost(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) -{ - char *s; - int i, j = 5; - char *p = 0, *sbuf; - struct Client *acptr; - - if (parc < 2) - return need_more_params(sptr, "USERHOST"); - - sbuf = sprintf_irc(sendbuf, rpl_str(RPL_USERHOST), me.name, parv[0]); /* XXX DEAD */ - for (i = j, s = ircd_strtok(&p, parv[1], " "); i && s; - s = ircd_strtok(&p, (char *)0, " "), i--) - if ((acptr = FindUser(s))) - { - if (i < j) - *sbuf++ = ' '; - sbuf = sprintf_irc(sbuf, "%s%s=%c%s@%s", acptr->name, - IsAnOper(acptr) ? "*" : "", (acptr->user->away) ? '-' : '+', - acptr->user->username, acptr->user->host); - } - else - { - if (i < j) - sendbufto_one(sptr); /* XXX DEAD */ - sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, parv[0], s); /* XXX DEAD */ - sbuf = sprintf_irc(sendbuf, rpl_str(RPL_USERHOST), me.name, parv[0]); /* XXX DEAD */ - j = i - 1; - } - if (j) - sendbufto_one(sptr); /* XXX DEAD */ - return 0; -} -#endif