ソースを参照

* Port [3728] to 1.2.15
* For security purposes the following commands are now hub-only: botnick, botserver, botversion, botmsg, netnick, netserver, netversion
* Added cmd_nick to display leaf's current nick


svn: 3729

Bryan Drewery 18 年 前
コミット
1abe541ae2
4 ファイル変更37 行追加23 行削除
  1. 2 0
      doc/UPDATES
  2. 21 16
      misc/help.txt
  3. 7 7
      src/cmds.c
  4. 7 0
      src/mod/irc.mod/cmdsirc.c

+ 2 - 0
doc/UPDATES

@@ -24,6 +24,8 @@
 * Misc help cleanups
 * Misc help cleanups
 * Show kline reasons on connect to servers. (fixes #400)
 * Show kline reasons on connect to servers. (fixes #400)
 * Fix case where binpath/datadir were not updated correctly when homedir changed. (fixes #169)
 * Fix case where binpath/datadir were not updated correctly when homedir changed. (fixes #169)
+* For security purposes the following commands are now hub-only: botnick, botserver, botversion, botmsg, netnick, netserver, netversion
+* Added cmd_nick to display leaf's current nick
 
 
 1.2.14 - http://wraith.botpack.net/milestone/1.2.14
 1.2.14 - http://wraith.botpack.net/milestone/1.2.14
 * Fix another bug in shell functions. (fixes #321)
 * Fix another bug in shell functions. (fixes #321)

+ 21 - 16
misc/help.txt

@@ -267,27 +267,27 @@ See also: cmdpass
    channel will be configured with the options.
    channel will be configured with the options.
  
  
 See also: botpart, +chan, -chan, chanset, chaninfo
 See also: botpart, +chan, -chan, chanset, chaninfo
-::botjump:
+:hub:botjump:
 ###  $bbotjump$b <bot> [server [port [pass]]]
 ###  $bbotjump$b <bot> [server [port [pass]]]
    Makes the bot jump to another server. If you don't specify a
    Makes the bot jump to another server. If you don't specify a
-   server, it will jump to the next server in it's internal list (see
+   server, it will jump to the next server in its internal list (see
    $b'%dhelp set'$b). If you specify a server, it will jump to that
    $b'%dhelp set'$b). If you specify a server, it will jump to that
    server (default port is 6667), and if that server is not in the
    server (default port is 6667), and if that server is not in the
    internal list already, it will add it (until the bot relinks).
    internal list already, it will add it (until the bot relinks).
    Jumping servers ALWAYS makes the bot lose ops! be careful!
    Jumping servers ALWAYS makes the bot lose ops! be careful!
  
  
 See also: jump, servers, botserver
 See also: jump, servers, botserver
-::botmsg:
+:hub:botmsg:
 ###  $bbotmsg$b <bot> <nickname|#chan> <text>
 ###  $bbotmsg$b <bot> <nickname|#chan> <text>
    sends a private message to someone from the bot, just as if the
    sends a private message to someone from the bot, just as if the
    bot had typed /msg.
    bot had typed /msg.
  
  
 See also: msg%{+n}
 See also: msg%{+n}
-::botnick:
+:hub:botnick:
 ###  $bbotnick$b <bot>
 ###  $bbotnick$b <bot>
-   The bot will display it's current nick over DCC.
+   The specified bot will display its current nick over DCC.
  
  
-See also: netnick
+See also: netnick, nick
 ::botpart
 ::botpart
 ###  $bbotpart$b <bot> <channel>
 ###  $bbotpart$b <bot> <channel>
    Removes bot from the specified channel
    Removes bot from the specified channel
@@ -302,12 +302,12 @@ See also: botjoin, +chan, -chan, chanset, chaninfo
    bot. %{+n}Use $b'%dwho'$b or $b'%dbottree'$b for that information.%{-}
    bot. %{+n}Use $b'%dwho'$b or $b'%dbottree'$b for that information.%{-}
  
  
    Specifying a nodename will display all bots up/down on that nodename.
    Specifying a nodename will display all bots up/down on that nodename.
-   Bots with a * preceeding it's name is down.
+   Bots with a * preceeding its name is down.
  
  
 See also: downbots%{+n}, bottree%{-}
 See also: downbots%{+n}, bottree%{-}
-::botserver:
+:hub:botserver:
 ###  $bbotserver$b <bot>
 ###  $bbotserver$b <bot>
-   The bot will display it's current server and lag over DCC.
+   The bot will display its current server and lag over DCC.
  
  
 See also: netserver, servers%{+n}, set%{-}
 See also: netserver, servers%{+n}, set%{-}
 :hub:botset:
 :hub:botset:
@@ -338,7 +338,7 @@ See also: set
 See also: bots, downbots
 See also: bots, downbots
 ::botversion:
 ::botversion:
 ###  $bbotversion$b <bot>
 ###  $bbotversion$b <bot>
-   The bot will display it's pack version and uname.
+   The bot will display its pack version and uname.
  
  
 See also: version, netversion, about%{+m|m}, status%{-}
 See also: version, netversion, about%{+m|m}, status%{-}
 :hub:chaddr
 :hub:chaddr
@@ -798,12 +798,12 @@ See also: color, echo, login, page, strip
  
  
      1,6,11,16,21,26,31,36,41,46,51,56 * * * * /usr/home/bryan/hub/newhub > /dev/null 2>&1
      1,6,11,16,21,26,31,36,41,46,51,56 * * * * /usr/home/bryan/hub/newhub > /dev/null 2>&1
    'delete' will remove the bot's own crontab entry from the crontab list.
    'delete' will remove the bot's own crontab entry from the crontab list.
-   'new' will make the bot add it's self to the crontab list, although this is done
+   'new' will make the bot add itself to the crontab list, although this is done
      automatically on startup.
      automatically on startup.
 ::cycle:
 ::cycle:
 ###  $bcycle$b <channel> [delay]
 ###  $bcycle$b <channel> [delay]
    If done on the hub, makes all linked bots cycle the specified channel. 
    If done on the hub, makes all linked bots cycle the specified channel. 
-   Otherwise, only the bot it's done on will cycle.
+   Otherwise, only the bot it is done on will cycle.
    Delay defaults to 10 seconds, which means bots will part and not rejoin
    Delay defaults to 10 seconds, which means bots will part and not rejoin
    until that time has passed.
    until that time has passed.
  
  
@@ -1330,11 +1330,11 @@ See also: lagged
    the user that they are currently running as.
    the user that they are currently running as.
  
  
 See also: last
 See also: last
-::netnick:
+:hub:netnick:
 ###  $bnetnick$b 
 ###  $bnetnick$b 
    All bots on the botnet will display their nick over DCC.
    All bots on the botnet will display their nick over DCC.
  
  
-See also: botnick
+See also: botnick, nick
 :hub:netps:
 :hub:netps:
 ###  $bnetps$b [ps-param]
 ###  $bnetps$b [ps-param]
    Will run 'ps' on each bot on the botnet and returned the
    Will run 'ps' on each bot on the botnet and returned the
@@ -1346,13 +1346,13 @@ See also: ps
 ###  $bnetcrontab$b <status|delete|show|new> [interval]
 ###  $bnetcrontab$b <status|delete|show|new> [interval]
    Runs the specified crontab command on all linked bots.
    Runs the specified crontab command on all linked bots.
    See: crontab
    See: crontab
-::netserver:
+:hub:netserver:
 ###  $bnetservers$b 
 ###  $bnetservers$b 
    All bots on the botnet will display their current server and lag
    All bots on the botnet will display their current server and lag
    to that server over DCC.
    to that server over DCC.
  
  
 See also: botserver, servers%{+n}, set%{-}
 See also: botserver, servers%{+n}, set%{-}
-::netversion:
+:hub:netversion:
 ###  $bnetversion$b <bot>
 ###  $bnetversion$b <bot>
    All bots on the botnet will display their pack version, and uname.
    All bots on the botnet will display their pack version, and uname.
  
  
@@ -1380,6 +1380,11 @@ See also: w
 %{+mi}See also: chpass%{-}%{+n}, chsecpass%{-}
 %{+mi}See also: chpass%{-}%{+n}, chsecpass%{-}
 ::nick
 ::nick
 See: handle
 See: handle
+::nick:
+###  $bnick$b <bot>
+   The bot will display its current nick over DCC.
+ 
+See also: botnick, netnick
 :hub:nopass
 :hub:nopass
 ###  $bnopass$b [anything]
 ###  $bnopass$b [anything]
    Displays all users who do not have a password set.
    Displays all users who do not have a password set.

+ 7 - 7
src/cmds.c

@@ -3810,7 +3810,7 @@ static void cmd_version(int idx, char *par)
   botnet_send_cmd(conf.bot->nick, conf.bot->nick, dcc[idx].nick, idx, "ver");
   botnet_send_cmd(conf.bot->nick, conf.bot->nick, dcc[idx].nick, idx, "ver");
 }
 }
 
 
-/* netnick, botnick */
+/* netnick, botnick, nick */
 static void cmd_netnick (int idx, char *par) {
 static void cmd_netnick (int idx, char *par) {
   putlog(LOG_CMDS, "*", "#%s# netnick", dcc[idx].nick);
   putlog(LOG_CMDS, "*", "#%s# netnick", dcc[idx].nick);
   botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, "curnick");
   botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, "curnick");
@@ -4537,16 +4537,16 @@ cmd_t C_dcc[] =
   {"whois",		"",	(Function) cmd_whois,		NULL, AUTH},
   {"whois",		"",	(Function) cmd_whois,		NULL, AUTH},
   {"whom",		"",	(Function) cmd_whom,		NULL, 0},
   {"whom",		"",	(Function) cmd_whom,		NULL, 0},
   {"whoami",		"",	(Function) cmd_whoami,		NULL, AUTH},
   {"whoami",		"",	(Function) cmd_whoami,		NULL, AUTH},
-  {"botjump",           "m",    (Function) cmd_botjump,         NULL, 0},
-  {"botmsg",		"o",    (Function) cmd_botmsg,          NULL, 0},
-  {"botnick", 		"m", 	(Function) cmd_botnick, 	NULL, 0},
-  {"netnick", 		"m", 	(Function) cmd_netnick, 	NULL, 0},
+  {"botjump",           "m",    (Function) cmd_botjump,         NULL, HUB},
+  {"botmsg",		"o",    (Function) cmd_botmsg,          NULL, HUB},
+  {"botnick", 		"m", 	(Function) cmd_botnick, 	NULL, HUB},
+  {"netnick", 		"m", 	(Function) cmd_netnick, 	NULL, HUB},
   {"netw", 		"n", 	(Function) cmd_netw, 		NULL, HUB},
   {"netw", 		"n", 	(Function) cmd_netw, 		NULL, HUB},
   {"netps", 		"n", 	(Function) cmd_netps, 		NULL, HUB},
   {"netps", 		"n", 	(Function) cmd_netps, 		NULL, HUB},
   {"netlast", 		"n", 	(Function) cmd_netlast, 	NULL, HUB},
   {"netlast", 		"n", 	(Function) cmd_netlast, 	NULL, HUB},
   {"netlag", 		"m", 	(Function) cmd_netlag, 		NULL, HUB},
   {"netlag", 		"m", 	(Function) cmd_netlag, 		NULL, HUB},
-  {"botserver",		"m",	(Function) cmd_botserver,	NULL, 0},
-  {"netserver", 	"m", 	(Function) cmd_netserver, 	NULL, 0},
+  {"botserver",		"m",	(Function) cmd_botserver,	NULL, HUB},
+  {"netserver", 	"m", 	(Function) cmd_netserver, 	NULL, HUB},
   {"timesync",		"a",	(Function) cmd_timesync,	NULL, 0},
   {"timesync",		"a",	(Function) cmd_timesync,	NULL, 0},
   {"botversion", 	"o", 	(Function) cmd_botversion, 	NULL, HUB},
   {"botversion", 	"o", 	(Function) cmd_botversion, 	NULL, HUB},
   {"version", 		"o", 	(Function) cmd_version, 	NULL, 0},
   {"version", 		"o", 	(Function) cmd_version, 	NULL, 0},

+ 7 - 0
src/mod/irc.mod/cmdsirc.c

@@ -118,6 +118,12 @@ static void cmd_msg(int idx, char *par)
   dprintf(idx, "Msg to %s: %s\n", nick, par);
   dprintf(idx, "Msg to %s: %s\n", nick, par);
 }
 }
 
 
+static void cmd_nick(int idx, char *par)
+{
+  putlog(LOG_CMDS, "*", "#%s# nick", dcc[idx].nick);
+  botnet_send_cmd(conf.bot->nick, conf.bot->nick, dcc[idx].nick, idx, "curnick");
+}
+
 static void cmd_say(int idx, char *par)
 static void cmd_say(int idx, char *par)
 {
 {
   if (!par[0]) {
   if (!par[0]) {
@@ -1863,6 +1869,7 @@ static cmd_t irc_dcc[] =
   {"mmode",             "n|n",	 (Function) cmd_mmode,		NULL, LEAF},
   {"mmode",             "n|n",	 (Function) cmd_mmode,		NULL, LEAF},
   {"mop",		"n|m",	 (Function) cmd_mop,		NULL, LEAF|AUTH},
   {"mop",		"n|m",	 (Function) cmd_mop,		NULL, LEAF|AUTH},
   {"msg",		"o",	 (Function) cmd_msg,		NULL, LEAF|AUTH},
   {"msg",		"o",	 (Function) cmd_msg,		NULL, LEAF|AUTH},
+  {"nick",		"m",	 (Function) cmd_nick,		NULL, LEAF},
   {"op",		"o|o",	 (Function) cmd_op,		NULL, LEAF|AUTH},
   {"op",		"o|o",	 (Function) cmd_op,		NULL, LEAF|AUTH},
   {"reset",		"m|m",	 (Function) cmd_reset,		NULL, LEAF|AUTH},
   {"reset",		"m|m",	 (Function) cmd_reset,		NULL, LEAF|AUTH},
   {"resetbans",		"o|o",	 (Function) cmd_resetbans,	NULL, LEAF|AUTH},
   {"resetbans",		"o|o",	 (Function) cmd_resetbans,	NULL, LEAF|AUTH},