Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-04-20 00:59:35 UTC

Modified files:
     ChangeLog ircd/m_whowas.c ircd/match.c ircd/s_conf.c

Log message:

Fix typos in match.c and m_whowas.c; add Kill checking for "ircd -k -c ..."

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.603 ircu2.10/ChangeLog:1.604
--- ircu2.10/ChangeLog:1.603    Mon Apr 18 17:55:31 2005
+++ ircu2.10/ChangeLog  Tue Apr 19 17:59:23 2005
@@ -1,5 +1,14 @@
 2005-04-18  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/match.c (check_if_ipmask): Fix brown-paper-bag typo.
+
+       * ircd/s_conf.c (conf_debug_iline): Look for matching Kill blocks
+       once a matching Client block is found.
+
+       * ircd/m_whowas.c (m_whowas): Change strcmp() to ircd_strcmp().
+
+2005-04-18  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/match.c (check_if_ipmask): Do not interpret masks that
        start with . or / as IP-based host masks.
 
Index: ircu2.10/ircd/m_whowas.c
diff -u ircu2.10/ircd/m_whowas.c:1.10 ircu2.10/ircd/m_whowas.c:1.11
--- ircu2.10/ircd/m_whowas.c:1.10       Fri Apr  8 20:37:15 2005
+++ ircu2.10/ircd/m_whowas.c    Tue Apr 19 17:59: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_whowas.c,v 1.10 2005/04/09 03:37:15 entrope Exp $
+ * $Id: m_whowas.c,v 1.11 2005/04/20 00:59:24 entrope Exp $
  */
 
 /*
@@ -138,7 +138,7 @@
       {
        send_reply(sptr, RPL_WHOWASUSER, temp->name, temp->username,
                   temp->hostname, temp->realname);
-        if (IsAnOper(sptr) && strcmp(temp->hostname, temp->realhost))
+        if (IsAnOper(sptr) && ircd_strcmp(temp->hostname, temp->realhost))
           send_reply(sptr, RPL_WHOISACTUALLY, temp->name, temp->username, 
temp->realhost);
         send_reply(sptr, RPL_WHOISSERVER, temp->name,
                    (feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsOper(sptr)) ?
Index: ircu2.10/ircd/match.c
diff -u ircu2.10/ircd/match.c:1.16 ircu2.10/ircd/match.c:1.17
--- ircu2.10/ircd/match.c:1.16  Mon Apr 18 17:55:32 2005
+++ ircu2.10/ircd/match.c       Tue Apr 19 17:59:24 2005
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Functions to match strings against IRC mask strings.
- * @version $Id: match.c,v 1.16 2005/04/19 00:55:32 entrope Exp $
+ * @version $Id: match.c,v 1.17 2005/04/20 00:59:24 entrope Exp $
  */
 #include "config.h"
 
@@ -878,7 +878,8 @@
   /* Given the bug that inspired this test, this may seem like a hasty
    * kludge.  It isn't: Wildcard characters should be matched from the
    * start, as when the username is the "interesting" part of the ban.
-   * Likewise, we cannot simply reject masks interpreted as */0.
+   * Likewise, we cannot simply reject masks interpreted as x/0 for
+   * all x.
    */
   if (mask[0] == '.' || mask[0] == '/')
     return 0;
Index: ircu2.10/ircd/s_conf.c
diff -u ircu2.10/ircd/s_conf.c:1.75 ircu2.10/ircd/s_conf.c:1.76
--- ircu2.10/ircd/s_conf.c:1.75 Sat Apr 16 19:57:57 2005
+++ ircu2.10/ircd/s_conf.c      Tue Apr 19 17:59:24 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief ircd configuration file driver
- * @version $Id: s_conf.c,v 1.75 2005/04/17 02:57:57 entrope Exp $
+ * @version $Id: s_conf.c,v 1.76 2005/04/20 00:59:24 entrope Exp $
  */
 #include "config.h"
 
@@ -421,15 +421,17 @@
 {
   struct irc_in_addr address;
   struct ConfItem *aconf;
+  struct DenyConf *deny;
   char *sep;
   unsigned short listener;
-  char username[USERLEN+1], hostname[HOSTLEN+1];
+  char username[USERLEN+1], hostname[HOSTLEN+1], realname[REALLEN+1];
 
   /* Initialize variables. */
   listener = 0;
   memset(&address, 0, sizeof(address));
   memset(&username, 0, sizeof(username));
   memset(&hostname, 0, sizeof(hostname));
+  memset(&realname, 0, sizeof(realname));
 
   /* Parse client specifier. */
   while (*client) {
@@ -462,6 +464,18 @@
         continue;
     }
 
+    /* Realname? */
+    if (client[0] == '$' && client[1] == 'R') {
+      client += 2;
+      for (tmp = 0; *client != '\0' && *client != ',' && tmp < REALLEN; 
++client, ++tmp) {
+        if (*client == '\\')
+          realname[tmp] = *++client;
+        else
+          realname[tmp] = *client;
+      }
+      continue;
+    }
+
     /* Else must be a hostname. */
     tmp = strcspn(client, ",");
     if (tmp > HOSTLEN)
@@ -496,11 +510,37 @@
             (aconf->host ? aconf->host : "(null)"),
             (aconf->name ? aconf->name : "(null)"),
             ConfClass(aconf), aconf->maximum,  aconf->passwd);
-    return aconf;
+    break;
   }
 
-  fprintf(stdout, "No matches found.\n");
-  return NULL;
+  /* If no authorization, say so and exit. */
+  if (!aconf)
+  {
+    fprintf(stdout, "No authorization found.\n");
+    return NULL;
+  }
+
+  /* Look for a Kill block with the user's name on it. */
+  for (deny = denyConfList; deny; deny = deny->next) {
+    if (deny->usermask && match(deny->usermask, username))
+      continue;
+    if (deny->realmask && match(deny->realmask, realname))
+      continue;
+    if (deny->bits > 0) {
+      if (!ipmask_check(&address, &deny->address, deny->bits))
+        continue;
+    } else if (deny->hostmask && match(deny->hostmask, hostname))
+      continue;
+
+    /* Looks like a match; report it. */
+    fprintf(stdout, "Denied! usermask=%s realmask=\"%s\" hostmask=%s 
(bits=%u)\n",
+            deny->usermask ? deny->usermask : "(null)",
+            deny->realmask ? deny->realmask : "(null)",
+            deny->hostmask ? deny->hostmask : "(null)",
+            deny->bits);
+  }
+
+  return aconf;
 }
 
 /** Check whether a particular ConfItem is already attached to a
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to