167 |
|
* if successful save hp in the conf item it was called with |
168 |
|
*/ |
169 |
|
static void |
170 |
< |
conf_dns_callback(void *vptr, struct DNSReply *reply) |
170 |
> |
conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name) |
171 |
|
{ |
172 |
|
struct AccessItem *aconf = (struct AccessItem *)vptr; |
173 |
|
struct ConfItem *conf; |
174 |
|
|
175 |
< |
MyFree(aconf->dns_query); |
176 |
< |
aconf->dns_query = NULL; |
175 |
> |
aconf->dns_pending = 0; |
176 |
|
|
177 |
< |
if (reply != NULL) |
178 |
< |
memcpy(&aconf->ipnum, &reply->addr, sizeof(reply->addr)); |
179 |
< |
else { |
180 |
< |
ilog(L_NOTICE, "Host not found: %s, ignoring connect{} block", |
182 |
< |
aconf->host); |
183 |
< |
conf = unmap_conf_item(aconf); |
184 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
185 |
< |
"Ignoring connect{} block for %s - host not found", |
186 |
< |
conf->name); |
187 |
< |
delete_conf_item(conf); |
188 |
< |
} |
177 |
> |
if (addr != NULL) |
178 |
> |
memcpy(&aconf->ipnum, addr, sizeof(aconf->ipnum)); |
179 |
> |
else |
180 |
> |
aconf->dns_failed = 1; |
181 |
|
} |
182 |
|
|
183 |
|
/* conf_dns_lookup() |
189 |
|
static void |
190 |
|
conf_dns_lookup(struct AccessItem *aconf) |
191 |
|
{ |
192 |
< |
if (aconf->dns_query == NULL) |
192 |
> |
if (!aconf->dns_pending) |
193 |
|
{ |
194 |
< |
aconf->dns_query = MyMalloc(sizeof(struct DNSQuery)); |
195 |
< |
aconf->dns_query->ptr = aconf; |
204 |
< |
aconf->dns_query->callback = conf_dns_callback; |
205 |
< |
gethost_byname(aconf->host, aconf->dns_query); |
194 |
> |
aconf->dns_pending = 1; |
195 |
> |
gethost_byname(conf_dns_callback, aconf, aconf->host); |
196 |
|
} |
197 |
|
} |
198 |
|
|
370 |
|
case SERVER_TYPE: |
371 |
|
aconf = map_to_conf(conf); |
372 |
|
|
373 |
< |
if (aconf->dns_query != NULL) |
374 |
< |
{ |
385 |
< |
delete_resolver_queries(aconf->dns_query); |
386 |
< |
MyFree(aconf->dns_query); |
387 |
< |
} |
373 |
> |
if (aconf->dns_pending) |
374 |
> |
delete_resolver_queries(aconf); |
375 |
|
if (aconf->passwd != NULL) |
376 |
|
memset(aconf->passwd, 0, strlen(aconf->passwd)); |
377 |
|
if (aconf->spasswd != NULL) |