diff -up libnfsidmap-0.26/configure.ac.orig libnfsidmap-0.26/configure.ac
--- libnfsidmap-0.26/configure.ac.orig 2014-10-28 14:58:50.385128000 -0400
+++ libnfsidmap-0.26/configure.ac 2014-10-28 14:58:50.382130000 -0400
@@ -0,0 +1,68 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.66])
+AC_INIT([libnfsidmap],[0.26],[linux-nfs@vger.kernel.org])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_SRCDIR([nfsidmap.h])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([foreign])
+LT_INIT
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+
+AC_ARG_ENABLE([ldap],
+ [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
+if test "x$enable_ldap" != "xno" ; then
+ AC_CHECK_HEADER([ldap.h],
+ [AC_CHECK_LIB([ldap], [ldap_initialize],
+ [have_ldap="yes"],[have_ldap="no"])],
+ [have_ldap="no"])
+ if test "x$have_ldap" = "xyes" ; then
+ AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
+ elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
+ AC_MSG_ERROR(LDAP support not found!)
+ fi
+fi
+AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")
+
+# Should we build gums mapping library?
+AC_ARG_ENABLE([gums],
+ [AS_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
+if test "x$enable_gums" = "xyes" ; then
+ AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
+fi
+AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
+
+#Where do the Plugins live
+AC_ARG_WITH(pluginpath,
+ [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
+ ])],
+ path_plugins=$withval,
+ path_plugins=""
+ )
+if test -n "$path_plugins" ; then
+ AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
+ [Define this to change the plugins path])
+fi
+AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
+
+AC_CONFIG_HEADERS([./config.h])
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_UID_T
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([strchr strdup])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([libnfsidmap.pc])
+AC_OUTPUT
diff -up libnfsidmap-0.26/configure.in.orig libnfsidmap-0.26/configure.in
--- libnfsidmap-0.26/configure.in.orig 2014-10-28 14:59:12.660789000 -0400
+++ libnfsidmap-0.26/configure.in 2014-10-28 14:59:12.657786000 -0400
@@ -0,0 +1,67 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.66])
+AC_INIT([libnfsidmap],[0.26],[linux-nfs@vger.kernel.org])
+AC_CONFIG_SRCDIR([nfsidmap.h])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+LT_INIT
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+
+AC_ARG_ENABLE([ldap],
+ [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
+if test "x$enable_ldap" != "xno" ; then
+ AC_CHECK_HEADER([ldap.h],
+ [AC_CHECK_LIB([ldap], [ldap_initialize],
+ [have_ldap="yes"],[have_ldap="no"])],
+ [have_ldap="no"])
+ if test "x$have_ldap" = "xyes" ; then
+ AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
+ elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
+ AC_MSG_ERROR(LDAP support not found!)
+ fi
+fi
+AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")
+
+# Should we build gums mapping library?
+AC_ARG_ENABLE([gums],
+ [AS_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
+if test "x$enable_gums" = "xyes" ; then
+ AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
+fi
+AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
+
+#Where do the Plugins live
+AC_ARG_WITH(pluginpath,
+ [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
+ ])],
+ path_plugins=$withval,
+ path_plugins=""
+ )
+if test -n "$path_plugins" ; then
+ AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
+ [Define this to change the plugins path])
+fi
+AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
+
+AC_CONFIG_HEADERS([./config.h])
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_UID_T
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([strchr strdup])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([libnfsidmap.pc])
+AC_OUTPUT
diff -up libnfsidmap-0.26/.gitignore.orig libnfsidmap-0.26/.gitignore
--- libnfsidmap-0.26/.gitignore.orig 2014-08-13 12:42:14.000000000 -0400
+++ libnfsidmap-0.26/.gitignore 2014-10-28 14:58:50.369130000 -0400
@@ -1,15 +1,9 @@
Makefile.in
-aclocal.m4
-autom4te.cache/
-config.guess
-config.sub
+/aclocal.m4
+/autom4te.cache/
+/build-aux/
configure
-depcomp
-ltmain.sh
-missing
-install-sh
Makefile
-install-sh
.deps/
config.log
config.status
@@ -21,7 +15,6 @@ nsswitch.la
static.la
umich_ldap.la
configure.in~
-m4/
*.o
*.lo
cscope.*
diff -up libnfsidmap-0.26/libnfsidmap.c.orig libnfsidmap-0.26/libnfsidmap.c
--- libnfsidmap-0.26/libnfsidmap.c.orig 2014-08-13 12:42:14.000000000 -0400
+++ libnfsidmap-0.26/libnfsidmap.c 2014-10-28 14:59:12.665787000 -0400
@@ -98,7 +98,7 @@ static char * toupper_str(char *s)
return s;
}
-static int id_as_chars(char *name, int *id)
+static int id_as_chars(char *name, uid_t *id)
{
long int value = strtol(name, NULL, 10);
@@ -494,7 +494,7 @@ int nfs4_name_to_gid(char *name, gid_t *
RUN_TRANSLATIONS(name_to_gid, 0, name, gid);
}
-static int set_id_to_nobody(int *id, int is_uid)
+static int set_id_to_nobody(uid_t *id, uid_t is_uid)
{
int rc = 0;
const char name[] = "nobody@";
@@ -504,10 +504,10 @@ static int set_id_to_nobody(int *id, int
* configured, before we try to do a full lookup for the
* NFS nobody user. */
if (is_uid && nobody_uid != (uid_t)-1) {
- *id = (int)nobody_uid;
+ *id = (uid_t)nobody_uid;
return 0;
} else if (!is_uid && nobody_gid != (gid_t)-1) {
- *id = (int)nobody_gid;
+ *id = (uid_t)nobody_gid;
return 0;
}
@@ -542,7 +542,7 @@ int nfs4_group_owner_to_gid(char *name,
if (rc && id_as_chars(name, gid))
rc = 0;
else if (rc)
- rc = set_id_to_nobody(gid, 0);
+ rc = set_id_to_nobody((uid_t *)gid, 0);
return rc;
}
diff -up libnfsidmap-0.26/m4/.gitignore.orig libnfsidmap-0.26/m4/.gitignore
--- libnfsidmap-0.26/m4/.gitignore.orig 2014-10-28 14:59:12.672790000 -0400
+++ libnfsidmap-0.26/m4/.gitignore 2014-10-28 14:59:12.670787000 -0400
@@ -0,0 +1,2 @@
+/libtool.m4
+/lt*.m4
diff -up libnfsidmap-0.26/Makefile.am.orig libnfsidmap-0.26/Makefile.am
--- libnfsidmap-0.26/Makefile.am.orig 2014-08-13 12:42:14.000000000 -0400
+++ libnfsidmap-0.26/Makefile.am 2014-10-28 14:58:50.375127000 -0400
@@ -26,8 +26,9 @@ pkglib_LTLIBRARIES = nsswitch.la static.
# by this library.
libnfsidmap_la_SOURCES = libnfsidmap.c cfg.c strlcpy.c cfg.h nfsidmap_internal.h queue.h
-libnfsidmap_la_LDFLAGS = -version-info 3:0:3
+libnfsidmap_la_LDFLAGS = -version-info 3:0:3 -Wl,--version-script=$(srcdir)/nfsidmap.map
libnfsidmap_la_LIBADD = -ldl
+libnfsidmap_la_DEPENDENCIES = nfsidmap.map
nsswitch_la_SOURCES = nss.c
nsswitch_la_LDFLAGS = -module -avoid-version
@@ -59,3 +60,4 @@ dist-hook:
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA = libnfsidmap.pc
+$(pkgconfig_DATA): $(top_builddir)/config.status
diff -up libnfsidmap-0.26/NEWS.orig libnfsidmap-0.26/NEWS
diff -up libnfsidmap-0.26/nfsidmap.map.orig libnfsidmap-0.26/nfsidmap.map
--- libnfsidmap-0.26/nfsidmap.map.orig 2014-10-28 14:59:12.679788000 -0400
+++ libnfsidmap-0.26/nfsidmap.map 2014-10-28 14:59:12.676786000 -0400
@@ -0,0 +1,31 @@
+V_0.26 {
+global:
+ nfs4_init_name_mapping;
+ nfs4_get_default_domain;
+ nfs4_uid_to_name;
+ nfs4_gid_to_name;
+ nfs4_uid_to_owner;
+ nfs4_gid_to_group_owner;
+ nfs4_name_to_uid;
+ nfs4_name_to_gid;
+ nfs4_owner_to_uid;
+ nfs4_owner_to_gid;
+ nfs4_group_owner_to_gid;
+ nfs4_gss_princ_to_ids;
+ nfs4_gss_princ_to_grouplist;
+ nfs4_gss_princ_to_ids_ex;
+ nfs4_gss_princ_to_grouplist_ex;
+ nfs4_set_debug;
+ idmap_verbosity;
+ idmap_log_func;
+ get_default_domain;
+ get_local_realms;
+local:
+ *;
+};
+/*
+V_0.27 {
+global:
+ ...
+} V_0.26;
+*/
diff -up libnfsidmap-0.26/static.c.orig libnfsidmap-0.26/static.c
--- libnfsidmap-0.26/static.c.orig 2014-08-13 12:42:14.000000000 -0400
+++ libnfsidmap-0.26/static.c 2014-10-28 14:59:12.694787000 -0400
@@ -39,6 +39,7 @@
#include <pwd.h>
#include <grp.h>
#include <errno.h>
+#include <err.h>
#include "queue.h"
#include "cfg.h"
@@ -268,7 +269,6 @@ static int static_name_to_gid(char *name
static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
{
- struct passwd *pw;
struct uid_mapping * um;
for (um = LIST_FIRST (&uid_mappings[uid_hash (uid)]); um;
@@ -284,7 +284,6 @@ static int static_uid_to_name(uid_t uid,
static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
{
- struct group *gr;
struct gid_mapping * gm;
for (gm = LIST_FIRST (&gid_mappings[gid_hash (gid)]); gm;
@@ -305,7 +304,6 @@ static int static_gid_to_name(gid_t gid,
static int static_init() {
int err;
- uid_t uid;
struct conf_list * princ_list = NULL;
struct conf_list_node * cln, *next;
struct uid_mapping * unode;
@@ -367,7 +365,7 @@ static int static_init() {
next = TAILQ_NEXT (cln, link);
gr = static_getgrnam(cln->field, NULL, &err);
- if (!pw) {
+ if (!gr) {
continue;
}
@@ -376,19 +374,19 @@ static int static_init() {
{
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *gnode);
- free(pw);
+ free(gr);
return -ENOMEM;
}
- gnode->gid = pw->pw_uid;
+ gnode->gid = gr->gr_gid;
gnode->principal = strdup(cln->field);
gnode->localgroup = conf_get_str("Static", cln->field);
if (!gnode->localgroup) {
- free(pw);
+ free(gr);
return -ENOENT;
}
- free(pw);
+ free(gr);
LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link);
}