Blame SOURCES/nfs-utils-2.3.3-junction-update.patch

b91b93
diff --git a/aclocal/libxml2.m4 b/aclocal/libxml2.m4
b91b93
index 5c399b2..8231553 100644
b91b93
--- a/aclocal/libxml2.m4
b91b93
+++ b/aclocal/libxml2.m4
b91b93
@@ -1,15 +1,17 @@
b91b93
 dnl Checks for libxml2.so
b91b93
 AC_DEFUN([AC_LIBXML2], [
b91b93
 
b91b93
-  if test "$enable_junction" = yes; then
b91b93
+  PKG_PROG_PKG_CONFIG([0.9.0])
b91b93
+  AS_IF(
b91b93
+    [test "$enable_junction" = "yes"],
b91b93
+    [PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.4],
b91b93
+                       [LIBXML2="${XML2_LIBS}"
b91b93
+                        AM_CPPFLAGS="${AM_CPPFLAGS} ${XML2_CFLAGS}"
b91b93
+                        AC_DEFINE([HAVE_LIBXML2], [1],
b91b93
+                                  [Define to 1 if you have and wish to use libxml2.])],
b91b93
+                       [AC_MSG_ERROR([libxml2 not found.])])])
b91b93
 
b91b93
-    dnl look for the library; do not add to LIBS if found
b91b93
-    AC_CHECK_LIB([xml2], [xmlParseFile], [LIBXML2=-lxml2],
b91b93
-                 [AC_MSG_ERROR([libxml2 not found.])])
b91b93
-    AC_SUBST(LIBXML2)
b91b93
-
b91b93
-    dnl XXX should also check for presence of xml headers
b91b93
-
b91b93
-  fi
b91b93
+  AC_SUBST([AM_CPPFLAGS])
b91b93
+  AC_SUBST(LIBXML2)
b91b93
 
b91b93
 ])dnl
b91b93
diff --git a/configure.ac b/configure.ac
b91b93
index cf1c4b9..b458891 100644
b91b93
--- a/configure.ac
b91b93
+++ b/configure.ac
b91b93
@@ -165,7 +165,7 @@ AC_ARG_ENABLE(uuid,
b91b93
 	choose_blkid=default)
b91b93
 AC_ARG_ENABLE(mount,
b91b93
 	[AC_HELP_STRING([--disable-mount],
b91b93
-		[Don't build mount.nfs and do use the util-linux mount(8) functionality. @<:@default=no@:>@])],
b91b93
+		[Do not build mount.nfs and do use the util-linux mount(8) functionality. @<:@default=no@:>@])],
b91b93
 	enable_mount=$enableval,
b91b93
 	enable_mount=yes)
b91b93
 	AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
b91b93
@@ -185,7 +185,13 @@ AC_ARG_ENABLE(junction,
b91b93
 			[enable support for NFS junctions @<:@default=no@:>@])],
b91b93
 	enable_junction=$enableval,
b91b93
 	enable_junction=no)
b91b93
-AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
b91b93
+	if test "$enable_junction" = yes; then
b91b93
+		AC_DEFINE(HAVE_JUNCTION_SUPPORT, 1,
b91b93
+                          [Define this if you want junction support compiled in])
b91b93
+	else
b91b93
+		enable_junction=
b91b93
+	fi
b91b93
+	AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
b91b93
 
b91b93
 AC_ARG_ENABLE(tirpc,
b91b93
 	[AC_HELP_STRING([--disable-tirpc],
b91b93
diff --git a/support/junction/Makefile.am b/support/junction/Makefile.am
b91b93
index 97e7426..be6958b 100644
b91b93
--- a/support/junction/Makefile.am
b91b93
+++ b/support/junction/Makefile.am
b91b93
@@ -30,5 +30,3 @@ libjunction_la_SOURCES	= display.c export-cache.c junction.c \
b91b93
 			  locations.c nfs.c path.c xml.c
b91b93
 
b91b93
 MAINTAINERCLEANFILES	= Makefile.in
b91b93
-
b91b93
-AM_CPPFLAGS		= -I. -I../include -I/usr/include/libxml2
b91b93
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
b91b93
index 6f42512..7e8d403 100644
b91b93
--- a/utils/mountd/cache.c
b91b93
+++ b/utils/mountd/cache.c
b91b93
@@ -976,8 +976,9 @@ lookup_export(char *dom, char *path, struct addrinfo *ai)
b91b93
 	return found;
b91b93
 }
b91b93
 
b91b93
-#ifdef CONFIG_JUNCTION
b91b93
+#ifdef HAVE_JUNCTION_SUPPORT
b91b93
 
b91b93
+#include <libxml/parser.h>
b91b93
 #include "junction.h"
b91b93
 
b91b93
 struct nfs_fsloc_set {
b91b93
@@ -1084,8 +1085,7 @@ static bool locations_to_fslocdata(struct nfs_fsloc_set *locations,
b91b93
 	*ttl = 0;
b91b93
 
b91b93
 	for (;;) {
b91b93
-		enum jp_status status;
b91b93
-		int len;
b91b93
+		int len, status;
b91b93
 
b91b93
 		status = get_next_location(locations, &server,
b91b93
 							&rootpath, ttl);
b91b93
@@ -1219,7 +1219,7 @@ nfs_get_basic_junction(const char *junct_path, struct nfs_fsloc_set **locset)
b91b93
 		return EINVAL;
b91b93
 	}
b91b93
 
b91b93
-	locset->ns_current = locset->ns_list;
b91b93
+	new->ns_current = new->ns_list;
b91b93
 	new->ns_ttl = 300;
b91b93
 	*locset = new;
b91b93
 	return 0;
b91b93
@@ -1242,7 +1242,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
b91b93
 	status = nfs_get_basic_junction(pathname, &locations);
b91b93
 	switch (status) {
b91b93
 		xlog(L_WARNING, "Dangling junction %s: %s",
b91b93
-			pathname, strerro(status));
b91b93
+			pathname, strerror(status));
b91b93
 		goto out;
b91b93
 	}
b91b93
 
b91b93
@@ -1252,8 +1252,8 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
b91b93
 
b91b93
 	exp = locations_to_export(locations, pathname, parent);
b91b93
 
b91b93
-	nfs_free_locations(locset->ns_list);
b91b93
-	free(locset);
b91b93
+	nfs_free_locations(locations->ns_list);
b91b93
+	free(locations);
b91b93
 
b91b93
 out:
b91b93
 	xmlCleanupParser();
b91b93
@@ -1273,7 +1273,7 @@ static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path
b91b93
 	free(eep);
b91b93
 }
b91b93
 
b91b93
-#else	/* !CONFIG_JUNCTION */
b91b93
+#else	/* !HAVE_JUNCTION_SUPPORT */
b91b93
 
b91b93
 static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path,
b91b93
 		struct addrinfo *UNUSED(ai))
b91b93
@@ -1281,7 +1281,7 @@ static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path
b91b93
 	dump_to_cache(f, buf, buflen, dom, path, NULL, 0);
b91b93
 }
b91b93
 
b91b93
-#endif	/* !CONFIG_JUNCTION */
b91b93
+#endif	/* !HAVE_JUNCTION_SUPPORT */
b91b93
 
b91b93
 static void nfsd_export(int f)
b91b93
 {
b91b93
diff --git a/utils/nfsref/Makefile.am b/utils/nfsref/Makefile.am
b91b93
index 2b2bb53..2409dd0 100644
b91b93
--- a/utils/nfsref/Makefile.am
b91b93
+++ b/utils/nfsref/Makefile.am
b91b93
@@ -27,13 +27,11 @@ noinst_HEADERS		= nfsref.h
b91b93
 
b91b93
 sbin_PROGRAMS		= nfsref
b91b93
 nfsref_SOURCES		= add.c lookup.c nfsref.c remove.c
b91b93
-LDADD			= $(LIBXML2) $(LIBCAP) \
b91b93
-			  ../../support/nfs/libnfs.la \
b91b93
-			  ../../support/junction/libjunction.la
b91b93
+LDADD			= ../../support/nfs/libnfs.la \
b91b93
+			  ../../support/junction/libjunction.la \
b91b93
+			  $(LIBXML2) $(LIBCAP)
b91b93
 
b91b93
 man8_MANS		= nfsref.man
b91b93
 
b91b93
 MAINTAINERCLEANFILES	= Makefile.in
b91b93
 
b91b93
-AM_CPPFLAGS		= -I. -I../../support/include
b91b93
-##AM_LDFLAGS		= -Wl,--as-needed