Committer  : isomer
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-10-11 20:32:34 UTC

Modified files:
     ChangeLog include/s_stats.h ircd/m_stats.c ircd/s_stats.c

Log message:

Author:  Isomer <[EMAIL PROTECTED]>
Log message:

Add a flag to /stats that makes a /stats available to local opers.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.723 ircu2.10/ChangeLog:1.724
--- ircu2.10/ChangeLog:1.723    Mon Oct 10 05:18:11 2005
+++ ircu2.10/ChangeLog  Tue Oct 11 13:32:23 2005
@@ -1,3 +1,11 @@
+2005-10-12  Perry Lorier <[EMAIL PROTECTED]>
+
+       * 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  <[EMAIL PROTECTED]>
 
        * ircd/s_numeric.c (do_numeric): fix a crash when a numeric is
Index: ircu2.10/include/s_stats.h
diff -u ircu2.10/include/s_stats.h:1.12 ircu2.10/include/s_stats.h:1.13
--- ircu2.10/include/s_stats.h:1.12     Mon Oct  4 21:21:37 2004
+++ ircu2.10/include/s_stats.h  Tue Oct 11 13:32:24 2005
@@ -21,7 +21,7 @@
  */
 /** @file
  * @brief Report configuration lines and other statistics from this server.
- * @version $Id: s_stats.h,v 1.12 2004/10/05 04:21:37 entrope Exp $
+ * @version $Id: s_stats.h,v 1.13 2005/10/11 20:32:24 isomer Exp $
  */
 
 #ifndef INCLUDED_s_stats_h
@@ -55,8 +55,9 @@
 
 #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: ircu2.10/ircd/m_stats.c
diff -u ircu2.10/ircd/m_stats.c:1.31 ircu2.10/ircd/m_stats.c:1.32
--- ircu2.10/ircd/m_stats.c:1.31        Fri Dec 10 21:14:03 2004
+++ ircu2.10/ircd/m_stats.c     Tue Oct 11 13:32:24 2005
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_stats.c,v 1.31 2004/12/11 05:14:03 klmitch Exp $
+ * $Id: m_stats.c,v 1.32 2005/10/11 20:32:24 isomer Exp $
  */
 
 /*
@@ -137,6 +137,10 @@
        ((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: ircu2.10/ircd/s_stats.c
diff -u ircu2.10/ircd/s_stats.c:1.44 ircu2.10/ircd/s_stats.c:1.45
--- ircu2.10/ircd/s_stats.c:1.44        Sat Jun 18 18:37:59 2005
+++ ircu2.10/ircd/s_stats.c     Tue Oct 11 13:32:24 2005
@@ -62,7 +62,7 @@
 /** @file
  * @brief Report configuration lines and other statistics from this
  * server.
- * @version $Id: s_stats.c,v 1.44 2005/06/19 01:37:59 a1kmm Exp $
+ * @version $Id: s_stats.c,v 1.45 2005/10/11 20:32:24 isomer Exp $
  *
  * Note: The info is reported in the order the server uses
  *       it--not reversed as in ircd.conf!
@@ -525,7 +525,7 @@
 
 /** 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,
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to