This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Undernet IRC Server Source Code.".

The branch, u2_10_12_branch has been updated
       via  ea8affeccd816b9093fbc1e27289a8073a358b3a (commit)
      from  7590bf782309d33dd9782590bd6bb8bad41568ea (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ea8affeccd816b9093fbc1e27289a8073a358b3a
Author: Michael Poole <[email protected]>
Date:   Wed Jan 11 22:55:33 2017 -0500

    webirc: Support "hidden = yes;" in conf to hide peer IP mask.

diff --git a/doc/example.conf b/doc/example.conf
index 03bf23c..bb62fe7 100644
--- a/doc/example.conf
+++ b/doc/example.conf
@@ -817,6 +817,7 @@ WebIRC {
  ip = "1.2.3.4";  # may be a netmask, e.g. 1.2.3.4/28
  password = "webirc-secret";
  description = "some webirc client";
+ hidden = yes; # hides IP in /stats webirc
 };
 
 # [features]
diff --git a/include/s_conf.h b/include/s_conf.h
index 8b7a024..d338965 100644
--- a/include/s_conf.h
+++ b/include/s_conf.h
@@ -89,6 +89,7 @@ struct wline
   struct irc_in_addr ip; /**< IP of webirc service. */
   unsigned char bits;    /**< Number of bits used in #ip. */
   unsigned char stale;   /**< Non-zero during config re-read. */
+  unsigned char hidden;  /**< If non-zero, hide IP in /stats webirc. */
   char *passwd;          /**< Password field. */
   char *description;     /**< Text description, e.g. for provider. */
 };
diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y
index 530b548..4516ed9 100644
--- a/ircd/ircd_parser.y
+++ b/ircd/ircd_parser.y
@@ -1172,7 +1172,11 @@ iauthprogram: PROGRAM '='
   }
 } stringlist ';';
 
-webircblock: WEBIRC '{' webircitems '}' ';'
+webircblock: WEBIRC
+{
+  flags = 0;
+}
+'{' webircitems '}' ';'
 {
   struct wline *wline;
   struct irc_in_addr peer;
@@ -1200,12 +1204,12 @@ webircblock: WEBIRC '{' webircitems '}' ';'
       wline = (struct wline *) MyMalloc(sizeof(*wline));
       memcpy(&wline->ip, &peer, sizeof(wline->ip));
       wline->bits = bits;
-      wline->stale = 0;
       wline->passwd = pass;
       wline->next = GlobalWebircList;
       GlobalWebircList = wline;
     }
     wline->stale = 0;
+    wline->hidden = (flags & 1) != 0;
     wline->description = name;
 
     MyFree(ip);
@@ -1216,7 +1220,8 @@ webircblock: WEBIRC '{' webircitems '}' ';'
 };
 
 webircitems: webircitem | webircitems webircitem;
-webircitem: webircip | webircpass | webircdesc;
+webircitem: webircip | webircpass | webircdesc | webirchidden;
 webircip: IP '=' QSTRING ';' { MyFree(ip); ip = $3; };
 webircpass: PASS '=' QSTRING ';' { MyFree(pass); pass = $3; };
 webircdesc: DESCRIPTION '=' QSTRING ';' { MyFree(name); name = $3; };
+webirchidden: HIDDEN '=' YES ';' { flags = flags | 1; }
diff --git a/ircd/s_stats.c b/ircd/s_stats.c
index 6cf5f0c..4fd64a6 100644
--- a/ircd/s_stats.c
+++ b/ircd/s_stats.c
@@ -511,7 +511,10 @@ stats_webirc(struct Client *to, const struct StatDesc *sd, 
char *param)
     const char *desc = wline->description;
     if (!desc)
       desc = "(no description provided)";
-    ircd_ntoa_r(ip_text, &wline->ip);
+    if (wline->hidden)
+      strcpy(ip_text, "*");
+    else
+      ircd_ntoa_r(ip_text, &wline->ip);
     send_reply(to, RPL_STATSWLINE, ip_text, wline->bits, desc);
   }
 }
-----------------------------------------------------------------------

Summary of changes:
 doc/example.conf   |    1 +
 include/s_conf.h   |    1 +
 ircd/ircd_parser.y |   11 ++++++++---
 ircd/s_stats.c     |    5 ++++-
 4 files changed, 14 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Undernet IRC Server Source Code.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to