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; |
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 |
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); |