Author: Michael Poole <mdpoole@troilus.org>
authorMichael Poole <mdpoole@troilus.org>
Tue, 13 Jan 2009 02:43:56 +0000 (02:43 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 13 Jan 2009 02:43:56 +0000 (02:43 +0000)
Description:

Fix SourceForge bug 2039740 (even local /gline additions count users
on remote servers towards the limit needed to force the G-line).

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

ChangeLog
ircd/gline.c

index 86a672d7870e7f2333bf0405808fb629cfb39876..15ba3b6f9b84f68bc0320ecb84a2a5f2c49dc61f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-12  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/gline.c (count_users): Accept "flags" mask to limit count
+       to local users.
+       (gline_add): Pass the flags to count_users().
+
 2009-01-12  Michael Poole <mdpoole@troilus.org>
 
        * include/gline.h (gline_forward_deactivation): Declare.
index 487dde94962d28779587bb39f5f7db5d69f4ff8d..adb745cad8e280ffe90193967e284e7b9480160f 100644 (file)
@@ -349,10 +349,11 @@ gline_propagate(struct Client *cptr, struct Client *sptr, struct Gline *gline)
 
 /** Count number of users who match \a mask.
  * @param[in] mask user\@host or user\@ip mask to check.
+ * @param[in] flags Bitmask possibly containing the value GLINE_LOCAL, to limit searches to this server.
  * @return Count of matching users.
  */
 static int
-count_users(char *mask)
+count_users(char *mask, int flags)
 {
   struct irc_in_addr ipmask;
   struct Client *acptr;
@@ -366,6 +367,8 @@ count_users(char *mask)
   for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) {
     if (!IsUser(acptr))
       continue;
+    if ((flags & GLINE_LOCAL) && !MyConnect(acptr))
+      continue;
 
     ircd_snprintf(0, namebuf, sizeof(namebuf), "%s@%s",
                  cli_user(acptr)->username, cli_user(acptr)->host);
@@ -485,7 +488,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
        break;
       }
 
-      if ((tmp = count_users(uhmask)) >=
+      if ((tmp = count_users(uhmask, flags)) >=
          feature_int(FEAT_GLINEMAXUSERCOUNT) && !(flags & GLINE_OPERFORCE))
        return send_reply(sptr, ERR_TOOMANYUSERS, tmp);
     }