Prechádzať zdrojové kódy

* Port [3168] to 1.2.13
* Fix cmd_link being used to link to non-hubs. (fixes #329)



svn: 3169

Bryan Drewery 19 rokov pred
rodič
commit
9cd9109aaf
2 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 1 0
      doc/UPDATES
  2. 7 0
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -20,6 +20,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * See 'help whois' as some flags are now user, bot, chan, global only.
 * Fix cmd_console not working for +private channels correctly (fixes #325)
 * -user on a bot now works on linked bots. (fixes #200)
+* Fix cmd_link being used to link to non-hubs. (fixes #329)
 
 1.2.12 - http://wraith.shatow.net/milestone/1.2.12
 * Clearing a variable via 'set var -' now resets that variable to default settings. (implements #111)

+ 7 - 0
src/cmds.c

@@ -1952,6 +1952,13 @@ static void cmd_link(int idx, char *par)
   putlog(LOG_CMDS, "*", "#%s# link %s", dcc[idx].nick, par);
 
   char *s = newsplit(&par);
+  char *tolink = par[0] ? par : s;
+  struct userrec *u = get_user_by_handle(userlist, tolink);
+
+  if (!u || bot_hublevel(u) == 999) {
+    dprintf(idx, "You can only link to other hubs.\n");
+    return;
+  }
 
   if (!par[0] || !egg_strcasecmp(par, conf.bot->nick))
     botlink(dcc[idx].nick, idx, s);