ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/auth.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/auth.c (file contents):
Revision 4407 by michael, Sat Aug 2 16:53:22 2014 UTC vs.
Revision 4408 by michael, Wed Aug 6 21:19:38 2014 UTC

# Line 143 | Line 143 | release_auth_client(struct AuthRequest *
143   * of success of failure
144   */
145   static void
146 < auth_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name)
146 > auth_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name, size_t namelength)
147   {
148    struct AuthRequest *auth = vptr;
149  
150    ClearDNSPending(auth);
151  
152 <  if (name)
152 >  if (!EmptyString(name))
153    {
154      const struct sockaddr_in *v4, *v4dns;
155   #ifdef IPV6
156      const struct sockaddr_in6 *v6, *v6dns;
157 #endif
158    int good = 1;
157  
160 #ifdef IPV6
158      if (auth->client->localClient->ip.ss.ss_family == AF_INET6)
159      {
160        v6 = (const struct sockaddr_in6 *)&auth->client->localClient->ip;
# Line 166 | Line 163 | auth_dns_callback(void *vptr, const stru
163        if (memcmp(&v6->sin6_addr, &v6dns->sin6_addr, sizeof(struct in6_addr)) != 0)
164        {
165          sendheader(auth->client, REPORT_IP_MISMATCH);
166 <        good = 0;
166 >        release_auth_client(auth);
167 >        return;
168        }
169      }
170      else
# Line 178 | Line 176 | auth_dns_callback(void *vptr, const stru
176        if (v4->sin_addr.s_addr != v4dns->sin_addr.s_addr)
177        {
178          sendheader(auth->client, REPORT_IP_MISMATCH);
179 <        good = 0;
179 >        release_auth_client(auth);
180 >        return;
181        }
182      }
183  
184 <    if (good && strlen(name) <= HOSTLEN)
184 >    if (namelength > HOSTLEN)
185 >      sendheader(auth->client, REPORT_HOST_TOOLONG);
186 >    else
187      {
188 <      strlcpy(auth->client->host, name,
188 <              sizeof(auth->client->host));
188 >      strlcpy(auth->client->host, name, sizeof(auth->client->host));
189        sendheader(auth->client, REPORT_FIN_DNS);
190      }
191    else if (strlen(name) > HOSTLEN)
192      sendheader(auth->client, REPORT_HOST_TOOLONG);
191    }
192    else
193      sendheader(auth->client, REPORT_FAIL_DNS);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)