Fix typos in match.c and m_whowas.c; add Kill checking for "ircd -k -c ..."
authorMichael Poole <mdpoole@troilus.org>
Wed, 20 Apr 2005 00:59:24 +0000 (00:59 +0000)
committerMichael Poole <mdpoole@troilus.org>
Wed, 20 Apr 2005 00:59:24 +0000 (00:59 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1371 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_whowas.c
ircd/match.c
ircd/s_conf.c

index f0dd632e447aa7eac8a621a499108152f21f5ad7..02060989f43dc863a9c3b7011e4121059fe26edb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-04-18  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * ircd/match.c (check_if_ipmask): Do not interpret masks that
index b24e5c49304c6955178e2da7d782777f4bd69d65..9c8046123f240e6014dd85821b4adfabb61bcf9c 100644 (file)
@@ -138,7 +138,7 @@ int m_whowas(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       {
        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 f2074f63b7f7b9304fbdb4a329961587a45c296b..cd754231e0137e4f2af62705435f881400d53799 100644 (file)
@@ -878,7 +878,8 @@ int check_if_ipmask(const char *mask)
   /* 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 51c0971cafda3d0c6aa76c32e3ff7ff3bafa8b9f..85fdccc7d82e75b632288843eb3f0b7d7cfff453 100644 (file)
@@ -421,15 +421,17 @@ struct ConfItem *conf_debug_iline(const char *client)
 {
   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 @@ struct ConfItem *conf_debug_iline(const char *client)
         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 @@ struct ConfItem *conf_debug_iline(const char *client)
             (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