---------- Forwarded message ----------
From: u2pop <[email protected]>
Date: Sat, Feb 28, 2009 at 11:32 AM
Subject: Help Please *BUG*
To: [email protected]


 HI, I WANT TO SAY SOMETHING THIS PATCH IS NOT WORKING PROPERLY FOR
IRCU2.10.12 AND WORK FINE FOR IRCU2.10.11 CAN BE POSIBLE IF CAN FIX THIS
LITTLE CODE FOR WORK IT TO THE NEW IRCU ? THANKS HERE IS THE PATCH..

-------------------------------------------------------------------------------------------------

Index: doc/example.conf
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/doc/example.conf,v
retrieving revision 1.15.2.7.4.3
diff -u -r1.15.2.7.4.3 example.conf
--- doc/example.conf    23 Nov 2002 12:19:27 -0000      1.15.2.7.4.3
+++ doc/example.conf    5 Dec 2002 11:11:45 -0000
@@ -365,6 +365,30 @@
 # Y:10:90:0:100:160000


+# [S:lines]
+# Opers may wish to hide their IP mask and hostname, even if they are on
+# a bnc. This can prevent the risk of opers or their providers getting
+# dos'd or whatever the case may be.
+#
+# When a client connects, his or her IP is compared to the incoming_IP in
+# each of the S:lines in the conf. If it finds an exact match (NOT a mask
+# match, but a simple comparison), it will substitute the client's ip with
+# modified_IP and the client's real hostname with modified_hostname (as
+# shown below).
+#
+# Syntax:
+# S:<incoming_IP>:<modified_IP>:<modifed_hostname>
+#
+# Example:
+# S:111.222.333.444:192.168.128.1:undernet.org
+#
+# If a user connects to the server with the IP 111.222.333.444, it is
+# automatically changed to 192.168.128.1 and the user's host is set to
+# undernet.org.
+#
+# If no modified_IP is provided, only the host is modified.
+
+
 # [P:lines]
 # When your server gets more full, you will notice delays when trying to
 # connect to your server's primary listening port. It is possible via the
Index: include/client.h
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/include/client.h,v
retrieving revision 1.23.2.4.8.2
diff -u -r1.23.2.4.8.2 client.h
--- include/client.h    23 Nov 2002 19:45:50 -0000      1.23.2.4.8.2
+++ include/client.h    5 Dec 2002 11:11:47 -0000
@@ -145,6 +145,7 @@
     FLAG_DEBUG,                     /* send global debug/anti-hack info */
     FLAG_ACCOUNT,                   /* account name has been set */
     FLAG_HIDDENHOST,                /* user's host is hidden */
+    FLAG_SLINE,                     /* user is S:Lined */

     _FLAG_COUNT,
     FLAG_LOCAL_UMODES = FLAG_LOCOP, /* First local mode flag */
@@ -429,6 +430,7 @@
 #define IsAccount(x)            HasFlag(x, FLAG_ACCOUNT)
 #define IsHiddenHost(x)                HasFlag(x, FLAG_HIDDENHOST)
 #define HasHiddenHost(x)       (IsAccount(x) && IsHiddenHost(x))
+#define HasSLine(x)             HasFlag(x, FLAG_SLINE)

 #define IsPrivileged(x)         (IsAnOper(x) || IsServer(x))

@@ -451,6 +453,7 @@
 #define SetService(x)           SetFlag(x, FLAG_SERVICE)
 #define SetAccount(x)           SetFlag(x, FLAG_ACCOUNT)
 #define SetHiddenHost(x)       SetFlag(x, FLAG_HIDDENHOST)
+#define SetSLined(x)            SetFlag(x, FLAG_SLINE)

 #define ClearAccess(x)          ClrFlag(x, FLAG_CHKACCESS)
 #define ClearBurst(x)           ClrFlag(x, FLAG_BURST)
Index: include/s_conf.h
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/include/s_conf.h,v
retrieving revision 1.15.2.1
diff -u -r1.15.2.1 s_conf.h
--- include/s_conf.h    17 May 2002 16:42:19 -0000      1.15.2.1
+++ include/s_conf.h    5 Dec 2002 11:11:48 -0000
@@ -33,6 +33,7 @@

 #define CONF_ILLEGAL            0x80000000
 #define CONF_MATCH              0x40000000
+#define CONF_SPOOF              0x20000000
 #define CONF_CLIENT             0x0002
 #define CONF_SERVER             0x0004
 #define CONF_LOCOP              0x0010
Index: ircd/s_auth.c
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/s_auth.c,v
retrieving revision 1.21.2.5
diff -u -r1.21.2.5 s_auth.c
--- ircd/s_auth.c       10 Jul 2002 16:22:47 -0000      1.21.2.5
+++ ircd/s_auth.c       5 Dec 2002 11:11:50 -0000
@@ -46,6 +46,7 @@
 #include "querycmds.h"
 #include "res.h"
 #include "s_bsd.h"
+#include "s_conf.h"
 #include "s_debug.h"
 #include "s_misc.h"
 #include "send.h"
@@ -82,6 +83,7 @@
   { "NOTICE AUTH :*** No ident response\r\n",              36 },
   { "NOTICE AUTH :*** Your forward and reverse DNS do not match, " \
     "ignoring hostname.\r\n",                              80 },
+  { "NOTICE AUTH :*** Using S-line privilege\r\n",         41 },
   { "NOTICE AUTH :*** Invalid hostname\r\n",               35 }
 };

@@ -94,6 +96,7 @@
   REPORT_FIN_ID,
   REPORT_FAIL_ID,
   REPORT_IP_MISMATCH,
+  REPORT_USING_SLINE,
   REPORT_INVAL_DNS
 } ReportType;

@@ -597,6 +600,13 @@
   struct AuthRequest* auth = 0;

   assert(0 != client);
+
+  if (conf_check_slines(client)) {
+    sendheader(client, REPORT_USING_SLINE);
+    SetSLined(client);
+    release_auth_client(client);
+    return;
+  }

   auth = make_auth_request(client);
   assert(0 != auth);
Index: ircd/s_conf.c
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/s_conf.c,v
retrieving revision 1.44.2.3.8.1
diff -u -r1.44.2.3.8.1 s_conf.c
--- ircd/s_conf.c       23 Nov 2002 19:05:09 -0000      1.44.2.3.8.1
+++ ircd/s_conf.c       5 Dec 2002 11:11:53 -0000
@@ -1158,6 +1158,10 @@
       conf_add_quarantine(field_vector, field_count);
       aconf->status = CONF_ILLEGAL;
       break;
+    case 'S':
+    case 's':
+      aconf->status = CONF_SPOOF;
+      break;
     case 'T':                /* print out different motd's */
     case 't':                /* based on hostmask - CONF_TLINES */
       motd_add(field_vector[1], field_vector[2]);
@@ -1260,6 +1264,9 @@
     if ((aconf->status == CONF_UWORLD) && (aconf->passwd) &&
(*aconf->passwd))
       addNickJupes(aconf->passwd);

+    if (aconf->status & CONF_SPOOF)
+      lookup_confhost(aconf);
+
     collapse(aconf->host);
     collapse(aconf->name);
     Debug((DEBUG_NOTICE,
@@ -1628,3 +1635,66 @@
   return 0;
 }

+/*
+ * conf_check_slines()
+ *
+ * Check S lines for the specified client, passed in cptr struct.
+ * If the client's IP is S-lined, process the substitution here.
+ * 1. cptr->cli_ip                    (cli_ip(cptr))
+ * 2. cptr->cli_connect->con_sock_ip  (cli_sock_ip(cptr))
+ * 3. cptr->cli_connect->sockhost     (cli_sockhost(cptr))
+ *
+ * If no substitued IP are specified, only change sockhost.
+ *
+ * Precondition
+ *  cptr != NULL
+ *
+ * Returns
+ *  0 = No S-line found
+ *  1 = S-line found and substitution done.
+ *
+ * -mbuna 9/2001
+ *
+ */
+
+int
+conf_check_slines(struct Client *cptr)
+{
+  struct ConfItem* aconf;
+  struct in_addr iptemp;
+  char* hostonly;
+
+  for (aconf = GlobalConfList; aconf; aconf = aconf->next) {
+    if (aconf->status != CONF_SPOOF)
+      continue;
+    if ((aconf->dns_pending)
+      || (INADDR_NONE == aconf->ipnum.s_addr)
+      || EmptyString(aconf->name))
+      continue;
+
+    if (cli_ip(cptr).s_addr == aconf->ipnum.s_addr) {
+
+                               /* Ignore user part if u...@h. */
+      if ((hostonly = strchr(aconf->name, '@')))
+        hostonly++;
+      else
+        hostonly = aconf->name;
+
+      if(!*hostonly)
+        continue;
+
+      if (!EmptyString(aconf->passwd)) {
+        iptemp.s_addr = inet_addr(aconf->passwd);
+        if (INADDR_NONE == iptemp.s_addr)
+          continue;
+        cli_ip(cptr).s_addr = iptemp.s_addr;
+      }
+
+                               /* Perform a luxurious ircd_ntoa for sanity.
*/
+      ircd_strncpy(cli_sock_ip(cptr), ircd_ntoa((const char*)
&cli_ip(cptr)), SOCKIPLEN);
+      ircd_strncpy(cli_sockhost(cptr), hostonly, HOSTLEN);
+      return 1;
+    }
+  }
+  return 0;
+}
Index: ircd/s_user.c
===================================================================
RCS file: /cvsroot/undernet-ircu/ircu2.10/ircd/s_user.c,v
retrieving revision 1.52.2.13.2.4
diff -u -r1.52.2.13.2.4 s_user.c
--- ircd/s_user.c       24 Nov 2002 19:16:14 -0000      1.52.2.13.2.4
+++ ircd/s_user.c       5 Dec 2002 11:11:57 -0000
@@ -421,7 +421,8 @@

     clean_user_id(user->username,
         HasFlag(sptr, FLAG_GOTID) ? cli_username(sptr) : username,
-        HasFlag(sptr, FLAG_DOID) && !HasFlag(sptr, FLAG_GOTID));
+        HasFlag(sptr, FLAG_DOID) && !HasFlag(sptr, FLAG_GOTID)
+        && !(HasSLine(sptr))); /* No tilde for S-lined users. */

     if ((user->username[0] == '\0')
         || ((user->username[0] == '~') && (user->username[1] == '\000')))



-- 
Stacy Brown
http://pfft.net/stacy
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to