--- ./modules/Makefile.orig Sat Jun 23 14:16:40 2001 +++ ./modules/Makefile Sat Jun 23 14:17:51 2001 @@ -24,6 +24,9 @@ endif ifeq ($(HESIOD), 1) + ifeq ($(HESIOD_BIND), 1) + CFLAGS += -DHESIOD_BIND + endif SRCS += lookup_hesiod.c parse_hesiod.c MODS += lookup_hesiod.so parse_hesiod.so endif --- ./modules/lookup_hesiod.c.orig Sat Jun 23 14:18:07 2001 +++ ./modules/lookup_hesiod.c Sat Jun 23 14:22:42 2001 @@ -28,6 +28,9 @@ struct lookup_context { struct parse_mod *parser; +#ifdef HESIOD_BIND + void *hesiod_context; +#endif }; int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */ @@ -49,6 +52,14 @@ /* Initialize the resolver. */ res_init(); +#ifdef HESIOD_BIND + /* Initialize the hesiod context. */ + if(hesiod_init(&(ctxt->hesiod_context)) != 0) { + syslog(LOG_CRIT, MODPREFIX "hesiod_init(): %m"); + return 1; + } +#endif + /* If a map type isn't explicitly given, parse it as hesiod entries. */ if ( !mapfmt ) mapfmt = MAPFMT_DEFAULT; @@ -72,8 +83,11 @@ chdir("/"); /* If this is not here the filesystem stays busy, for some reason... */ - +#ifdef HESIOD_BIND + hes_result = hesiod_resolve(ctxt->hesiod_context, name, "filsys"); +#else hes_result = hes_resolve(name, "filsys"); +#endif if ( !hes_result ) { syslog(LOG_NOTICE, MODPREFIX "entry \"%s\" not found in map\n", name); @@ -83,7 +97,11 @@ syslog(LOG_DEBUG, MODPREFIX "lookup for \"%s\" gave \"%s\"", name, hes_result[0]); rv = ctxt->parser->parse_mount(root,name,name_len,hes_result[0],ctxt->parser->context); +#ifdef HESIOD_BIND + hesiod_free_list(ctxt->hesiod_context, hes_result); +#else free(hes_result); +#endif return rv; } @@ -93,6 +111,9 @@ { struct lookup_context *ctxt = (struct lookup_context *) context; int rv = close_parse(ctxt->parser); +#ifdef HESIOD_BIND + hesiod_end(ctxt->hesiod_context); +#endif free(ctxt); return rv; } --- ./Makefile.conf.in.orig Sat Jun 23 14:12:16 2001 +++ ./Makefile.conf.in Sat Jun 23 14:12:43 2001 @@ -12,6 +12,7 @@ # Hesiod support: yes (1) no (0) HESIOD = @HAVE_HESIOD@ +HESIOD_BIND = @HAVE_HESIOD_BIND@ LIBHESIOD = @LIBHESIOD@ HESIOD_FLAGS = @HESIOD_FLAGS@ --- ./configure.in.orig Sat Jun 23 14:12:58 2001 +++ ./configure.in Sat Jun 23 14:16:32 2001 @@ -78,10 +78,10 @@ if test -z "$HAVE_HESIOD" then HAVE_HESIOD=0 - AC_CHECK_LIB(hesiod, hes_resolve, HAVE_HESIOD=1 LIBHESIOD="$LIBHESIOD -lhesiod", , - $LIBRESOLV) + AC_CHECK_LIB(bind, hesiod_resolve, HAVE_HESIOD=1 HAVE_HESIOD_BIND=1 LIBHESIOD="$LIBHESIOD -lbind", , $LIBRESOLV) fi AC_SUBST(HAVE_HESIOD) +AC_SUBST(HAVE_HESIOD_BIND) AC_SUBST(LIBHESIOD) AC_SUBST(HESIOD_FLAGS) LDFLAGS="${AF_tmp_ldflags}"