Author: beware <steendijk@tomaatnet.nl> (by way of mbuna <mbuna@undernet.org>)
authorStephane Thiell <mbuna@undernet.org>
Mon, 15 Apr 2002 14:36:15 +0000 (14:36 +0000)
committerStephane Thiell <mbuna@undernet.org>
Mon, 15 Apr 2002 14:36:15 +0000 (14:36 +0000)
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

ChangeLog
ircd/m_whois.c

index 3baf46c8574e164e2c03fbd20dec6cf83f5ffda7..9b6018da4dbb1f8d73ee4d44ffb8d527c93fe0a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-04-15  beware <steendijk@tomaatnet.nl>
+
+       * 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  <vampire@p16.pub.ro>
 
        * ircd/ircd_parser.y: fixed cli_info(&me) not being set
index 506fbc42c1a4919373d21e06f5b4ab785ad3df7f..4324e0aa1e07e7eb60a22d06c75b2b2333c045d6 100644 (file)
@@ -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;
 }
+