From: Kevin L. Mitchell Date: Thu, 7 Jun 2001 21:09:51 +0000 (+0000) Subject: Author: Kev X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=284b39b15f53f438c7f1a28e7e3a10e2e25bac3b Author: Kev 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 --- diff --git a/ChangeLog b/ChangeLog index 738641e..921822f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,60 @@ 2001-06-07 Kevin L. Mitchell + * 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 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 diff --git a/include/ircd_policy.h b/include/ircd_policy.h index 849aab0..8f25e65 100644 --- a/include/ircd_policy.h +++ b/include/ircd_policy.h @@ -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 @@ -123,4 +123,18 @@ #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 */ diff --git a/include/s_stats.h b/include/s_stats.h index 49dfe01..17cc5ee 100644 --- a/include/s_stats.h +++ b/include/s_stats.h @@ -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); diff --git a/ircd/Makefile.in b/ircd/Makefile.in index 0a4f636..abc2f5b 100644 --- a/ircd/Makefile.in +++ b/ircd/Makefile.in @@ -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 \ diff --git a/ircd/channel.c b/ircd/channel.c index 38a5356..8ad3356 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -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... */ diff --git a/ircd/m_admin.c b/ircd/m_admin.c index 2ecd08f..f1c5fbb 100644 --- a/ircd/m_admin.c +++ b/ircd/m_admin.c @@ -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); diff --git a/ircd/m_burst.c b/ircd/m_burst.c index e91484e..1d4c1ec 100644 --- a/ircd/m_burst.c +++ b/ircd/m_burst.c @@ -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 */ diff --git a/ircd/m_lusers.c b/ircd/m_lusers.c index 764252d..d06ffdb 100644 --- a/ircd/m_lusers.c +++ b/ircd/m_lusers.c @@ -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, diff --git a/ircd/m_motd.c b/ircd/m_motd.c index f75cadf..a3cb47d 100644 --- a/ircd/m_motd.c +++ b/ircd/m_motd.c @@ -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" @@ -122,8 +123,8 @@ */ 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); diff --git a/ircd/m_nick.c b/ircd/m_nick.c index f532a89..5990ba6 100644 --- a/ircd/m_nick.c +++ b/ircd/m_nick.c @@ -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)); diff --git a/ircd/m_stats.c b/ircd/m_stats.c index d0bba30..bd6e590 100644 --- a/ircd/m_stats.c +++ b/ircd/m_stats.c @@ -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) diff --git a/ircd/m_time.c b/ircd/m_time.c index b02fa0f..e64ed4c 100644 --- a/ircd/m_time.c +++ b/ircd/m_time.c @@ -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" @@ -110,8 +111,8 @@ */ 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)); diff --git a/ircd/m_version.c b/ircd/m_version.c index 7eef88d..65c3426 100644 --- a/ircd/m_version.c +++ b/ircd/m_version.c @@ -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]; diff --git a/ircd/m_who.c b/ircd/m_who.c index e82222e..d131248 100644 --- a/ircd/m_who.c +++ b/ircd/m_who.c @@ -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" diff --git a/ircd/m_whois.c b/ircd/m_whois.c index 844a404..be6a2ef 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -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) != diff --git a/ircd/m_whowas.c b/ircd/m_whowas.c index 2b8faed..8090d0f 100644 --- a/ircd/m_whowas.c +++ b/ircd/m_whowas.c @@ -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++; diff --git a/ircd/s_numeric.c b/ircd/s_numeric.c index 2fb84f4..8d9602b 100644 --- a/ircd/s_numeric.c +++ b/ircd/s_numeric.c @@ -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; } diff --git a/ircd/s_stats.c b/ircd/s_stats.c index 8743ae4..a67fcf5 100644 --- a/ircd/s_stats.c +++ b/ircd/s_stats.c @@ -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); } }