File 0018-gssd-ensure-that-preferred_realm-is-non-NULL-before-.patch of Package nfs-utils.3350

Commit: 8399548e6b904116e0e41d83e4a4b571af8ea578
References: bsc#935272
From: Jeff Layton <jlayton@primarydata.com>
Date: Fri, 12 Sep 2014 13:20:13 -0400
Subject: [PATCH] gssd: ensure that preferred_realm is non-NULL before passing
 it to strcmp

It's possible for "preferred_realm" to be NULL, in which case we
don't want to pass it to strcmp. Other places that use this variable
test whether it's NULL first -- we need to do the same here.

This should fix the gssd crash reported here:

    https://bugzilla.redhat.com/show_bug.cgi?id=1108615

Reported-by: Brian J. Murrell <brian@interlinx.bc.ca>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Acked-by: NeilBrown <neilb@suse.com>
---
 utils/gssd/krb5_util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -863,7 +863,7 @@ find_keytab_entry(krb5_context context,
 	i = 0;
 	realm = realmnames[i];
 
-	if (strcmp (realm, preferred_realm) != 0) {
+	if (preferred_realm && strcmp (realm, preferred_realm) != 0) {
 		realm = preferred_realm;
 		/* resetting the realmnames index */
 		i = -1;