]> jfr.im git - irc/quakenet/snircd.git/blobdiff - ircd/s_stats.c
add sbounce from asuka into snircd tree
[irc/quakenet/snircd.git] / ircd / s_stats.c
index 2cc0fcd08c372d2b4468801e9184122bdeaf9163..7d13fbb2e4f558c07063bba8bf8adf745864442b 100644 (file)
@@ -43,6 +43,7 @@
 #include "numnicks.h"
 #include "querycmds.h"
 #include "res.h"
+#include "s_auth.h"
 #include "s_bsd.h"
 #include "s_conf.h"
 #include "s_debug.h"
@@ -62,7 +63,7 @@
 /** @file
  * @brief Report configuration lines and other statistics from this
  * server.
- * @version $Id: s_stats.c,v 1.44.2.2 2005/11/19 23:57:13 entrope Exp $
+ * @version $Id: s_stats.c,v 1.44.2.4 2006/03/14 14:56:50 entrope Exp $
  *
  * Note: The info is reported in the order the server uses
  *       it--not reversed as in ircd.conf!
@@ -109,6 +110,7 @@ stats_configured_links(struct Client *sptr, const struct StatDesc* sd,
        send_reply(sptr, RPL_STATSCLINE, name, port, maximum, hub_limit, get_conf_class(tmp));
       else if (tmp->status & CONF_CLIENT)
         send_reply(sptr, RPL_STATSILINE,
+                   (tmp->username ? tmp->username : ""), (tmp->username ? "@" : ""),
                    (tmp->host ? tmp->host : "*"), maximum,
                    (name[0] == ':' ? "0" : ""), (tmp->name ? tmp->name : "*"),
                    port, get_conf_class(tmp));
@@ -183,6 +185,7 @@ stats_access(struct Client *to, const struct StatDesc *sd, char *param)
            || (aconf->name && !match(param, aconf->name))))
     {
       send_reply(to, RPL_STATSILINE,
+                 (aconf->username ? aconf->username : ""), (aconf->username ? "@" : ""), 
                  (aconf->host ? aconf->host : "*"), aconf->maximum,
                  (aconf->name && aconf->name[0] == ':' ? "0":""),
                  aconf->name ? aconf->name : "*",
@@ -397,6 +400,44 @@ stats_quarantine(struct Client* to, const struct StatDesc* sd, char* param)
   }
 }
 
+static void
+stats_sline(struct Client* to, const struct StatDesc* sd, char* param)
+{
+  int y = 1, i = 1;
+  struct sline *sline;
+
+  if (IsAnOper(to))
+    send_reply(to, SND_EXPLICIT | RPL_TEXT, "# Type Spoofhost Realhost Ident");
+  else
+    send_reply(to, SND_EXPLICIT | RPL_TEXT, "# Type Spoofhost");
+
+  for (sline = GlobalSList; sline; sline = sline->next) {
+    if (param && match(param, sline->spoofhost)) { /* narrow search */
+      if (IsAnOper(to))
+          y++;
+      else
+        if (!EmptyString(sline->passwd))
+          y++;
+      continue;
+    }
+
+    if (IsAnOper(to)) {
+      send_reply(to, RPL_STATSSLINE, (param) ? y : i, 
+         (EmptyString(sline->passwd)) ? "oper" : "user",
+         sline->spoofhost, 
+         (EmptyString(sline->realhost)) ? "" : sline->realhost,
+         (EmptyString(sline->username)) ? "" : sline->username);
+      i++;
+    } else {
+      if (!EmptyString(sline->passwd)) {
+        send_reply(to, RPL_STATSSLINE, (param) ? y : i, "user", sline->spoofhost,
+           "", "", "");
+        i++;
+      }
+    }
+  }
+}
+
 /** List service pseudo-command mappings.
  * @param[in] to Client requesting statistics.
  * @param[in] sd Stats descriptor for request (ignored).
@@ -587,6 +628,9 @@ struct StatDesc statsinfo[] = {
     send_usage, 0,
     "System resource usage (Debug only)." },
 #endif
+  { 's', "spoofhosts", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_s,
+    stats_sline, 0,
+    "Spoofed hosts information." },
   { 'T', "motds", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_T,
     motd_report, 0,
     "Configured Message Of The Day files." },
@@ -617,6 +661,12 @@ struct StatDesc statsinfo[] = {
   { 'z', "memory", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_z,
     count_memory, 0,
     "Memory/Structure allocation information." },
+  { ' ', "iauth", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_IAUTH,
+    report_iauth_stats, 0,
+    "IAuth statistics." },
+  { ' ', "iauthconf", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_IAUTH,
+    report_iauth_conf, 0,
+    "IAuth configuration." },
   { '*', "help", STAT_FLAG_CASESENS, FEAT_LAST_F,
     stats_help, 0,
     "Send help for stats." },