This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Undernet IRC Server Source Code.".

The branch, u2_10_12_branch has been updated
       via  dc983eff145c2f5c8257fa671800cd1b4374c4e2 (commit)
      from  e87968492c8dedc49ee27e2b7904f1c8aef270a7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dc983eff145c2f5c8257fa671800cd1b4374c4e2
Author: Michael Poole <mdpo...@troilus.org>
Date:   Tue Oct 18 23:52:14 2016 -0400

    check_auth_finished: Fix refactoring bugs.
    
    Early exit until we can (and do) check G-lines.
    If the client isn't booted for a G/K-line, tell IAuth what we know.
    Call auth_set_username() just before registering user, like we did before
    the (buggy) refactoring in commit a22917fd ("s_auth: Check G-lines before
    IAuth.").

diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index 665d9c5..6416d06 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -87,6 +87,7 @@ enum AuthRequestFlag {
     AR_IAUTH_FUSERNAME, /**< iauth sent a forced username */
     AR_IAUTH_SOFT_DONE, /**< iauth has no objection to client */
     AR_PASSWORD_CHECKED, /**< client password already checked */
+    AR_GLINE_CHECKED,   /**< checked for a G-line banning the client */
     AR_NUM_FLAGS
 };
 
@@ -433,30 +434,34 @@ static int check_auth_finished(struct AuthRequest *auth, 
int bitclr)
   if (bitclr != AR_IAUTH_SOFT_DONE)
     FlagClr(&auth->flags, bitclr);
 
-  /* Should we set (or update) the client's username? */
-  if ((bitclr == AR_AUTH_PENDING) && IsUserPort(auth->client))
+  if (!FlagHas(&auth->flags, AR_GLINE_CHECKED))
   {
-    res = auth_set_username(auth);
-    if (res)
-      return res;
-  }
+    struct Client *sptr;
+    int killreason;
 
-  /* Did this affect username and/or hostname?
-   * If so, and we have both of those, we should look for a matching
-   * G-line or Kill block.
-   */
-  if (((bitclr == AR_AUTH_PENDING) || (bitclr == AR_DNS_PENDING))
-      && !FlagHas(&auth->flags, AR_AUTH_PENDING)
-      && !FlagHas(&auth->flags, AR_DNS_PENDING))
-  {
-    struct Client *sptr = auth->client;
-    int killreason = find_kill(sptr);
+    /* Bail out until we have DNS and ident. */
+    if (FlagHas(&auth->flags, AR_AUTH_PENDING)
+        || FlagHas(&auth->flags, AR_DNS_PENDING))
+      return 0;
+
+    /* Check for K- or G-line. */
+    sptr = auth->client;
+    FlagSet(&auth->flags, AR_GLINE_CHECKED);
+    killreason = find_kill(sptr);
     if (killreason)
     {
       ServerStats->is_ref++;
       return exit_client(sptr, sptr, &me,
                          (killreason == -1 ? "K-lined" : "G-lined"));
     }
+
+    /* Tell IAuth about the client. */
+    iauth_notify(auth, AR_DNS_PENDING);
+    iauth_notify(auth, AR_AUTH_PENDING);
+    if (!FlagHas(&auth->flags, AR_NEEDS_USER))
+      iauth_notify(auth, AR_NEEDS_USER);
+    if (!FlagHas(&auth->flags, AR_NEEDS_NICK))
+      iauth_notify(auth, AR_NEEDS_NICK);
   }
 
   /* Check non-iauth registration blocking flags. */
@@ -529,7 +534,9 @@ static int check_auth_finished(struct AuthRequest *auth, 
int bitclr)
   if (IsUserPort(auth->client))
   {
     memset(cli_passwd(auth->client), 0, sizeof(cli_passwd(auth->client)));
-    res = register_user(auth->client, auth->client);
+    res = auth_set_username(auth);
+    if (res == 0)
+      res = register_user(auth->client, auth->client);
     /* Notify IAuth (if appropriate). */
     if ((res == 0) && !from_iauth)
       iauth_notify(auth, (enum AuthRequestFlag)bitclr);
-----------------------------------------------------------------------

Summary of changes:
 ircd/s_auth.c |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Undernet IRC Server Source Code.
_______________________________________________
Patches mailing list
Patches@undernet.org
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to