/* -*-c-*-
*
- * $Id: bres-adns.c,v 1.2 2003/12/14 14:46:38 mdw Exp $
+ * $Id$
*
* Background reverse name resolution (ADNS version)
*
* (c) 2003 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of the mLib utilities library.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* mLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with mLib; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* must be licensed under the full GPL.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: bres-adns.c,v $
- * Revision 1.2 2003/12/14 14:46:38 mdw
- * Qualify name given to @bres_byname@.
- *
- * Revision 1.1 2003/12/13 20:37:59 mdw
- * Add adns support in background resolver.
- *
- */
-
#ifndef HAVE_ADNS
# error "You need the ADNS library to compile this file."
#endif
h.h_addrtype = AF_INET;
h.h_length = sizeof(struct in_addr);
h.h_addr_list = aa;
- rc->func(&h, rc->p);
+ rc->func(&h, rc->p);
}
/* --- @beforehook@, @afterhook@ --- *
void *c;
bres_client *rc;
adns_query q;
- adns_answer *a;
+ adns_answer *a, *aa;
int e;
int i;
else switch (rc->q) {
case adns_r_addr:
assert(a->type == adns_r_addr);
+ xfree(rc->u.name);
report(rc, a, a->rrs.addr, a->nrrs, &a->owner, 1);
- free(rc->u.name);
free(a);
break;
case adns_r_ptr:
}
goto fail;
match:
- report(rc, a, &a->rrs.addr[i], 1, rc->a->rrs.str, rc->a->nrrs);
- free(rc->a);
+ aa = rc->a;
+ report(rc, a, &a->rrs.addr[i], 1, aa->rrs.str, aa->nrrs);
+ free(aa);
free(a);
}
break;
continue;
fail:
- rc->func(0, rc->p);
if (rc->q == adns_r_addr) xfree(rc->u.name);
if (rc->a) free(rc->a);
+ rc->func(0, rc->p);
free(a);
}
}
{
int e;
- if ((e = adns_init(&ads, 0, 0)) != 0) {
+ if ((e = adns_init(&ads, adns_if_noautosys, 0)) != 0) {
moan("adns_init failed: resolver won't work");
return;
}