105baaf
diff --git a/.gitignore b/.gitignore
105baaf
index 5454bef..6244609 100644
105baaf
--- a/.gitignore
105baaf
+++ b/.gitignore
105baaf
@@ -28,4 +28,8 @@ umich_ldap.la
105baaf
 umich_ldap.lo
105baaf
 configure.in~
105baaf
 m4/
105baaf
-
105baaf
+*.o
105baaf
+cscope.*
105baaf
+config.h
105baaf
+config.h.in
105baaf
+stamp-h1
105baaf
diff --git a/Makefile.am b/Makefile.am
105baaf
index 296e277..0832c1c 100644
105baaf
--- a/Makefile.am
105baaf
+++ b/Makefile.am
105baaf
@@ -26,7 +26,6 @@ pkglib_LTLIBRARIES = nsswitch.la static.la $(UMICH_LDAP_LIB) $(GUMS_MAPPING_LIB)
105baaf
 #  		by this library.
105baaf
 
105baaf
 libnfsidmap_la_SOURCES = libnfsidmap.c cfg.c strlcpy.c cfg.h nfsidmap_internal.h queue.h
105baaf
-libnfsidmap_la_CPPFLAGS = -DPATH_PLUGINS=\"$(pkglibdir)\"
105baaf
 libnfsidmap_la_LDFLAGS = -version-info 3:0:3
105baaf
 libnfsidmap_la_LIBADD = -ldl
105baaf
 
105baaf
diff --git a/configure.in b/configure.in
105baaf
index c105988..7ad3e5f 100644
105baaf
--- a/configure.in
105baaf
+++ b/configure.in
105baaf
@@ -36,7 +36,20 @@ if test "x$enable_gums" = "xyes" ; then
105baaf
 fi
105baaf
 AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
105baaf
 
105baaf
+#Where do the Plugins live
105baaf
+AC_ARG_WITH(pluginpath,
105baaf
+    [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
105baaf
+    ])],
105baaf
+    path_plugins=$withval,
105baaf
+    path_plugins=""
105baaf
+    )
105baaf
+if test -n "$path_plugins" ; then
105baaf
+	AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
105baaf
+		[Define this to change the plugins path])
105baaf
+fi
105baaf
+AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
105baaf
 
105baaf
+AC_CONFIG_HEADERS([./config.h])
105baaf
 # Checks for header files.
105baaf
 AC_HEADER_STDC
105baaf
 AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
105baaf
diff --git a/libnfsidmap.c b/libnfsidmap.c
105baaf
index 5dc2652..57bb6c3 100644
105baaf
--- a/libnfsidmap.c
105baaf
+++ b/libnfsidmap.c
105baaf
@@ -36,6 +36,8 @@
105baaf
  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
105baaf
  */
105baaf
 
105baaf
+#include "config.h"
105baaf
+
105baaf
 #include <sys/types.h>
105baaf
 #include <errno.h>
105baaf
 #include <unistd.h>
105baaf
@@ -50,6 +52,7 @@
105baaf
 #include <syslog.h>
105baaf
 #include <stdarg.h>
105baaf
 #include <dlfcn.h>
105baaf
+#include <ctype.h>
105baaf
 #include "nfsidmap.h"
105baaf
 #include "nfsidmap_internal.h"
105baaf
 #include "cfg.h"
105baaf
@@ -207,7 +210,7 @@ out:
105baaf
 		unload_plugins(plgns);
105baaf
 	return ret;
105baaf
 }
105baaf
-int nfs4_cleanup_name_mapping()
105baaf
+void nfs4_cleanup_name_mapping()
105baaf
 {
105baaf
 	if (nfs4_plugins)
105baaf
 		unload_plugins(nfs4_plugins);
105baaf
@@ -219,7 +222,6 @@ int nfs4_cleanup_name_mapping()
105baaf
 int nfs4_init_name_mapping(char *conffile)
105baaf
 {
105baaf
 	int ret = -ENOENT;
105baaf
-	char *method;
105baaf
 	int dflt = 0;
105baaf
 	struct conf_list *nfs4_methods, *gss_methods;
105baaf
 
105baaf
@@ -244,7 +246,7 @@ int nfs4_init_name_mapping(char *conffile)
105baaf
 			default_domain = IDMAPD_DEFAULT_DOMAIN;
105baaf
 		}
105baaf
 	}
105baaf
-	IDMAP_LOG(1, ("libnfsidmap: using%s domain: %s\n",
105baaf
+	IDMAP_LOG(1, ("libnfsidmap: using%s domain: %s",
105baaf
 		(dflt ? " (default)" : ""), default_domain));
105baaf
 
105baaf
 	/* Get list of "local equivalent" realms.  Meaning the list of realms
105baaf
@@ -272,9 +274,30 @@ int nfs4_init_name_mapping(char *conffile)
105baaf
 		local_realms->cnt++;
105baaf
 	}
105baaf
 
105baaf
+	if (idmap_verbosity >= 1) {
105baaf
+		struct conf_list_node *r;
105baaf
+		char *buf = NULL;
105baaf
+		int siz=0;
105baaf
+
105baaf
+		if (local_realms) {
105baaf
+			TAILQ_FOREACH(r, &local_realms->fields, link) {
105baaf
+				siz += (strlen(r->field)+4);
105baaf
+			}
105baaf
+			buf = malloc(siz);
105baaf
+			if (buf) {
105baaf
+				TAILQ_FOREACH(r, &local_realms->fields, link) {
105baaf
+					sprintf(buf, "'%s' ", r->field);
105baaf
+				}
105baaf
+				IDMAP_LOG(1, ("libnfsidmap: Realms list: %s", buf));
105baaf
+				free(buf);
105baaf
+			}
105baaf
+		} else 
105baaf
+			IDMAP_LOG(1, ("libnfsidmap: Realms list: <NULL> "));
105baaf
+	}
105baaf
+
105baaf
 	nfs4_methods = conf_get_list("Translation", "Method");
105baaf
 	if (nfs4_methods) {
105baaf
-		IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list\n"));
105baaf
+		IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list"));
105baaf
 		if (load_plugins(nfs4_methods, &nfs4_plugins) == -1)
105baaf
 			return -ENOENT;
105baaf
 	} else {
105baaf
@@ -292,7 +315,7 @@ int nfs4_init_name_mapping(char *conffile)
105baaf
 
105baaf
 	gss_methods = conf_get_list("Translation", "GSS-Methods");
105baaf
 	if (gss_methods) {
105baaf
-		IDMAP_LOG(1, ("libnfsidmap: processing 'GSS-Methods' list\n"));
105baaf
+		IDMAP_LOG(1, ("libnfsidmap: processing 'GSS-Methods' list"));
105baaf
 		if (load_plugins(gss_methods, &gss_plugins) == -1)
105baaf
 			goto out;
105baaf
 	}
105baaf
diff --git a/umich_ldap.c b/umich_ldap.c
105baaf
index f6204c3..f482b0a 100644
105baaf
--- a/umich_ldap.c
105baaf
+++ b/umich_ldap.c
105baaf
@@ -1084,7 +1084,7 @@ get_canonical_hostname(const char *inname)
105baaf
 	if (error) {
105baaf
 		IDMAP_LOG(1, ("%s: getnameinfo for host '%s' failed (%d)\n",
105baaf
 			  __FUNCTION__, inname));
105baaf
-		goto out_err;
105baaf
+		goto out_free;
105baaf
 	}
105baaf
 	return_name = strdup (tmphost);
105baaf
 
105baaf
@@ -1098,7 +1098,6 @@ static int
105baaf
 umichldap_init(void)
105baaf
 {
105baaf
 	char *tssl, *canonicalize, *memberof;
105baaf
-	int missing_server = 0, missing_base = 0;
105baaf
 	char missing_msg[128] = "";
105baaf
 	char *server_in, *canon_name;
105baaf