diff -uNr autofs-3.1.4/Makefile.conf.in autofs-3.1.4/Makefile.conf.in --- autofs-3.1.4/Makefile.conf.in Fri Jan 21 14:08:10 2000 +++ autofs-3.1.4/Makefile.conf.in Tue Feb 29 10:34:33 2000 @@ -12,6 +12,7 @@ # Hesiod support: yes (1) no (0) HESIOD = @HAVE_HESIOD@ +HESIOD_BIND = @HAVE_HESIOD_BIND@ LIBHESIOD = @LIBHESIOD@ HESIOD_FLAGS = @HESIOD_FLAGS@ diff -uNr autofs-3.1.4/configure.in autofs-3.1.4/configure.in --- autofs-3.1.4/configure.in Fri Jan 21 14:08:10 2000 +++ autofs-3.1.4/configure.in Tue Feb 29 10:40:43 2000 @@ -73,7 +73,9 @@ 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) AC_SUBST(HAVE_HESIOD) +AC_SUBST(HAVE_HESIOD_BIND) AC_SUBST(LIBHESIOD) AC_SUBST(HESIOD_FLAGS) LDFLAGS="${AF_tmp_ldflags}" diff -uNr autofs-3.1.4/modules/Makefile autofs-3.1.4/modules/Makefile --- autofs-3.1.4/modules/Makefile Tue Feb 29 10:48:15 2000 +++ autofs-3.1.4/modules/Makefile Tue Feb 29 10:36:07 2000 @@ -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 diff -uNr autofs-3.1.4/modules/lookup_hesiod.c autofs-3.1.4/modules/lookup_hesiod.c --- autofs-3.1.4/modules/lookup_hesiod.c Fri Jan 21 14:08:09 2000 +++ autofs-3.1.4/modules/lookup_hesiod.c Wed Mar 1 10:07:43 2000 @@ -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; @@ -73,7 +84,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 +98,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 +112,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; }