From 5f2367c5194f03c97e43fea0a331257ad8192fb6 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Wed, 12 Oct 2005 01:13:48 +0000 Subject: [PATCH] Add a flag to /stats that makes a /stats available to local opers. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1521 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 8 ++++++++ include/s_stats.h | 5 +++-- ircd/m_stats.c | 4 ++++ ircd/s_stats.c | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89a7015..4aa2e86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-10-12 Perry Lorier + + * include/s_stats.h: Add new "Local" only flag to /stats. + + * ircd/m_stats.c: Consult it. + + * ircd/s_stats.c: Use the flag. + 2004-01-04 Kevin L Mitchell * ircd/s_numeric.c (do_numeric): fix a crash when a numeric is diff --git a/include/s_stats.h b/include/s_stats.h index 8408d9a..417e5c2 100644 --- a/include/s_stats.h +++ b/include/s_stats.h @@ -55,8 +55,9 @@ struct StatDesc #define STAT_FLAG_OPERONLY 0x01 /**< Oper-only stat */ #define STAT_FLAG_OPERFEAT 0x02 /**< Oper-only if the feature is true */ -#define STAT_FLAG_CASESENS 0x04 /**< Flag is case-sensitive */ -#define STAT_FLAG_VARPARAM 0x08 /**< May have an extra parameter */ +#define STAT_FLAG_LOCONLY 0x04 /**< Local user only */ +#define STAT_FLAG_CASESENS 0x08 /**< Flag is case-sensitive */ +#define STAT_FLAG_VARPARAM 0x10 /**< May have an extra parameter */ extern void stats_init(void); const struct StatDesc *stats_find(const char *name_or_char); diff --git a/ircd/m_stats.c b/ircd/m_stats.c index 73cfe81..fc3f0af 100644 --- a/ircd/m_stats.c +++ b/ircd/m_stats.c @@ -137,6 +137,10 @@ m_stats(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) ((sd->sd_flags & STAT_FLAG_OPERFEAT) && feature_bool(sd->sd_control)))) return send_reply(cptr, ERR_NOPRIVILEGES); + /* Check if they are a local user */ + if ((sd->sd_flags & STAT_FLAG_LOCONLY) && !MyUser(cptr)) + return send_reply(cptr, ERR_NOPRIVILEGES); + /* Check for extra parameter */ if ((sd->sd_flags & STAT_FLAG_VARPARAM) && parc > 3 && !EmptyString(parv[3])) param = parv[3]; diff --git a/ircd/s_stats.c b/ircd/s_stats.c index 6b390aa..2278114 100644 --- a/ircd/s_stats.c +++ b/ircd/s_stats.c @@ -525,7 +525,7 @@ stats_help(struct Client* to, const struct StatDesc* sd, char* param) /** Contains information about all statistics. */ struct StatDesc statsinfo[] = { - { 'a', "nameservers", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_a, + { 'a', "nameservers", STAT_FLAG_OPERFEAT|STAT_FLAG_LOCONLY, FEAT_HIS_STATS_a, report_dns_servers, 0, "DNS servers." }, { 'c', "connect", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_c, -- 2.20.1