From: Stephane Thiell Date: Mon, 15 Apr 2002 14:36:15 +0000 (+0000) Subject: Author: beware (by way of mbuna ) X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=6ca25bfdb27ccd106501b0138dca47a2865b7a15;p=ircu2.10.12-pk.git Author: beware (by way of mbuna ) Log message: Fixed /whois servermask nomatch bug where normal users could use the function to discover servers, also the NOSUCHSERVER check code was missing. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@736 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 3baf46c..9b6018d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-04-15 beware + + * ircd/m_whois.c: Fixed /whois servermask nomatch bug + where normal users could use the function to discover servers, + also the NOSUCHSERVER check code was missing. + 2002-04-14 Alex Badea * ircd/ircd_parser.y: fixed cli_info(&me) not being set diff --git a/ircd/m_whois.c b/ircd/m_whois.c index 506fbc4..4324e0a 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -366,16 +366,26 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) /* If remote queries are disabled, then use the *second* parameter of * of whois, so /whois nick nick still works. */ - acptr = FindUser(parv[2]); -#else - acptr = FindUser(parv[1]); + if (!IsOper(sptr)) + parv[1] = parv[2]; #endif + + acptr = FindUser(parv[1]); + + if (IsOper(sptr) && !(acptr)) + { + send_reply(sptr, ERR_NOSUCHSERVER, parv[1]); + return 0; + } + if (acptr) + { parv[1] = cli_name(cli_user(acptr)->server); - if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != - HUNTED_ISME) + if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) != + HUNTED_ISME) return 0; - parv[1] = parv[2]; + parv[1] = parv[2]; + } } for (tmp = parv[1]; (nick = ircd_strtok(&p, tmp, ",")); tmp = 0) @@ -481,3 +491,4 @@ int ms_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) return 0; } +