Blame SOURCES/libnfsidmap-0.25-warnings.patch

76e38b
diff -up libnfsidmap-0.25/configure.ac.orig libnfsidmap-0.25/configure.ac
76e38b
--- libnfsidmap-0.25/configure.ac.orig	2014-10-21 10:56:09.384577000 -0400
76e38b
+++ libnfsidmap-0.25/configure.ac	2014-10-21 10:56:09.382575000 -0400
76e38b
@@ -0,0 +1,67 @@
76e38b
+#                                               -*- Autoconf -*-
76e38b
+# Process this file with autoconf to produce a configure script.
76e38b
+
76e38b
+AC_PREREQ([2.68])
76e38b
+AC_INIT([libnfsidmap],[0.25],[linux-nfs@vger.kernel.org])
76e38b
+AC_CONFIG_SRCDIR([nfsidmap.h])
76e38b
+AC_CONFIG_MACRO_DIR([m4])
76e38b
+AM_INIT_AUTOMAKE
76e38b
+LT_INIT
76e38b
+
76e38b
+# Checks for programs.
76e38b
+AC_PROG_CC
76e38b
+
76e38b
+# Checks for libraries.
76e38b
+
76e38b
+AC_ARG_ENABLE([ldap],
76e38b
+	[AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
76e38b
+if test "x$enable_ldap" != "xno" ; then
76e38b
+	AC_CHECK_HEADER([ldap.h],
76e38b
+		[AC_CHECK_LIB([ldap], [ldap_initialize],
76e38b
+		              [have_ldap="yes"],[have_ldap="no"])],
76e38b
+		[have_ldap="no"])
76e38b
+	if test "x$have_ldap" = "xyes" ; then
76e38b
+		AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
76e38b
+	elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
76e38b
+		AC_MSG_ERROR(LDAP support not found!)
76e38b
+	fi
76e38b
+fi
76e38b
+AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")
76e38b
+
76e38b
+# Should we build gums mapping library?
76e38b
+AC_ARG_ENABLE([gums],
76e38b
+	[AS_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
76e38b
+if test "x$enable_gums" = "xyes" ; then
76e38b
+	AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
76e38b
+fi
76e38b
+AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
76e38b
+
76e38b
+#Where do the Plugins live
76e38b
+AC_ARG_WITH(pluginpath,
76e38b
+    [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
76e38b
+    ])],
76e38b
+    path_plugins=$withval,
76e38b
+    path_plugins=""
76e38b
+    )
76e38b
+if test -n "$path_plugins" ; then
76e38b
+	AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
76e38b
+		[Define this to change the plugins path])
76e38b
+fi
76e38b
+AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
76e38b
+
76e38b
+AC_CONFIG_HEADERS([./config.h])
76e38b
+# Checks for header files.
76e38b
+AC_HEADER_STDC
76e38b
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
76e38b
+
76e38b
+# Checks for typedefs, structures, and compiler characteristics.
76e38b
+AC_TYPE_UID_T
76e38b
+AC_TYPE_SIZE_T
76e38b
+
76e38b
+# Checks for library functions.
76e38b
+AC_FUNC_MALLOC
76e38b
+AC_CHECK_FUNCS([strchr strdup])
76e38b
+
76e38b
+AC_CONFIG_FILES([Makefile])
76e38b
+AC_CONFIG_FILES([libnfsidmap.pc])
76e38b
+AC_OUTPUT
76e38b
diff -up libnfsidmap-0.25/configure.in.orig libnfsidmap-0.25/configure.in
76e38b
--- libnfsidmap-0.25/configure.in.orig	2011-12-05 15:48:54.000000000 -0500
76e38b
+++ libnfsidmap-0.25/configure.in	2014-10-21 10:56:09.388579000 -0400
76e38b
@@ -1,67 +0,0 @@
76e38b
-#                                               -*- Autoconf -*-
76e38b
-# Process this file with autoconf to produce a configure script.
76e38b
-
76e38b
-AC_PREREQ([2.68])
76e38b
-AC_INIT([libnfsidmap],[0.25],[linux-nfs@vger.kernel.org])
76e38b
-AC_CONFIG_SRCDIR([nfsidmap.h])
76e38b
-AC_CONFIG_MACRO_DIR([m4])
76e38b
-AM_INIT_AUTOMAKE
76e38b
-LT_INIT
76e38b
-
76e38b
-# Checks for programs.
76e38b
-AC_PROG_CC
76e38b
-
76e38b
-# Checks for libraries.
76e38b
-
76e38b
-AC_ARG_ENABLE([ldap],
76e38b
-	[AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
76e38b
-if test "x$enable_ldap" != "xno" ; then
76e38b
-	AC_CHECK_HEADER([ldap.h],
76e38b
-		[AC_CHECK_LIB([ldap], [ldap_initialize],
76e38b
-		              [have_ldap="yes"],[have_ldap="no"])],
76e38b
-		[have_ldap="no"])
76e38b
-	if test "x$have_ldap" = "xyes" ; then
76e38b
-		AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
76e38b
-	elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
76e38b
-		AC_MSG_ERROR(LDAP support not found!)
76e38b
-	fi
76e38b
-fi
76e38b
-AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")
76e38b
-
76e38b
-# Should we build gums mapping library?
76e38b
-AC_ARG_ENABLE([gums],
76e38b
-	[AS_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
76e38b
-if test "x$enable_gums" = "xyes" ; then
76e38b
-	AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
76e38b
-fi
76e38b
-AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
76e38b
-
76e38b
-#Where do the Plugins live
76e38b
-AC_ARG_WITH(pluginpath,
76e38b
-    [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
76e38b
-    ])],
76e38b
-    path_plugins=$withval,
76e38b
-    path_plugins=""
76e38b
-    )
76e38b
-if test -n "$path_plugins" ; then
76e38b
-	AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
76e38b
-		[Define this to change the plugins path])
76e38b
-fi
76e38b
-AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
76e38b
-
76e38b
-AC_CONFIG_HEADERS([./config.h])
76e38b
-# Checks for header files.
76e38b
-AC_HEADER_STDC
76e38b
-AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
76e38b
-
76e38b
-# Checks for typedefs, structures, and compiler characteristics.
76e38b
-AC_TYPE_UID_T
76e38b
-AC_TYPE_SIZE_T
76e38b
-
76e38b
-# Checks for library functions.
76e38b
-AC_FUNC_MALLOC
76e38b
-AC_CHECK_FUNCS([strchr strdup])
76e38b
-
76e38b
-AC_CONFIG_FILES([Makefile])
76e38b
-AC_CONFIG_FILES([libnfsidmap.pc])
76e38b
-AC_OUTPUT
76e38b
diff -up libnfsidmap-0.25/libnfsidmap.c.orig libnfsidmap-0.25/libnfsidmap.c
76e38b
--- libnfsidmap-0.25/libnfsidmap.c.orig	2014-10-21 10:55:29.626400000 -0400
76e38b
+++ libnfsidmap-0.25/libnfsidmap.c	2014-10-21 10:56:21.180926000 -0400
76e38b
@@ -98,7 +98,7 @@ static char * toupper_str(char *s)
76e38b
 	return s;
76e38b
 }
76e38b
 
76e38b
-static int id_as_chars(char *name, int *id)
76e38b
+static int id_as_chars(char *name, uid_t *id)
76e38b
 {
76e38b
 	long int value = strtol(name, NULL, 10);
76e38b
 
76e38b
@@ -494,7 +494,7 @@ int nfs4_name_to_gid(char *name, gid_t *
76e38b
 	RUN_TRANSLATIONS(name_to_gid, 0, name, gid);
76e38b
 }
76e38b
 
76e38b
-static int set_id_to_nobody(int *id, int is_uid)
76e38b
+static int set_id_to_nobody(uid_t *id, uid_t is_uid)
76e38b
 {
76e38b
 	int rc = 0;
76e38b
 	const char name[] = "nobody@";
76e38b
@@ -504,10 +504,10 @@ static int set_id_to_nobody(int *id, int
76e38b
          * configured, before we try to do a full lookup for the
76e38b
          * NFS nobody user. */
76e38b
 	if (is_uid && nobody_uid != (uid_t)-1) {
76e38b
-		*id = (int)nobody_uid;
76e38b
+		*id = (uid_t)nobody_uid;
76e38b
 		return 0;
76e38b
 	} else if (!is_uid && nobody_gid != (gid_t)-1) {
76e38b
-		*id = (int)nobody_gid;
76e38b
+		*id = (uid_t)nobody_gid;
76e38b
 		return 0;
76e38b
 	}
76e38b
 
76e38b
@@ -542,7 +542,7 @@ int nfs4_group_owner_to_gid(char *name,
76e38b
 	if (rc && id_as_chars(name, gid))
76e38b
 		rc = 0;
76e38b
 	else if (rc)
76e38b
-		rc = set_id_to_nobody(gid, 0);
76e38b
+		rc = set_id_to_nobody((uid_t *)gid, 0);
76e38b
 	return rc;
76e38b
 }
76e38b
 
76e38b
diff -up libnfsidmap-0.25/static.c.orig libnfsidmap-0.25/static.c
76e38b
--- libnfsidmap-0.25/static.c.orig	2014-10-21 10:55:29.588399000 -0400
76e38b
+++ libnfsidmap-0.25/static.c	2014-10-21 10:56:21.186926000 -0400
76e38b
@@ -39,6 +39,7 @@
76e38b
 #include <pwd.h>
76e38b
 #include <grp.h>
76e38b
 #include <errno.h>
76e38b
+#include <err.h>
76e38b
 
76e38b
 #include "queue.h"
76e38b
 #include "cfg.h"
76e38b
@@ -268,7 +269,6 @@ static int static_name_to_gid(char *name
76e38b
 
76e38b
 static int static_uid_to_name(uid_t uid, char *domain, char *name, size_t len)
76e38b
 {
76e38b
-	struct passwd *pw;
76e38b
 	struct uid_mapping * um;
76e38b
 
76e38b
 	for (um = LIST_FIRST (&uid_mappings[uid_hash (uid)]); um;
76e38b
@@ -284,7 +284,6 @@ static int static_uid_to_name(uid_t uid,
76e38b
 
76e38b
 static int static_gid_to_name(gid_t gid, char *domain, char *name, size_t len)
76e38b
 {
76e38b
-	struct group *gr;
76e38b
 	struct gid_mapping * gm;
76e38b
 
76e38b
 	for (gm = LIST_FIRST (&gid_mappings[gid_hash (gid)]); gm;
76e38b
@@ -305,7 +304,6 @@ static int static_gid_to_name(gid_t gid,
76e38b
 
76e38b
 static int static_init() {	
76e38b
 	int err;
76e38b
-	uid_t uid;
76e38b
 	struct conf_list * princ_list = NULL;
76e38b
 	struct conf_list_node * cln, *next;
76e38b
 	struct uid_mapping * unode;
76e38b
@@ -367,7 +365,7 @@ static int static_init() {
76e38b
 		next = TAILQ_NEXT (cln, link); 
76e38b
 
76e38b
 		gr = static_getgrnam(cln->field, NULL, &err;;
76e38b
-		if (!pw) {
76e38b
+		if (!gr) {
76e38b
 			continue;
76e38b
 		}
76e38b
 		
76e38b
@@ -376,19 +374,19 @@ static int static_init() {
76e38b
 		{
76e38b
 			warnx("static_init: calloc (1, %lu) failed",
76e38b
 				(unsigned long)sizeof *gnode);
76e38b
-			free(pw);
76e38b
+			free(gr);
76e38b
 			return -ENOMEM;
76e38b
 		}
76e38b
-		gnode->gid = pw->pw_uid;
76e38b
+		gnode->gid = gr->gr_gid;
76e38b
 		gnode->principal = strdup(cln->field);
76e38b
 
76e38b
 		gnode->localgroup = conf_get_str("Static", cln->field);
76e38b
 		if (!gnode->localgroup) {
76e38b
-			free(pw);
76e38b
+			free(gr);
76e38b
 			return -ENOENT;
76e38b
 		}
76e38b
 
76e38b
-		free(pw);
76e38b
+		free(gr);
76e38b
 
76e38b
 		LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link);
76e38b
 	}