changeset 3610:7a2f3e83a236

6485580 "profiles -l" does not pick up exec_attr entries from nis maps
author sdussud
date Wed, 07 Feb 2007 12:22:46 -0800
parents 830fc2eee22a
children 9e3661edaad0
files usr/src/lib/nsswitch/nis/common/getexecattr.c
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/nsswitch/nis/common/getexecattr.c	Wed Feb 07 11:21:08 2007 -0800
+++ b/usr/src/lib/nsswitch/nis/common/getexecattr.c	Wed Feb 07 12:22:46 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -202,7 +202,18 @@
 	_priv_execattr	*_priv_exec = (_priv_execattr *)(argp->key.attrp);
 
 	if (instatus != YP_TRUE) {
-		*(eargp->yp_status) = YPERR_YPERR;
+		/*
+		 * If we have no more data to look at, we want to
+		 * keep yp_status from previous key/value pair
+		 * that we processed.
+		 * If this is the 1st time we enter this callback,
+		 * yp_status is already set to YPERR_YPERR
+		 * (see _exec_nis_lookup() for when this callback
+		 * and arguments are set initially).
+		 */
+		if (instatus != YP_NOMORE) {
+			*(eargp->yp_status) = YPERR_YPERR;
+		}
 		return (0);	/* yp_all may decide otherwise... */
 	}
 
@@ -325,6 +336,15 @@
 		case YPERR_BUSY:
 			res = NSS_TRYAGAIN;
 			break;
+		case YPERR_KEY:
+			/*
+			 * If no such key, return NSS_NOTFOUND
+			 * as this looks more relevant; it will
+			 * also help libnsl to try with another
+			 * policy (see _getexecprof()).
+			 */
+			res = NSS_NOTFOUND;
+			break;
 		default:
 			res = NSS_UNAVAIL;
 			break;