Blame SOURCES/libnfsidmap-0.25-nullnames.patch

d63810
commit 82718594eb8e6afabc572cea2da1caab69e9a720
d63810
Author: Steve Dickson <steved@redhat.com>
d63810
Date:   Thu Apr 30 13:55:32 2015 -0400
d63810
d63810
    Handle NULL names better
d63810
    
d63810
    Detect when an application passes in NULL names
d63810
    and fail gracefully instead of crashing hard.
d63810
    
d63810
    Signed-off-by: Steve Dickson <steved@redhat.com>
d63810
d63810
diff --git a/libnfsidmap.c b/libnfsidmap.c
d63810
index 833f94c..a8a9229 100644
d63810
--- a/libnfsidmap.c
d63810
+++ b/libnfsidmap.c
d63810
@@ -100,8 +100,11 @@ static char * toupper_str(char *s)
d63810
 
d63810
 static int id_as_chars(char *name, uid_t *id)
d63810
 {
d63810
-	long int value = strtol(name, NULL, 10);
d63810
+	long int value;
d63810
 
d63810
+	if (name == NULL)
d63810
+		return 0;
d63810
+	value = strtol(name, NULL, 10);
d63810
 	if (value == 0) {
d63810
 		/* zero value ids are valid */
d63810
 		if (strcmp(name, "0") != 0)
d63810
diff --git a/nss.c b/nss.c
d63810
index f8129fe..b3fef5a 100644
d63810
--- a/nss.c
d63810
+++ b/nss.c
d63810
@@ -135,6 +135,9 @@ static char *strip_domain(const char *name, const char *domain)
d63810
 	char *l = NULL;
d63810
 	int len;
d63810
 
d63810
+	if (name == NULL)
d63810
+		goto out;
d63810
+
d63810
 	c = strrchr(name, '@');
d63810
 	if (c == NULL && domain != NULL)
d63810
 		goto out;