]> git.pld-linux.org Git - packages/autofs.git/blame - autofs-hesiod-bind.patch
- RH patches.
[packages/autofs.git] / autofs-hesiod-bind.patch
CommitLineData
be85a188 1diff -uNr autofs-3.1.4/Makefile.conf.in autofs-3.1.4/Makefile.conf.in
2--- autofs-3.1.4/Makefile.conf.in Fri Jan 21 14:08:10 2000
3+++ autofs-3.1.4/Makefile.conf.in Tue Feb 29 10:34:33 2000
4@@ -12,6 +12,7 @@
5
6 # Hesiod support: yes (1) no (0)
7 HESIOD = @HAVE_HESIOD@
8+HESIOD_BIND = @HAVE_HESIOD_BIND@
9 LIBHESIOD = @LIBHESIOD@
10 HESIOD_FLAGS = @HESIOD_FLAGS@
11
12diff -uNr autofs-3.1.4/configure.in autofs-3.1.4/configure.in
13--- autofs-3.1.4/configure.in Fri Jan 21 14:08:10 2000
14+++ autofs-3.1.4/configure.in Tue Feb 29 10:40:43 2000
15@@ -73,7 +73,9 @@
16
17 HAVE_HESIOD=0
18 AC_CHECK_LIB(hesiod, hes_resolve, HAVE_HESIOD=1 LIBHESIOD="$LIBHESIOD -lhesiod", , $LIBRESOLV)
19+AC_CHECK_LIB(bind, hesiod_resolve, HAVE_HESIOD=1 HAVE_HESIOD_BIND=1 LIBHESIOD="$LIBHESIOD -lbind", , $LIBRESOLV)
20 AC_SUBST(HAVE_HESIOD)
21+AC_SUBST(HAVE_HESIOD_BIND)
22 AC_SUBST(LIBHESIOD)
23 AC_SUBST(HESIOD_FLAGS)
24 LDFLAGS="${AF_tmp_ldflags}"
25diff -uNr autofs-3.1.4/modules/Makefile autofs-3.1.4/modules/Makefile
26--- autofs-3.1.4/modules/Makefile Tue Feb 29 10:48:15 2000
27+++ autofs-3.1.4/modules/Makefile Tue Feb 29 10:36:07 2000
28@@ -24,6 +24,9 @@
29 endif
30
31 ifeq ($(HESIOD), 1)
32+ ifeq ($(HESIOD_BIND), 1)
33+ CFLAGS += -DHESIOD_BIND
34+ endif
35 SRCS += lookup_hesiod.c parse_hesiod.c
36 MODS += lookup_hesiod.so parse_hesiod.so
37 endif
38diff -uNr autofs-3.1.4/modules/lookup_hesiod.c autofs-3.1.4/modules/lookup_hesiod.c
39--- autofs-3.1.4/modules/lookup_hesiod.c Fri Jan 21 14:08:09 2000
40+++ autofs-3.1.4/modules/lookup_hesiod.c Wed Mar 1 10:07:43 2000
41@@ -28,6 +28,9 @@
42
43 struct lookup_context {
44 struct parse_mod *parser;
45+#ifdef HESIOD_BIND
46+ void *hesiod_context;
47+#endif
48 };
49
50 int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */
51@@ -49,6 +52,14 @@
52 /* Initialize the resolver. */
53 res_init();
54
55+#ifdef HESIOD_BIND
56+ /* Initialize the hesiod context. */
57+ if(hesiod_init(&(ctxt->hesiod_context)) != 0) {
58+ syslog(LOG_CRIT, MODPREFIX "hesiod_init(): %m");
59+ return 1;
60+ }
61+#endif
62+
63 /* If a map type isn't explicitly given, parse it as hesiod entries. */
64 if ( !mapfmt )
65 mapfmt = MAPFMT_DEFAULT;
66@@ -73,7 +84,11 @@
67 chdir("/"); /* If this is not here the filesystem stays
68 busy, for some reason... */
69
70+#ifdef HESIOD_BIND
71+ hes_result = hesiod_resolve(ctxt->hesiod_context, name, "filsys");
72+#else
73 hes_result = hes_resolve(name, "filsys");
74+#endif
75
76 if ( !hes_result ) {
77 syslog(LOG_NOTICE, MODPREFIX "entry \"%s\" not found in map\n", name);
78@@ -83,7 +98,11 @@
79 syslog(LOG_DEBUG, MODPREFIX "lookup for \"%s\" gave \"%s\"",
80 name, hes_result[0]);
81 rv = ctxt->parser->parse_mount(root,name,name_len,hes_result[0],ctxt->parser->context);
82+#ifdef HESIOD_BIND
83+ hesiod_free_list(ctxt->hesiod_context, hes_result);
84+#else
85 free(hes_result);
86+#endif
87 return rv;
88 }
89
90@@ -93,6 +112,9 @@
91 {
92 struct lookup_context *ctxt = (struct lookup_context *) context;
93 int rv = close_parse(ctxt->parser);
94+#ifdef HESIOD_BIND
95+ hesiod_end(ctxt->hesiod_context);
96+#endif
97 free(ctxt);
98 return rv;
99 }
This page took 0.548254 seconds and 4 git commands to generate.