Add a flag to /stats that makes a /stats available to local opers.
authorMichael Poole <mdpoole@troilus.org>
Wed, 12 Oct 2005 01:13:48 +0000 (01:13 +0000)
committerMichael Poole <mdpoole@troilus.org>
Wed, 12 Oct 2005 01:13:48 +0000 (01:13 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1521 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/s_stats.h
ircd/m_stats.c
ircd/s_stats.c

index 89a7015fc75c7858bd6caded1caffe43606eb762..4aa2e867f6cbe60da493db669e7d38491e9b902f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-10-12  Perry Lorier <isomer@undernet.org>
+
+       * 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  <klmitch@mit.edu>
 
        * ircd/s_numeric.c (do_numeric): fix a crash when a numeric is
index 8408d9a243275c55cb555c3a34d107fa0ecaca3a..417e5c2a2b7af4b10a7ccbd09c689e3f05858f99 100644 (file)
@@ -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);
index 73cfe8196069da8a9be353cf16c20b35b5f4f0bd..fc3f0afc2f8324915faa1e1f50007a533598c493 100644 (file)
@@ -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];
index 6b390aae3f1d4f3c40738ca0b7b560f42c75beb8..22781148ae630202d8a92f77e6e96248763bb4a9 100644 (file)
@@ -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,