Author: Alex Badea <vampire@p16.pub.ro> (by way of Kev <klmitch@mit.edu>)
authorKevin L. Mitchell <klmitch@mit.edu>
Wed, 3 Apr 2002 15:23:48 +0000 (15:23 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Wed, 3 Apr 2002 15:23:48 +0000 (15:23 +0000)
Log message:

Fix bug 43, where /who %i would reveal IP addresses for hidden hosts.  Also
fixed searching on those IP addresses...

(pull-up from u2_10_11 branch)

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@711 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
doc/example.conf
doc/readme.features
include/ircd_features.h
include/s_user.h
ircd/ircd_features.c
ircd/m_userhost.c
ircd/m_userip.c
ircd/m_who.c
ircd/s_user.c
ircd/whocmds.c

index 736291ddacd5f8e42b079e78969377d4e1c34f37..bc1c51214bed7008aad407f82618320b2455f703 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2002-04-03  Alex Badea  <vampire@p16.pub.ro>
+
+       * include/s_user.h: added a sptr parameter to InfoFormatter
+       function type
+
+       * ircd/m_who.c: don't match IPs for clients which have a hidden host,
+       except when the inquiring user is an oper
+
+       * ircd/whocmds.c: show the fake IP from FEAT_HIDDEN_IP if the
+       target has a hidden host, but show real IP to opers
+
+       * ircd/m_userip.c (userip_formatter): add sptr parameter; show the
+       fake IP from FEAT_HIDDEN_IP if the target has a hidden host, but
+       show real IP to opers
+
+       * ircd/m_userhost.c (userhost_formatter): add (unused) sptr parameter
+
+       * ircd/s_user.c (send_user_info): pass sptr to the formatting function
+
+       * include/ircd_features.h: new feature FEAT_HIDDEN_IP (stores which
+       fake IP to show for clients with a hidden host)
+
+       * ircd/ircd_features.c: new feature FEAT_HIDDEN_IP
+
+       * doc/example.conf: default value for FEAT_HIDDEN_IP
+
+       * doc/readme.features: documented FEAT_HIDDEN_IP
+
 2002-04-03 Andrew Miller <a1kmm@mware.virtualave.net>
        * doc/example.conf: Cleaned up some comments that ended up in
          strange places due to problems in the merge process.
index 0e1e2ace770a4e8bec350ef0fa4b8bb308efabec..3fec2e3101b1797807a1a7aaf3d3bec36ff78560 100644 (file)
@@ -701,6 +701,7 @@ features
 #  "NICKNAMEHISTORYLENGTH"="800";
 #  "HOST_HIDING"="FALSE";
 #  "HIDDEN_HOST"="users.undernet.org";
+#  "HIDDEN_IP"="127.0.0.1";
 #  "KILLCHASETIMELIMIT"="30";
 #  "MAXCHANNELSPERUSER"="10";
 #  "AVBANLEN"="40";
index 4faac706c65f9517d5393d3c3c43bf501a0fdd99..5d9aea641d87b75f8cd66407061a6bec55861190 100644 (file)
@@ -235,6 +235,13 @@ HIDDEN_HOST
 
 This selects the suffix for the hidden hostmask (see HOST_HIDING).
 
+HIDDEN_IP
+ * Type: string
+ * Default: 127.0.0.1
+
+This selects a fake IP to be shown on /USERIP and /WHO %i when the
+target has a hidden host (see HOST_HIDING).
+
 KILLCHASETIMELIMIT
  * Type: integer
  * Default: 30
index 82397bb9c400ce68f3f75f826525d968aedfb09f..b2745122d16e89710540c34ebdb76650c33d8b4a 100644 (file)
@@ -44,6 +44,7 @@ enum Feature {
   FEAT_NICKNAMEHISTORYLENGTH,
   FEAT_HOST_HIDING,
   FEAT_HIDDEN_HOST,
+  FEAT_HIDDEN_IP,
 
   /* features that probably should not be touched */
   FEAT_KILLCHASETIMELIMIT,
index f9d9e4cb3ce18ec796da964a63c5ed94553e7f0c..5615abb5cd63c81a3c7e103847de6b75dd11d6e1 100644 (file)
@@ -49,7 +49,7 @@ struct MsgBuf;
 
 extern struct SLink *opsarray[];
 
-typedef void (*InfoFormatter)(struct Client* who, struct MsgBuf* buf);
+typedef void (*InfoFormatter)(struct Client* who, struct Client *sptr, struct MsgBuf* buf);
 
 /*
  * Prototypes
index f46c48e54aeb0031f13313e685e1848cf1805d70..2c4b9667ebd41e1d9f49833eeea5189e379c18cd 100644 (file)
@@ -251,6 +251,7 @@ static struct FeatureDesc {
   F_I(NICKNAMEHISTORYLENGTH, 0, 800, whowas_realloc),
   F_B(HOST_HIDING, 0, 0, 0),
   F_S(HIDDEN_HOST, FEAT_CASE, "users.undernet.org", 0),
+  F_S(HIDDEN_IP, 0, "127.0.0.1", 0),
 
   /* features that probably should not be touched */
   F_I(KILLCHASETIMELIMIT, 0, 30, 0),
index cf862e94ba5664b0004dec9a1927d10068155489..694b11190eb633f9fdf432f7436cf4e6c40e76af 100644 (file)
@@ -91,7 +91,7 @@
 
 #include <assert.h>
 
-static void userhost_formatter(struct Client* cptr, struct MsgBuf* mb)
+static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb)
 {
   assert(IsUser(cptr));
   msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr),
index a42cbcc48acf53f1c2888e4f47d9b8fc2ef3d30a..27be218c77b9cd9dfc4686ed306fea504260a391 100644 (file)
@@ -84,6 +84,7 @@
 #include "client.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
+#include "ircd_features.h"
 #include "msgq.h"
 #include "numeric.h"
 #include "s_user.h"
 
 #include <assert.h>
 
-static void userip_formatter(struct Client* cptr, struct MsgBuf* mb)
+static void userip_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb)
 {
   assert(IsUser(cptr));
   msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr),
              HasPriv(cptr, PRIV_DISPLAY) ? "*" : "",
              cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username,
-             HasHiddenHost(cptr) ? "127.0.0.1" :
+             HasHiddenHost(cptr) && !IsAnOper(sptr) ?
+             feature_str(FEAT_HIDDEN_IP) :
              ircd_ntoa((const char*) &(cli_ip(cptr))));
 }
 
index 06226678197bbcc99a45d0af756595f1287cfd0a..271946b748279209f256abed6d9e1d6188cabf26 100644 (file)
@@ -401,6 +401,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
               && ((!(matchsel & WHO_FIELD_REN))
               || matchexec(cli_info(acptr), mymask, minlen))
               && ((!(matchsel & WHO_FIELD_NIP))
+             || (HasHiddenHost(acptr) && !IsAnOper(sptr))
               || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) !=
               imask.bits.s_addr)) || (imask.fall
               && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen)))))
@@ -440,6 +441,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
             && ((!(matchsel & WHO_FIELD_REN))
             || matchexec(cli_info(acptr), mymask, minlen))
             && ((!(matchsel & WHO_FIELD_NIP))
+           || (HasHiddenHost(acptr) && !IsAnOper(sptr))
             || ((((cli_ip(acptr).s_addr & imask.mask.s_addr) != imask.bits.s_addr))
             || (imask.fall
             && matchexec(ircd_ntoa((const char*) &(cli_ip(acptr))), mymask, minlen)))))
index 2e7b49c8d6fb1435d7e7136c27e9d0cea5752cda..467bea6a370ce4045b8984160a4383472af205c9 100644 (file)
@@ -1036,7 +1036,7 @@ void send_user_info(struct Client* sptr, char* names, int rpl, InfoFormatter fmt
     if ((acptr = FindUser(name))) {
       if (users_found++)
        msgq_append(0, mb, " ");
-      (*fmt)(acptr, mb);
+      (*fmt)(acptr, sptr, mb);
     }
     if (5 == ++arg_count)
       break;
index 1f4fb1af1a7f5b764a16ed0d332c9ae54d2ab6c8..fa8def4b5be396fc45af8c3d7f2529d9c7bc837d 100644 (file)
@@ -122,7 +122,9 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
 
   if (fields & WHO_FIELD_NIP)
   {
-    const char* p2 = ircd_ntoa((const char*) &(cli_ip(acptr)));
+    const char* p2 = HasHiddenHost(acptr) && !IsAnOper(sptr) ?
+      feature_str(FEAT_HIDDEN_IP) :
+      ircd_ntoa((const char*) &(cli_ip(acptr)));
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }