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  02d41e2b32b30865d07ad123f6afaf9c1a6060f9 (commit)
      from  9122e6f50e7f672a3c034be9f8f205a8b610ded8 (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 02d41e2b32b30865d07ad123f6afaf9c1a6060f9
Author: Michael Poole <[email protected]>
Date:   Mon Nov 28 23:33:58 2016 -0500

    s_auth: Properly match against ~<foo>@<whatever> G-lines.
    
    cli_user(auth->client)->username was not being set when identd failed.
    To set it properly, we need to assign a Client block (which needs DNS
    and identd results).  Rearrange code to do that.

diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index 6416d06..0a1bf1a 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -267,19 +267,7 @@ static int auth_set_username(struct AuthRequest *auth)
   {
     clean_username(user->username, cli_username(sptr));
   }
-  else if (HasFlag(sptr, FLAG_DOID))
-  {
-    /* Prepend ~ to user->username. */
-    s = user->username;
-    s[USERLEN] = '\0';
-    for (last = '~'; (ch = *s) != '\0'; )
-    {
-      *s++ = last;
-      last = ch;
-    }
-    *s++ = last;
-    *s = '\0';
-  } /* else cleaned version of client-provided name is in place */
+  /* else username was set by identd lookup (or failure thereof) */
 
   /* If username is empty or just ~, reject. */
   if ((user->username[0] == '\0')
@@ -436,6 +424,7 @@ static int check_auth_finished(struct AuthRequest *auth, 
int bitclr)
 
   if (!FlagHas(&auth->flags, AR_GLINE_CHECKED))
   {
+    struct User   *user;
     struct Client *sptr;
     int killreason;
 
@@ -444,8 +433,34 @@ static int check_auth_finished(struct AuthRequest *auth, 
int bitclr)
         || FlagHas(&auth->flags, AR_DNS_PENDING))
       return 0;
 
-    /* Check for K- or G-line. */
+    /* If appropriate, do preliminary assignment to Client block. */
+    if (IsUserPort(auth->client)
+        && preregister_user(auth->client))
+      return CPTR_KILLED;
+
+    /* Copy username to struct User.username for kill checking. */
     sptr = auth->client;
+    user = cli_user(sptr);
+    if (IsIdented(sptr))
+    {
+      clean_username(user->username, cli_username(sptr));
+    }
+    else if (HasFlag(sptr, FLAG_DOID))
+    {
+      /* Prepend ~ to user->username. */
+      char *s = user->username;
+      char last, ch;
+      s[USERLEN] = '\0';
+      for (last = '~'; (ch = *s) != '\0'; )
+      {
+        *s++ = last;
+        last = ch;
+      }
+      *s++ = last;
+      *s = '\0';
+    } /* else cleaned version of client-provided name is in place */
+
+    /* Check for K- or G-line. */
     FlagSet(&auth->flags, AR_GLINE_CHECKED);
     killreason = find_kill(sptr);
     if (killreason)
@@ -477,12 +492,6 @@ static int check_auth_finished(struct AuthRequest *auth, 
int bitclr)
     }
   }
 
-  /* If appropriate, do preliminary assignment to connection class. */
-  if (IsUserPort(auth->client)
-      && !FlagHas(&auth->flags, AR_IAUTH_HURRY)
-      && preregister_user(auth->client))
-    return CPTR_KILLED;
-
   /* If we have not done so, check client password.  Do this as soon
    * as possible so that iauth's challenge/response (which uses PASS
    * for responses) is not confused with the client's password.
-----------------------------------------------------------------------

Summary of changes:
 ircd/s_auth.c |   49 +++++++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 20 deletions(-)


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

Reply via email to