Fix assertion failures and other misbehaviors in new auth code.
authorMichael Poole <mdpoole@troilus.org>
Thu, 25 May 2006 03:14:13 +0000 (03:14 +0000)
committerMichael Poole <mdpoole@troilus.org>
Thu, 25 May 2006 03:14:13 +0000 (03:14 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1659 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/s_auth.c

index 97e3e50ab4aee0c914c48e7f11a9abd94645960e..c0b01a66641cbcc3a942350a37ee6637d32db10a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-24  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/s_auth.c (auth_dns_callback): Be more careful about
+       handling failed DNS lookups.  Use a more standard function to
+       disconnect clients for IP mismatches.
+       (start_auth): Use a more standard function to disconnect clients
+       for peer or local socket address lookup failures.
+
 2006-05-17  Michael Poole <mdpoole@troilus.org>
 
        * ircd/s_auth.c (auth_ping_timeout): Fix off-by-one error.
index a9fe0cd7b576effdb7db04ff96cf75c76af55aaf..749dbf461bb2352e1af1bd46060e63623653afc0 100644 (file)
@@ -820,21 +820,18 @@ static void auth_dns_callback(void* vptr, const struct irc_in_addr *addr, const
     if (IsUserPort(auth->client))
       sendheader(auth->client, REPORT_FAIL_DNS);
     sendto_iauth(auth->client, "d");
-  } else if (irc_in_addr_cmp(addr, &cli_ip(auth->client))
-             && irc_in_addr_cmp(addr, &auth->original)) {
+  } else if (!irc_in_addr_valid(addr)
+             || (irc_in_addr_cmp(&cli_ip(auth->client), addr)
+                 && irc_in_addr_cmp(&auth->original, addr))) {
     /* IP for hostname did not match client's IP. */
     sendto_opmask_butone(0, SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%s]",
                          cli_sock_ip(auth->client), h_name,
                          ircd_ntoa(addr));
     if (IsUserPort(auth->client))
       sendheader(auth->client, REPORT_IP_MISMATCH);
-    /* Clear DNS pending flag so free_client doesn't ask the resolver
-     * to delete the query that just finished.
-     */
     if (feature_bool(FEAT_KILL_IPMISMATCH)) {
-      IPcheck_disconnect(auth->client);
-      Count_unknowndisconnects(UserStats);
-      free_client(auth->client);
+      exit_client(auth->client, auth->client, &me, "IP mismatch");
+      return;
     }
   } else if (!auth_verify_hostname(h_name, HOSTLEN)) {
     /* Hostname did not look valid. */
@@ -973,9 +970,7 @@ void start_auth(struct Client* client)
     ++ServerStats->is_abad;
     if (IsUserPort(auth->client))
       sendheader(auth->client, REPORT_FAIL_ID);
-    IPcheck_disconnect(auth->client);
-    Count_unknowndisconnects(UserStats);
-    free_client(auth->client);
+    exit_client(auth->client, auth->client, &me, "Socket local/peer lookup failed");
     return;
   }
   auth->port = remote.port;