Fix for Bug #305

Thorsten Kukuk kukuk@suse.de
Wed Dec 8 09:22:00 GMT 2004


Hi,

this is for Bug #305: It seems new NIS+ server are now sending
empty strings with length field "1".

  Thorsten
-- 
Thorsten Kukuk         http://www.suse.de/~kukuk/      kukuk@suse.de
SuSE Linux Products GmbH       Maxfeldstr. 5       D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
2004-12-08  Thorsten Kukuk  <kukuk@suse.de>

	* nis/nss_nisplus/nisplus-netgrp.c (_nss_nisplus_getnetgrent_r):
	Add check if the value is not an empty string [Bug #305]

--- nis/nss_nisplus/nisplus-netgrp.c
+++ nis/nss_nisplus/nisplus-netgrp.c	2004/12/07 12:40:18
@@ -88,7 +88,9 @@
 
       result->type = triple_val;
 
-      if (hostlen == 0)
+      if (hostlen == 0 ||
+	  NISENTRYVAL (result->position, 2,
+		       (nis_result *) result->data)[0] == '\0')
 	result->val.triple.host = NULL;
       else
 	{
@@ -99,7 +101,9 @@
 	  *cp++ = '\0';
 	}
 
-      if (userlen == 0)
+      if (userlen == 0 ||
+	  NISENTRYVAL (result->position, 3,
+		       (nis_result *) result->data)[0] == '\0')
 	result->val.triple.user = NULL;
       else
 	{
@@ -110,7 +114,9 @@
 	  *cp++ = '\0';
 	}
 
-      if (domainlen == 0)
+      if (domainlen == 0 ||
+	  NISENTRYVAL (result->position, 4,
+		       (nis_result *) result->data)[0] == '\0')
 	result->val.triple.domain = NULL;
       else
 	{


More information about the Libc-hacker mailing list