From 878972d60cb55f2bc6e04a0937f81407fbc308fe Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 5 Mar 2014 14:55:46 +1100 Subject: [PATCH] mountd: use SONAME fir libnfsjunct when loading with dlopen. The standard for loading shared libraries is to identify them by their "soname" (Which "objdump -x $BINARY | grep SONAME" will report). However mountd currently loads using the "linker name" which should only be used when building new code. Future releases of fedfs-utils will define the soname in the include file, so if that is defined, use it. If not, use the soname of the first version: "libnfsjunct.so.0". This is a slight behavioural change. However all distros known to package fedfs-utils will install "libnfsjunct.so.0" whenever they install the old name of "libnfsjunct.so", and "make install" will install both. So it should not be a noticeable change. Also only test the JP_API_VERSION if it is defined. As the version is embedded in the soname, a secondary test is not needed. Cc: Chuck Lever Signed-off-by: NeilBrown --- utils/mountd/cache.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- nfs-utils-1.2.8.orig/utils/mountd/cache.c +++ nfs-utils-1.2.8/utils/mountd/cache.c @@ -1055,12 +1055,13 @@ static struct exportent *invoke_junction __func__, error); return NULL; } +#ifdef JP_API_VERSION if (ops->jp_api_version != JP_API_VERSION) { xlog(D_GENERAL, "%s: unrecognized junction API version: %u", __func__, ops->jp_api_version); return NULL; } - +#endif status = ops->jp_init(false); if (status != JP_OK) { xlog(D_GENERAL, "%s: failed to resolve %s: %s", @@ -1107,7 +1108,11 @@ static struct exportent *lookup_junction struct link_map *map; void *handle; - handle = dlopen("libnfsjunct.so", RTLD_NOW); +#ifdef JP_NFSPLUGIN_SONAME + handle = dlopen(JP_NFSPLUGIN_SONAME, RTLD_NOW); +#else + handle = dlopen("libnfsjunct.so.0", RTLD_NOW); +#endif if (handle == NULL) { xlog(D_GENERAL, "%s: dlopen: %s", __func__, dlerror()); return NULL;