Blame SOURCES/libnfsidmap-0.25-warnings.patch

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