Fix usermodes harder when they are set early during registration.
authorMichael Poole <mdpoole@troilus.org>
Fri, 31 Jul 2009 02:04:15 +0000 (02:04 +0000)
committerMichael Poole <mdpoole@troilus.org>
Fri, 31 Jul 2009 02:04:15 +0000 (02:04 +0000)
IAuth and /user can both set usermodes before registration is
complete, and we do not want to count unregistered clients as
invisible or as opers, so register_user() _must_ update UserStats when
it registers a client.  Default usermodes must not be applied between
where the client is marked as registered and that point, because that
would update UserStats too, so move the setting of default usermodes
before the SetUser() call that marks the client as a registered user.

Fixes SourceForge bugs #2824908 and #2829936.

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

ChangeLog
ircd/s_user.c

index 06a1d69e1e7df17c81a5753e239141796f1c2c28..734e05f0e2e671d8576cb99f08907832ff49e023 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-30  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/s_user.c (register_user): Move the default-usermodes call
+       to set_user_mode() to before SetUser(), so that the former does
+       not increment the UserStats fields.  Add back the explicit
+       adjustments to UserStats for invisible and opered clients.
+
 2009-07-05  Michael Poole <mdpoole@troilus.org>
 
        * ircd/s_user.c (register_user): Use correct parc for
index 97d3517a4b0f2ab3af63ed49755eb9bf72301488..a19691db7edd7cd6954c251be297d7a127ef5864 100644 (file)
@@ -355,6 +355,16 @@ int register_user(struct Client *cptr, struct Client *sptr)
 
     Count_unknownbecomesclient(sptr, UserStats);
 
+    /*
+     * Set user's initial modes
+     */
+    tmpstr = (char*)client_get_default_umode(sptr);
+    if (tmpstr) {
+      char *umodev[] = { NULL, NULL, NULL, NULL };
+      umodev[2] = tmpstr;
+      set_user_mode(cptr, sptr, 3, umodev, ALLOWMODES_ANY);
+    }
+
     SetUser(sptr);
     cli_handler(sptr) = CLIENT_HANDLER;
     SetLocalNumNick(sptr);
@@ -385,15 +395,6 @@ int register_user(struct Client *cptr, struct Client *sptr)
                            cli_info(sptr), NumNick(cptr) /* two %s's */);
 
     IPcheck_connect_succeeded(sptr);
-    /*
-     * Set user's initial modes
-     */
-    tmpstr = (char*)client_get_default_umode(sptr);
-    if (tmpstr) {
-      char *umodev[] = { NULL, NULL, NULL, NULL };
-      umodev[2] = tmpstr;
-      set_user_mode(cptr, sptr, 3, umodev, ALLOWMODES_ANY);
-    }
   }
   else {
     struct Client *acptr = user->server;
@@ -438,6 +439,10 @@ int register_user(struct Client *cptr, struct Client *sptr)
    */
   if (HasHiddenHost(sptr))
     hide_hostmask(sptr, FLAG_HIDDENHOST);
+  if (IsInvisible(sptr))
+    ++UserStats.inv_clients;
+  if (IsOper(sptr))
+    ++UserStats.opers;
 
   tmpstr = umode_str(sptr);
   /* Send full IP address to IPv6-grokking servers. */