Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Thu, 7 Jun 2001 21:09:51 +0000 (21:09 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Thu, 7 Jun 2001 21:09:51 +0000 (21:09 +0000)
Log message:

This is mostly just a forward-port of some of the stuff that's just gone
into pl15.  It seems to work, mostly...

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@491 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

18 files changed:
ChangeLog
include/ircd_policy.h
include/s_stats.h
ircd/Makefile.in
ircd/channel.c
ircd/m_admin.c
ircd/m_burst.c
ircd/m_lusers.c
ircd/m_motd.c
ircd/m_nick.c
ircd/m_stats.c
ircd/m_time.c
ircd/m_version.c
ircd/m_who.c
ircd/m_whois.c
ircd/m_whowas.c
ircd/s_numeric.c
ircd/s_stats.c

index 738641e8a91b8dd67e3f7391c920a6b873bbf61b..921822fb5c15f180ea62ef17dad5a74d7a50aea5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,60 @@
 2001-06-07  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/s_stats.c (hunt_stats): forward-port from pl15 of all the
+       changes required to control remote stats
+
+       * ircd/s_numeric.c (do_numeric): rewrite numeric origins if
+       recipient is not an operator and HEAD_IN_SAND_REWRITE is defined
+       [forward-port from pl15]
+
+       * ircd/m_whowas.c (m_whowas): report server name only if requester
+       is an operator [forward-port from pl15]
+
+       * ircd/m_whois.c (do_whois): /whois <mynick> now correctly reports
+       my server; if HEAD_IN_SAND_REMOTE is 1, ignore the middle argument
+       and obtain the report from the user's server [forward-port from
+       pl15]
+
+       * ircd/m_who.c: add missing include for ircd_policy.h
+       [forward-port from pl15]
+
+       * ircd/m_version.c (m_version): require oper access for remote
+       /version if HEAD_IN_SAND_REMOTE is 1 [forward-port from pl15]
+
+       * ircd/m_time.c (m_time): require oper access for remote /time if
+       HEAD_IN_SAND_REMOTE is 1 [forward-port from pl15]
+
+       * ircd/m_stats.c: pass extra argument to hunt_stats(); correct
+       missing semicolon [forward-port from pl15]
+
+       * ircd/m_nick.c (ms_nick): hide the origin of certain collision
+       kills [forward-port from pl15]
+
+       * ircd/m_motd.c (m_motd): require oper access for remote /motd if
+       HEAD_IN_SAND_REMOTE is 1 [forward-port from pl15]
+
+       * ircd/m_lusers.c (m_lusers): require oper access for remote
+       /lusers if HEAD_IN_SAND_REMOTE is 1 [forward-port from pl15]
+
+       * ircd/m_burst.c (ms_burst): server-added bans are stored using
+       local server name, to hide remote server names; modes also are to
+       originate from the local server [forward-port from pl15]
+
+       * ircd/m_admin.c (m_admin): require oper access for remote /admin
+       if HEAD_IN_SAND_REMOTE is 1 [forward-port from pl15]
+
+       * ircd/channel.c (add_banid): if a server is adding a ban, use my
+       server name to hide the remote server's name [forward-port from
+       pl15]
+
+       * ircd/Makefile.in: ran make depend
+
+       * include/s_stats.h: hunt_stats() has to have an extra argument to
+       support the forward-port from pl15
+
+       * include/ircd_policy.h: #define HEAD_IN_SAND_STATS_P; add
+       HEAD_IN_SAND_{BANWHO,REWRITE,REMOTE} [forward-port from pl15]
+
        * ircd/engine_poll.c (engine_loop): remove bogus assert that I
        forgot to check in the events branch
 
index 849aab0a0e0e89a558a49ac0b60aea1ff7306904..8f25e651f2a77b883e73b5c944e3625c08863092 100644 (file)
@@ -94,7 +94,7 @@
 #define HEAD_IN_SAND_STATS_M
 #define HEAD_IN_SAND_STATS_m
 #define HEAD_IN_SAND_STATS_O
-#undef  HEAD_IN_SAND_STATS_P
+#define HEAD_IN_SAND_STATS_P
 #define HEAD_IN_SAND_STATS_R
 #define HEAD_IN_SAND_STATS_D
 #define HEAD_IN_SAND_STATS_d
 #define HEAD_IN_SAND_WHOIS_SERVERNAME
 #define HEAD_IN_SAND_WHO_SERVERNAME
 
+/* CFV-165 - Hiding Nonessential information from non-opers
+ *
+ */
+
+/* don't show which server set a ban */
+#define HEAD_IN_SAND_BANWHO
+
+/* remap remote numerics to come from the local server */
+#define HEAD_IN_SAND_REWRITE
+
+/* disallow remote queries (*sob!*) */
+/* (note, set this to 1 to reenable, not undef */
+#define HEAD_IN_SAND_REMOTE 0
+
 #endif /* INCLUDED_ircd_policy_h */
index 49dfe0120950ee0c938dbed648fb1f549ed2d5b0..17cc5eeb691fda79489b57871edcbc012628aac1 100644 (file)
@@ -30,7 +30,7 @@ struct Client;
 extern const char *statsinfo[];
 extern void report_stats(struct Client *sptr, char stat);
 extern void report_configured_links(struct Client *sptr, int mask);
-extern int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[], char stat);
+extern int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[], char stat, int MustBeOper);
 
 extern void report_crule_list(struct Client* to, int mask);
 extern void report_motd_list(struct Client* to);
index 0a4f63628668b921d2518833abf1482c4c1952ea..abc2f5b3217db7f8405392b10f22bb1680e8ce4c 100644 (file)
@@ -345,13 +345,13 @@ channel.o: channel.c ../config.h ../include/channel.h \
  ../include/hash.h ../include/ircd.h ../include/struct.h \
  ../include/ircd_alloc.h ../include/fda.h ../include/ircd_chattr.h \
  ../include/ircd_features.h ../include/ircd_log.h \
- ../include/ircd_reply.h ../include/ircd_snprintf.h \
- ../include/ircd_string.h ../include/list.h ../include/match.h \
- ../include/msg.h ../include/numeric.h ../include/numnicks.h \
- ../include/querycmds.h ../include/s_bsd.h ../include/s_conf.h \
- ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \
- ../include/send.h ../include/sprintf_irc.h ../include/support.h \
- ../include/sys.h ../include/whowas.h
+ ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_snprintf.h ../include/ircd_string.h ../include/list.h \
+ ../include/match.h ../include/msg.h ../include/numeric.h \
+ ../include/numnicks.h ../include/querycmds.h ../include/s_bsd.h \
+ ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \
+ ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \
+ ../include/support.h ../include/sys.h ../include/whowas.h
 class.o: class.c ../config.h ../include/class.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
@@ -490,9 +490,9 @@ listener.o: listener.c ../config.h ../include/listener.h \
 m_admin.o: m_admin.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/hash.h \
- ../include/ircd.h ../include/struct.h ../include/ircd_reply.h \
- ../include/msg.h ../include/numeric.h ../include/numnicks.h \
- ../include/s_conf.h ../include/s_user.h
+ ../include/ircd.h ../include/struct.h ../include/ircd_policy.h \
+ ../include/ircd_reply.h ../include/msg.h ../include/numeric.h \
+ ../include/numnicks.h ../include/s_conf.h ../include/s_user.h
 m_away.o: m_away.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
@@ -504,11 +504,12 @@ m_burst.o: m_burst.c ../config.h ../include/channel.h \
  ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
  ../include/hash.h ../include/ircd.h ../include/struct.h \
- ../include/ircd_alloc.h ../include/fda.h ../include/ircd_reply.h \
- ../include/ircd_string.h ../include/ircd_chattr.h ../include/list.h \
- ../include/match.h ../include/msg.h ../include/numeric.h \
- ../include/numnicks.h ../include/s_conf.h ../include/s_misc.h \
- ../include/send.h ../include/support.h
+ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_policy.h \
+ ../include/ircd_reply.h ../include/ircd_string.h \
+ ../include/ircd_chattr.h ../include/list.h ../include/match.h \
+ ../include/msg.h ../include/numeric.h ../include/numnicks.h \
+ ../include/s_conf.h ../include/s_misc.h ../include/send.h \
+ ../include/support.h
 m_clearmode.o: m_clearmode.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h \
@@ -681,9 +682,9 @@ m_list.o: m_list.c ../config.h ../include/channel.h \
 m_lusers.o: m_lusers.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \
- ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
- ../include/numnicks.h ../include/querycmds.h \
+ ../include/struct.h ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \
+ ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \
  ../include/ircd_features.h ../include/s_user.h ../include/s_serv.h \
  ../include/send.h
 m_map.o: m_map.c ../config.h ../include/client.h \
@@ -706,11 +707,11 @@ m_mode.o: m_mode.c ../config.h ../include/handlers.h \
 m_motd.o: m_motd.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \
- ../include/ircd_chattr.h ../include/match.h ../include/motd.h \
- ../include/msg.h ../include/numeric.h ../include/numnicks.h \
- ../include/s_conf.h ../include/class.h ../include/s_user.h \
- ../include/send.h
+ ../include/struct.h ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_string.h ../include/ircd_chattr.h ../include/match.h \
+ ../include/motd.h ../include/msg.h ../include/numeric.h \
+ ../include/numnicks.h ../include/s_conf.h ../include/class.h \
+ ../include/s_user.h ../include/send.h
 m_names.o: m_names.c ../config.h ../include/channel.h \
  ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
@@ -895,10 +896,10 @@ m_stats.o: m_stats.c ../config.h ../include/handlers.h \
 m_time.o: m_time.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \
- ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
- ../include/numnicks.h ../include/s_misc.h ../include/s_user.h \
- ../include/send.h
+ ../include/struct.h ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \
+ ../include/numeric.h ../include/numnicks.h ../include/s_misc.h \
+ ../include/s_user.h ../include/send.h
 m_topic.o: m_topic.c ../config.h ../include/channel.h \
  ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
@@ -946,11 +947,11 @@ m_version.o: m_version.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/hash.h \
  ../include/ircd.h ../include/struct.h ../include/ircd_features.h \
- ../include/ircd_reply.h ../include/ircd_string.h \
- ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
- ../include/numnicks.h ../include/s_debug.h ../include/s_user.h \
- ../include/send.h ../include/supported.h ../include/channel.h \
- ../include/version.h
+ ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \
+ ../include/numeric.h ../include/numnicks.h ../include/s_debug.h \
+ ../include/s_user.h ../include/send.h ../include/supported.h \
+ ../include/channel.h ../include/version.h
 m_wallchops.o: m_wallchops.c ../config.h ../include/channel.h \
  ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
@@ -975,9 +976,10 @@ m_who.o: m_who.c ../config.h ../include/channel.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
  ../include/hash.h ../include/ircd.h ../include/struct.h \
  ../include/ircd_chattr.h ../include/ircd_log.h \
- ../include/ircd_reply.h ../include/ircd_string.h ../include/match.h \
- ../include/numeric.h ../include/numnicks.h ../include/send.h \
- ../include/support.h ../include/whocmds.h
+ ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_string.h ../include/match.h ../include/numeric.h \
+ ../include/numnicks.h ../include/send.h ../include/support.h \
+ ../include/whocmds.h
 m_whois.o: m_whois.c ../config.h ../include/channel.h \
  ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
@@ -989,10 +991,11 @@ m_whois.o: m_whois.c ../config.h ../include/channel.h \
 m_whowas.o: m_whowas.c ../config.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/hash.h \
- ../include/ircd.h ../include/struct.h ../include/ircd_reply.h \
- ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \
- ../include/numeric.h ../include/numnicks.h ../include/s_user.h \
- ../include/s_misc.h ../include/send.h ../include/whowas.h
+ ../include/ircd.h ../include/struct.h ../include/ircd_policy.h \
+ ../include/ircd_reply.h ../include/ircd_string.h \
+ ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \
+ ../include/numnicks.h ../include/s_user.h ../include/s_misc.h \
+ ../include/send.h ../include/whowas.h
 match.o: match.c ../config.h ../include/match.h \
  ../include/ircd_chattr.h
 motd.o: motd.c ../config.h ../include/motd.h ../include/class.h \
@@ -1123,8 +1126,8 @@ s_numeric.o: s_numeric.c ../config.h ../include/s_numeric.h \
  ../include/channel.h ../include/ircd_defs.h ../include/client.h \
  ../include/dbuf.h ../include/msgq.h ../include/ircd_events.h \
  ../include/ircd_handler.h ../include/hash.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_snprintf.h ../include/numnicks.h \
- ../include/send.h
+ ../include/struct.h ../include/ircd_policy.h \
+ ../include/ircd_snprintf.h ../include/numnicks.h ../include/send.h
 s_serv.o: s_serv.c ../config.h ../include/s_serv.h \
  ../include/IPcheck.h ../include/channel.h ../include/ircd_defs.h \
  ../include/client.h ../include/dbuf.h ../include/msgq.h \
index 38a5356a8cd85487ab6779a482195d39df1874aa..8ad335612209d469b065c72143cd5a1b44ffc80a 100644 (file)
@@ -30,6 +30,7 @@
 #include "ircd_defs.h"
 #include "ircd_features.h"
 #include "ircd_log.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_snprintf.h"
 #include "ircd_string.h"
@@ -360,9 +361,13 @@ int add_banid(struct Client *cptr, struct Channel *chptr, char *banid,
     assert(0 != ban->value.ban.banstr);
     strcpy(ban->value.ban.banstr, banid);
 
-    ban->value.ban.who = (char*) MyMalloc(strlen(cli_name(cptr)) + 1);
+#ifdef HEAD_IN_SAND_BANWHO
+    if (IsServer(cptr))
+      DupString(ban->value.ban.who, cli_name(&me));
+    else
+#endif
+      DupString(ban->value.ban.who, cli_name(cptr));
     assert(0 != ban->value.ban.who);
-    strcpy(ban->value.ban.who, cli_name(cptr));
 
     ban->value.ban.when = TStime();
     ban->flags = CHFL_BAN;      /* This bit is never used I think... */
index 2ecd08f2b665f7d7e22c8cf736c1cfc3ac7eac3c..f1c5fbb93510670649e039e6ed8e189b8fab4547 100644 (file)
@@ -92,6 +92,7 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "msg.h"
 #include "numeric.h"
@@ -134,7 +135,8 @@ int m_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       return send_reply(sptr, ERR_NOSUCHSERVER, parv[1]);
 
     parv[1] = cli_name(acptr);
-    if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, 0, ":%C", 1, parc, parv) != HUNTED_ISME)
+    if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, HEAD_IN_SAND_REMOTE, ":%C", 1,
+                       parc, parv) != HUNTED_ISME)
       return 0;
   }
   return send_admin_info(sptr);
index e91484e9222ca5726dc2007dff1f0a08a6b2d52a..1d4c1ec140fe8e7a1bf71ce5378dc59dd245a235 100644 (file)
@@ -94,6 +94,7 @@
 #include "hash.h"
 #include "ircd.h"
 #include "ircd_alloc.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "list.h"
@@ -175,7 +176,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   if (!chptr->creationtime || chptr->creationtime > timestamp) {
     chptr->creationtime = timestamp;
 
-    modebuf_init(mbuf = &modebuf, sptr, cptr, chptr, MODEBUF_DEST_CHANNEL);
+    modebuf_init(mbuf = &modebuf, &me, cptr, chptr, MODEBUF_DEST_CHANNEL);
     modebuf_mode(mbuf, MODE_DEL | chptr->mode.mode); /* wipeout modes */
     chptr->mode.mode &= ~(MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET |
                          MODE_MODERATED | MODE_TOPICLIMIT | MODE_INVITEONLY |
@@ -187,7 +188,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     for (lp = chptr->banlist; lp; lp = lp->next)
       lp->flags |= CHFL_BURST_BAN_WIPEOUT;
   } else if (chptr->creationtime == timestamp) {
-    modebuf_init(mbuf = &modebuf, sptr, cptr, chptr, MODEBUF_DEST_CHANNEL);
+    modebuf_init(mbuf = &modebuf, &me, cptr, chptr, MODEBUF_DEST_CHANNEL);
 
     parse_flags |= MODE_PARSE_SET; /* set new modes */
   }
@@ -247,7 +248,11 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
            newban = make_link(); /* create new ban */
 
            DupString(newban->value.ban.banstr, ban);
+#ifdef HEAD_IN_SAND_BANWHO
+           DupString(newban->value.ban.who, cli_name(&me));
+#else
            DupString(newban->value.ban.who, cli_name(sptr));
+#endif
            newban->value.ban.when = TStime();
 
            newban->flags = CHFL_BAN | CHFL_BURST_BAN; /* set flags */
index 764252d4fd54e645aa722eb56a4ed3ab73d03b51..d06ffdb4eca4d82350c9fd7c308db5447274a7ff 100644 (file)
@@ -91,6 +91,7 @@
 #endif /* 0 */
 #include "client.h"
 #include "ircd.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
@@ -114,8 +115,8 @@ int m_lusers(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   int longoutput = MyUser(sptr) || IsOper(sptr);
   if (parc > 2)
-    if (hunt_server_cmd(sptr, CMD_LUSERS, cptr, 0, "%s :%C", 2, parc, parv) !=
-        HUNTED_ISME)
+    if (hunt_server_cmd(sptr, CMD_LUSERS, cptr, HEAD_IN_SAND_REMOTE, "%s :%C",
+                       2, parc, parv) != HUNTED_ISME)
       return 0;
 
   send_reply(sptr, RPL_LUSERCLIENT, UserStats.clients - UserStats.inv_clients,
index f75cadfbb8b7730489e09520682fe637c420bb9e..a3cb47daa14b91149a0d91be511e8f6aeb7da64f 100644 (file)
@@ -91,6 +91,7 @@
 #endif /* 0 */
 #include "client.h"
 #include "ircd.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "match.h"
  */
 int m_motd(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
-  if (hunt_server_cmd(sptr, CMD_MOTD, cptr, 0, "%C", 1, parc, parv) !=
-      HUNTED_ISME)
+  if (hunt_server_cmd(sptr, CMD_MOTD, cptr, HEAD_IN_SAND_REMOTE, "%C", 1,
+                     parc, parv) != HUNTED_ISME)
     return 0;
 
   return motd_send(sptr);
index f532a89397e68ed4ced64c965932c60184c8b1fe..5990ba6d46a450adb16b59f25d1b329d04bfb618 100644 (file)
@@ -447,9 +447,8 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
        (!differ && lastnick <= cli_lastnick(acptr))) {
       if (!IsServer(sptr)) {
         ++ServerStats->is_kill;
-       sendcmdto_serv_butone(&me, CMD_KILL, sptr, "%C :%s (%s <- %s (Nick "
-                             "collision))", sptr, cli_name(&me), cli_name(cli_from(acptr)),
-                             cli_name(cptr));
+       sendcmdto_serv_butone(&me, CMD_KILL, sptr, "%C :%s (Nick collision)",
+                             sptr, cli_name(&me));
         assert(!MyConnect(sptr));
 
         cli_flags(sptr) |= FLAGS_KILLED;
@@ -472,18 +471,16 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    * This exits the client we had before getting the NICK message
    */
   if (differ) {
-    sendcmdto_serv_butone(&me, CMD_KILL, acptr, "%C :%s (%s <- %s (older "
-                         "nick overruled))", acptr, cli_name(&me),
-                         cli_name(cli_from(acptr)), cli_name(cptr));
+    sendcmdto_serv_butone(&me, CMD_KILL, acptr, "%C :%s (older nick "
+                         "overruled)", acptr, cli_name(&me));
     if (MyConnect(acptr))
       sendcmdto_one(acptr, CMD_QUIT, cptr, ":Local kill by %s (Ghost)",
                    cli_name(&me));
     exit_client(cptr, acptr, &me, "Nick collision (older nick overruled)");
   }
   else {
-    sendcmdto_serv_butone(&me, CMD_KILL, acptr, "%C :%s (%s <- %s (nick "
-                         "collision from same user@host))", acptr, cli_name(&me),
-                         cli_name(cli_from(acptr)), cli_name(cptr));
+    sendcmdto_serv_butone(&me, CMD_KILL, acptr, "%C :%s (nick collision from "
+                         "same user@host)", acptr, cli_name(&me));
     if (MyConnect(acptr))
       sendcmdto_one(acptr, CMD_QUIT, cptr, ":Local kill by %s (Ghost: ",
                    "switched servers too fast)", cli_name(&me));
index d0bba3020925207aae68bb7bb983cd4c8afcc817..bd6e59082f2c5cce388e4cddf34966506ce8ee91 100644 (file)
@@ -198,7 +198,8 @@ int m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   char stat = parc > 1 ? parv[1][0] : '\0';
   const char **infotext = statsinfo;
 
-  if (hunt_stats(cptr, sptr, parc, parv, stat) != HUNTED_ISME)
+  if (hunt_stats(cptr, sptr, parc, parv, stat, HEAD_IN_SAND_REMOTE)
+      != HUNTED_ISME)
     return 0;
 
   switch (stat)
@@ -393,7 +394,7 @@ int m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
        * interpret the fourth parameter as the port number.
        */ 
 #ifdef HEAD_IN_SAND_STATS_P
-      return m_not_oper(sptr,cptr,parc,parv)
+      return m_not_oper(sptr,cptr,parc,parv);
 #else
       show_ports(sptr, 0, (parc > 3) ? atoi(parv[3]) : 0, 100);
 #endif
@@ -545,7 +546,7 @@ int ms_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   char stat = parc > 1 ? parv[1][0] : '\0';
   int i;
 
-  if (hunt_stats(cptr, sptr, parc, parv, stat) != HUNTED_ISME)
+  if (hunt_stats(cptr, sptr, parc, parv, stat, 0) != HUNTED_ISME)
     return 0;
 
   switch (stat)
@@ -774,7 +775,8 @@ int mo_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   const char**     infotext = statsinfo;
   int              i;
 
-  if (hunt_stats(cptr, sptr, parc, parv, stat) != HUNTED_ISME)
+  if (hunt_stats(cptr, sptr, parc, parv, stat, HEAD_IN_SAND_REMOTE)
+      != HUNTED_ISME)
     return 0;
 
   switch (stat)
index b02fa0f33fbe430ae012e541ddb8e19ef6067174..e64ed4c15ff2b3eabefa80fe7c8bfbdebcbed7cd 100644 (file)
@@ -91,6 +91,7 @@
 #endif /* 0 */
 #include "client.h"
 #include "ircd.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
  */
 int m_time(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
-  if (hunt_server_cmd(sptr, CMD_TIME, cptr, 0, ":%C", 1, parc, parv) !=
-      HUNTED_ISME)
+  if (hunt_server_cmd(sptr, CMD_TIME, cptr, HEAD_IN_SAND_REMOTE, ":%C", 1,
+                     parc, parv) != HUNTED_ISME)
     return 0;
 
   send_reply(sptr, RPL_TIME, cli_name(&me), TStime(), TSoffset, date((long)0));
index 7eef88d3281444b000fae1b3a69b12951ef2acbf..65c3426dce1c748b35f0178f8e5b13d24ed98aca 100644 (file)
@@ -93,6 +93,7 @@
 #include "hash.h"
 #include "ircd.h"
 #include "ircd_features.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
@@ -126,8 +127,8 @@ int m_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     parv[1] = cli_name(acptr);
   }
 
-  if (hunt_server_cmd(sptr, CMD_VERSION, cptr, 0, ":%C", 1, parc, parv) ==
-      HUNTED_ISME)
+  if (hunt_server_cmd(sptr, CMD_VERSION, cptr, HEAD_IN_SAND_REMOTE, ":%C", 1,
+                     parc, parv) == HUNTED_ISME)
   {
     char featurebuf[512];
     
index e82222e35144cb781fb75da8735a9aa51dec4fcf..d13124881d580875dc603e13d314acba8e8ebdb2 100644 (file)
@@ -95,6 +95,7 @@
 #include "ircd.h"
 #include "ircd_chattr.h"
 #include "ircd_log.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "match.h"
index 844a404de8c835b1244add5d8648702a82845121..be6a2ef33567a8cacda2aeeeec60ddef84234d57 100644 (file)
@@ -192,7 +192,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr)
   }
 
 #ifdef HEAD_IN_SAND_WHOIS_SERVERNAME
-  if (!IsAnOper(sptr) && sptr != a2cptr)
+  if (!IsAnOper(sptr) && sptr != acptr)
     send_reply(sptr, RPL_WHOISSERVER, name, "*.undernet.org",
               "The Undernet Underworld");
   else
@@ -359,7 +359,14 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      * it with the correct servername - as is needed by hunt_server().
      * This is the secret behind the /whois nick nick trick.
      */
+#if HEAD_IN_SAND_REMOTE
+    /* 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]);
+#endif
     if (acptr)
       parv[1] = cli_name(cli_user(acptr)->server);
     if (hunt_server_cmd(sptr, CMD_WHOIS, cptr, 0, "%C :%s", 1, parc, parv) !=
index 2b8faed92434c95211ec93826304285d9d3b6e8e..8090d0fdbebb420e48a559c06e372a777515e5c8 100644 (file)
@@ -92,6 +92,7 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
@@ -144,8 +145,14 @@ int m_whowas(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       {
        send_reply(sptr, RPL_WHOWASUSER, temp->name, temp->username,
                   temp->hostname, temp->realname);
-       send_reply(sptr, RPL_WHOISSERVER, temp->name, temp->servername,
-                  myctime(temp->logoff));
+#ifdef HEAD_IN_SAND_WHOIS_SERVERNAME
+       if (!IsOper(sptr))
+         send_reply(sptr, RPL_WHOISSERVER, temp->name, "*.undernet.org",
+                    myctime(temp->logoff));
+       else
+#endif
+         send_reply(sptr, RPL_WHOISSERVER, temp->name, temp->servername,
+                    myctime(temp->logoff));
         if (temp->away)
          send_reply(sptr, RPL_AWAY, temp->name, temp->away);
         cur++;
index 2fb84f419fc7b51e17dfe9c8ec8193196af7adb4..8d9602be122bbdd4216e6f7a8900f53ba7ab8978 100644 (file)
@@ -27,6 +27,7 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_policy.h"
 #include "ircd_snprintf.h"
 #include "numnicks.h"
 #include "send.h"
@@ -78,11 +79,28 @@ int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr,
 
   ircd_snprintf(0, num, sizeof(num), "%03d", numeric);
 
-  if (acptr)
-    sendcmdto_one(sptr, num, num, acptr, "%C %s", acptr, parv[2]);
-  else
-    sendcmdto_channel_butone(sptr, num, num, achptr, cptr,
-                            SKIP_DEAF | SKIP_BURST, "%H %s", achptr, parv[2]);
+#ifdef HEAD_IN_SAND_REWRITE
+  /* Since 2.10.10.pl14 we rewrite numerics from remote servers to appear to
+   * come from the local server
+   */
+  if (IsOper(acptr)) {
+#endif
+    if (acptr)
+      sendcmdto_one(sptr, num, num, acptr, "%C %s", acptr, parv[2]);
+    else
+      sendcmdto_channel_butone(sptr, num, num, achptr, cptr,
+                              SKIP_DEAF | SKIP_BURST, "%H %s", achptr,
+                              parv[2]);
+#ifdef HEAD_IN_SAND_REWRITE
+  } else {
+    if (acptr)
+      sendcmdto_one(&me, num, num, acptr, "%C %s", acptr, parv[2]);
+    else
+      sendcmdto_channel_butone(&me, num, num, achptr, cptr,
+                              SKIP_DEAF | SKIP_BURST, "%H %s", achptr,
+                              parv[2]);
+  }
+#endif
 
   return 0;
 }
index 8743ae45dcd2962450f61a1fa3335b29c974f482..a67fcf5e34117b5b302f361193961c189ce3cc6d 100644 (file)
@@ -181,7 +181,7 @@ void report_deny_list(struct Client* to)
  *          thusly once all the hubs have upgraded local opers will be able
  *          to remote stats anywhere on the network.
  */
-int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[], char stat)
+int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[], char stat, int MustBeOper)
 {
   switch (stat)
   {
@@ -190,8 +190,8 @@ int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[],
     case 'u':
     case 'F':
     case 'f':
-      return hunt_server_cmd(sptr, CMD_STATS, cptr, 0, "%s :%C", 2, parc,
-                            parv);
+      return hunt_server_cmd(sptr, CMD_STATS, cptr, MustBeOper, "%s :%C", 2,
+                            parc, parv);
 
     /* open to all, varying # of params */
     case 'k':
@@ -202,9 +202,11 @@ int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[],
     case 'P':
     {
       if (parc > 3)
-       return hunt_server_cmd(sptr, CMD_STATS, cptr, 0, "%s %C :%s", 2, parc, parv);
+       return hunt_server_cmd(sptr, CMD_STATS, cptr, MustBeOper, "%s %C :%s",
+                              2, parc, parv);
       else
-       return hunt_server_cmd(sptr, CMD_STATS, cptr, 0, "%s :%C", 2, parc, parv);
+       return hunt_server_cmd(sptr, CMD_STATS, cptr, MustBeOper, "%s :%C", 2,
+                              parc, parv);
     }
 
       /* oper only, varying # of params */
@@ -213,16 +215,24 @@ int hunt_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[],
     case 'M':
     {
       if (parc == 4)
-       return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s %C :%s", 2, parc, parv);
+       return hunt_server_cmd(sptr, CMD_STATS, cptr,
+                              MyUser(sptr) ? 1 : MustBeOper, "%s %C :%s", 2,
+                              parc, parv);
       else if (parc > 4)
-       return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s %C %s :%s", 2, parc, parv);
+       return hunt_server_cmd(sptr, CMD_STATS, cptr,
+                              MyUser(sptr) ? 1 : MustBeOper, "%s %C %s :%s",
+                              2, parc, parv);
       else 
-       return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s :%C", 2, parc, parv);
+       return hunt_server_cmd(sptr, CMD_STATS, cptr,
+                              MyUser(sptr) ? 1 : MustBeOper, "%s :%C", 2,
+                              parc, parv);
     }
 
       /* oper only, standard # of params */
     default:
-      return hunt_server_cmd(sptr, CMD_STATS, cptr, MyUser(sptr) ? 1 : 0, "%s :%C", 2, parc, parv);
+      return hunt_server_cmd(sptr, CMD_STATS, cptr,
+                            MyUser(sptr) ? 1 : MustBeOper, "%s :%C", 2, parc,
+                            parv);
   }
 }