--- old/usr/src/lib/libc/port/gen/nss_common.c	2016-06-23 11:18:57.575022989 -0400
+++ new/usr/src/lib/libc/port/gen/nss_common.c	2016-06-23 11:18:57.602443560 -0400
@@ -1024,11 +1024,10 @@
 	int n,
 	char *dbase,
 	struct __nsw_lookup_v1 *lkp)
-
 {
 	(void) fprintf(__nss_debug_file,
-		"NSS_retry(%d): '%s': trying '%s' ... ",
-		n, dbase, lkp->service_name);
+	    "NSS_retry(%d): '%s': trying '%s' ... ",
+	    n, dbase, lkp->service_name);
 	(void) fflush(__nss_debug_file);
 
 }
@@ -1037,7 +1036,6 @@
 output_loop_diag_b(
 	nss_status_t res,
 	struct __nsw_lookup_v1 *lkp)
-
 {
 	(void) fprintf(__nss_debug_file, "result=");
 	switch (res) {
@@ -1072,7 +1070,7 @@
 		break;
 	case __NSW_TRYAGAIN_NTIMES:
 		(void) fprintf(__nss_debug_file, "TRYAGAIN_NTIMES (N=%d)",
-			lkp->max_retries);
+		    lkp->max_retries);
 		break;
 	case __NSW_TRYAGAIN_PAUSED:
 		(void) fprintf(__nss_debug_file, "TRYAGAIN_PAUSED");
@@ -1150,7 +1148,7 @@
 
 nss_status_t
 nss_search(nss_db_root_t *rootp, nss_db_initf_t initf, int search_fnum,
-	void *search_args)
+    void *search_args)
 {
 	nss_status_t		res = NSS_UNAVAIL;
 	struct nss_db_state	*s;
@@ -1310,7 +1308,7 @@
 
 nss_status_t
 nss_getent(nss_db_root_t *rootp, nss_db_initf_t initf, nss_getent_t *contextpp,
-	void *args)
+    void *args)
 {
 	nss_status_t		status;
 
@@ -1364,7 +1362,7 @@
 
 static void
 nss_setent_u(nss_db_root_t *rootp, nss_db_initf_t initf,
-	nss_getent_t *contextpp)
+    nss_getent_t *contextpp)
 {
 	nss_status_t		status;
 	struct nss_db_state	*s;
@@ -1449,7 +1447,7 @@
 
 static nss_status_t
 nss_getent_u(nss_db_root_t *rootp, nss_db_initf_t initf,
-	nss_getent_t *contextpp, void *args)
+    nss_getent_t *contextpp, void *args)
 {
 	nss_status_t		status;
 	struct nss_db_state	*s;
@@ -1533,7 +1531,7 @@
 /*ARGSUSED*/
 static void
 nss_endent_u(nss_db_root_t *rootp, nss_db_initf_t initf,
-	nss_getent_t *contextpp)
+    nss_getent_t *contextpp)
 {
 	nss_status_t		status;
 	struct nss_getent_context *contextp;
@@ -1654,7 +1652,7 @@
 /*ARGSUSED*/
 nss_status_t
 nss_pack(void *buffer, size_t bufsize, nss_db_root_t *rootp,
-	    nss_db_initf_t initf, int search_fnum, void *search_args)
+    nss_db_initf_t initf, int search_fnum, void *search_args)
 {
 	nss_pheader_t		*pbuf = (nss_pheader_t *)buffer;
 	nss_XbyY_args_t		*in = (nss_XbyY_args_t *)search_args;
@@ -1762,7 +1760,7 @@
 /*ARGSUSED*/
 nss_status_t
 nss_pack_ent(void *buffer, size_t bufsize, nss_db_root_t *rootp,
-	    nss_db_initf_t initf, nss_getent_t *contextpp)
+    nss_db_initf_t initf, nss_getent_t *contextpp)
 {
 	nss_pheader_t		*pbuf = (nss_pheader_t *)buffer;
 	struct nss_getent_context *contextp = contextpp->ctx;
@@ -1836,7 +1834,7 @@
 /*ARGSUSED*/
 nss_status_t
 nss_unpack(void *buffer, size_t bufsize, nss_db_root_t *rootp,
-	    nss_db_initf_t initf, int search_fnum, void *search_args)
+    nss_db_initf_t initf, int search_fnum, void *search_args)
 {
 	nss_pheader_t		*pbuf = (nss_pheader_t *)buffer;
 	nss_XbyY_args_t		*in = (nss_XbyY_args_t *)search_args;
@@ -1937,7 +1935,7 @@
 /*ARGSUSED*/
 nss_status_t
 nss_unpack_ent(void *buffer, size_t bufsize, nss_db_root_t *rootp,
-	    nss_db_initf_t initf, nss_getent_t *contextpp, void *args)
+    nss_db_initf_t initf, nss_getent_t *contextpp, void *args)
 {
 	nss_pheader_t		*pbuf = (nss_pheader_t *)buffer;
 	nss_XbyY_args_t		*in = (nss_XbyY_args_t *)args;
@@ -2009,7 +2007,7 @@
 
 nss_status_t
 _nsc_search(nss_db_root_t *rootp, nss_db_initf_t initf, int search_fnum,
-	void *search_args)
+    void *search_args)
 {
 	nss_pheader_t		*pbuf;
 	void			*doorptr = NULL;
@@ -2084,7 +2082,7 @@
  */
 nss_status_t
 _nsc_setent_u(nss_db_root_t *rootp, nss_db_initf_t initf,
-	nss_getent_t *contextpp)
+    nss_getent_t *contextpp)
 {
 	nss_status_t		status = NSS_TRYLOCAL;
 	struct nss_getent_context *contextp = contextpp->ctx;
@@ -2161,7 +2159,7 @@
 
 nss_status_t
 _nsc_getent_u(nss_db_root_t *rootp, nss_db_initf_t initf,
-	nss_getent_t *contextpp, void *args)
+    nss_getent_t *contextpp, void *args)
 {
 	nss_status_t		status = NSS_TRYLOCAL;
 	struct nss_getent_context *contextp = contextpp->ctx;
@@ -2228,7 +2226,7 @@
 
 nss_status_t
 _nsc_endent_u(nss_db_root_t *rootp, nss_db_initf_t initf,
-	nss_getent_t *contextpp)
+    nss_getent_t *contextpp)
 {
 	nss_status_t		status = NSS_TRYLOCAL;
 	struct nss_getent_context *contextp = contextpp->ctx;
@@ -2298,3 +2296,11 @@
 	}
 	return (__nss_buflen_default);
 }
+
+void *
+_nss_XbyY_fini(nss_XbyY_args_t *args)
+{
+	if ((args->returnval == NULL) && (args->erange != 0))
+		errno = ERANGE;
+	return (args->returnval);
+}
