[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r14398 - in /fsf/trunk/libc: ./ nis/nss_compat/ nscd/



Author: eglibc
Date: Sat Jul  2 00:02:31 2011
New Revision: 14398

Log:
Import glibc-mainline for 2011-07-02

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/nis/nss_compat/compat-pwd.c
    fsf/trunk/libc/nis/nss_compat/compat-spwd.c
    fsf/trunk/libc/nscd/aicache.c
    fsf/trunk/libc/nscd/grpcache.c
    fsf/trunk/libc/nscd/hstcache.c
    fsf/trunk/libc/nscd/initgrcache.c
    fsf/trunk/libc/nscd/pwdcache.c
    fsf/trunk/libc/nscd/servicescache.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Jul  2 00:02:31 2011
@@ -1,3 +1,25 @@
+2011-07-01  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* nscd/pwdcache.c (cache_addpw): Cleanup.  Add branch prediction.
+	* nscd/initgrcache.c (addinitgroupsX): Likewise.
+	* nscd/hstcache.c (cache_addhst): Likewise.
+	* nscd/grpcache.c (cache_addgr): Likewise.
+	* nscd/aicache.c (addhstaiX): Likewise
+	* nscd/servicescache.c (cache_addserv): Handle zero negtimeout.
+
+2011-07-01  Thorsten Kukuk  <kukuk@xxxxxxx>
+
+	* nscd/pwdcache.c (cache_addpw): Handle zero negtimeout.
+	* nscd/initgrcache.c (addinitgroupsX): Likewise.
+	* nscd/hstcache.c (cache_addhst): Likewise.
+	* nscd/grpcache.c (cache_addgr): Likewise.
+	* nscd/aicache.c (addhstaiX): Likewise
+
+2011-07-01  Andreas Schwab  <schwab@xxxxxxxxxx>
+
+	* nis/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Query NIS
+	domain only when needed.
+
 2011-06-30  Andreas Schwab  <schwab@xxxxxxxxxx>
 
 	* sysdeps/posix/getaddrinfo.c (gaih_inet): Make sure RES_USE_INET6

Modified: fsf/trunk/libc/nis/nss_compat/compat-pwd.c
==============================================================================
--- fsf/trunk/libc/nis/nss_compat/compat-pwd.c (original)
+++ fsf/trunk/libc/nis/nss_compat/compat-pwd.c Sat Jul  2 00:02:31 2011
@@ -361,7 +361,7 @@
 			 char *group, char *buffer, size_t buflen,
 			 int *errnop)
 {
-  char *curdomain, *host, *user, *domain, *p2;
+  char *curdomain = NULL, *host, *user, *domain, *p2;
   int status;
   size_t p2len;
 
@@ -370,15 +370,7 @@
   if (!nss_getpwnam_r)
     return NSS_STATUS_UNAVAIL;
 
-  if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
-    {
-      ent->netgroup = false;
-      ent->first = false;
-      give_pwd_free (&ent->pwd);
-      return NSS_STATUS_UNAVAIL;
-    }
-
-  if (ent->first == true)
+  if (ent->first)
     {
       memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
       __internal_setnetgrent (group, &ent->netgrdata);
@@ -401,8 +393,19 @@
       if (user == NULL || user[0] == '-')
 	continue;
 
-      if (domain != NULL && strcmp (curdomain, domain) != 0)
-	continue;
+      if (domain != NULL)
+	{
+	  if (curdomain == NULL
+	      && yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
+	    {
+	      __internal_endnetgrent (&ent->netgrdata);
+	      ent->netgroup = false;
+	      give_pwd_free (&ent->pwd);
+	      return NSS_STATUS_UNAVAIL;
+	    }
+	  if (strcmp (curdomain, domain) != 0)
+	    continue;
+	}
 
       /* If name != NULL, we are called from getpwnam.  */
       if (name != NULL)

Modified: fsf/trunk/libc/nis/nss_compat/compat-spwd.c
==============================================================================
--- fsf/trunk/libc/nis/nss_compat/compat-spwd.c (original)
+++ fsf/trunk/libc/nis/nss_compat/compat-spwd.c Sat Jul  2 00:02:31 2011
@@ -318,7 +318,7 @@
 			 char *group, char *buffer, size_t buflen,
 			 int *errnop)
 {
-  char *curdomain, *host, *user, *domain, *p2;
+  char *curdomain = NULL, *host, *user, *domain, *p2;
   size_t p2len;
 
   if (!nss_getspnam_r)
@@ -328,15 +328,7 @@
   if (ent->setent_status != NSS_STATUS_SUCCESS)
     return ent->setent_status;
 
-  if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
-    {
-      ent->netgroup = false;
-      ent->first = false;
-      give_spwd_free (&ent->pwd);
-      return NSS_STATUS_UNAVAIL;
-    }
-
-  if (ent->first == true)
+  if (ent->first)
     {
       memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
       __internal_setnetgrent (group, &ent->netgrdata);
@@ -361,8 +353,19 @@
       if (user == NULL || user[0] == '-')
 	continue;
 
-      if (domain != NULL && strcmp (curdomain, domain) != 0)
-	continue;
+      if (domain != NULL)
+	{
+	  if (curdomain == NULL
+	      && yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
+	    {
+	      __internal_endnetgrent (&ent->netgrdata);
+	      ent->netgroup = false;
+	      give_spwd_free (&ent->pwd);
+	      return NSS_STATUS_UNAVAIL;
+	    }
+	  if (strcmp (curdomain, domain) != 0)
+	    continue;
+	}
 
       /* If name != NULL, we are called from getpwnam */
       if (name != NULL)

Modified: fsf/trunk/libc/nscd/aicache.c
==============================================================================
--- fsf/trunk/libc/nscd/aicache.c (original)
+++ fsf/trunk/libc/nscd/aicache.c Sat Jul  2 00:02:31 2011
@@ -511,9 +511,16 @@
       if (fd != -1)
 	TEMP_FAILURE_RETRY (send (fd, &notfound, total, MSG_NOSIGNAL));
 
-      dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1);
       /* If we cannot permanently store the result, so be it.  */
-      if (dataset != NULL)
+      if (__builtin_expect (db->negtimeout == 0, 0))
+	{
+	  /* Mark the old entry as obsolete.  */
+	  if (dh != NULL)
+	    dh->usable = false;
+	  dataset = NULL;
+	}
+      else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
+					      + req->key_len), 1)) != NULL)
 	{
 	  dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	  dataset->head.recsize = total;

Modified: fsf/trunk/libc/nscd/grpcache.c
==============================================================================
--- fsf/trunk/libc/nscd/grpcache.c (original)
+++ fsf/trunk/libc/nscd/grpcache.c Sat Jul  2 00:02:31 2011
@@ -118,10 +118,14 @@
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
 						MSG_NOSIGNAL));
 
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
-				   1);
 	  /* If we cannot permanently store the result, so be it.  */
-	  if (dataset != NULL)
+	  if (db->negtimeout == 0)
+	    {
+	      /* Mark the old entry as obsolete.  */
+	      if (dh != NULL)
+		dh->usable = false;
+	    }
+	  else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
 	    {
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	      dataset->head.recsize = total;

Modified: fsf/trunk/libc/nscd/hstcache.c
==============================================================================
--- fsf/trunk/libc/nscd/hstcache.c (original)
+++ fsf/trunk/libc/nscd/hstcache.c Sat Jul  2 00:02:31 2011
@@ -141,10 +141,15 @@
 					MSG_NOSIGNAL)) != total)
 	    all_written = false;
 
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
-				   1);
 	  /* If we cannot permanently store the result, so be it.  */
-	  if (dataset != NULL)
+	  if (__builtin_expect (db->negtimeout == 0, 0))
+	    {
+	      /* Mark the old entry as obsolete.  */
+	      if (dh != NULL)
+		dh->usable = false;
+	    }
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
+						  + req->key_len), 1)) != NULL)
 	    {
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	      dataset->head.recsize = total;

Modified: fsf/trunk/libc/nscd/initgrcache.c
==============================================================================
--- fsf/trunk/libc/nscd/initgrcache.c (original)
+++ fsf/trunk/libc/nscd/initgrcache.c Sat Jul  2 00:02:31 2011
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 2004, 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2004-2006, 2008, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2004.
 
@@ -202,10 +202,15 @@
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
 						MSG_NOSIGNAL));
 
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
-				   1);
 	  /* If we cannot permanently store the result, so be it.  */
-	  if (dataset != NULL)
+	  if (__builtin_expect (db->negtimeout == 0, 0))
+	    {
+	      /* Mark the old entry as obsolete.  */
+	      if (dh != NULL)
+		dh->usable = false;
+	    }
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
+						  + req->key_len), 1)) != NULL)
 	    {
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	      dataset->head.recsize = total;

Modified: fsf/trunk/libc/nscd/pwdcache.c
==============================================================================
--- fsf/trunk/libc/nscd/pwdcache.c (original)
+++ fsf/trunk/libc/nscd/pwdcache.c Sat Jul  2 00:02:31 2011
@@ -124,10 +124,15 @@
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
 						MSG_NOSIGNAL));
 
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
-				   1);
 	  /* If we cannot permanently store the result, so be it.  */
-	  if (dataset != NULL)
+	  if (__builtin_expect (db->negtimeout == 0, 0))
+	    {
+	      /* Mark the old entry as obsolete.  */
+	      if (dh != NULL)
+		dh->usable = false;
+	    }
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
+						  + req->key_len), 1)) != NULL)
 	    {
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	      dataset->head.recsize = total;

Modified: fsf/trunk/libc/nscd/servicescache.c
==============================================================================
--- fsf/trunk/libc/nscd/servicescache.c (original)
+++ fsf/trunk/libc/nscd/servicescache.c Sat Jul  2 00:02:31 2011
@@ -108,10 +108,15 @@
 	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
 						MSG_NOSIGNAL));
 
-	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
-				   1);
 	  /* If we cannot permanently store the result, so be it.  */
-	  if (dataset != NULL)
+	  if (__builtin_expect (db->negtimeout == 0, 0))
+	    {
+	      /* Mark the old entry as obsolete.  */
+	      if (dh != NULL)
+		dh->usable = false;
+	    }
+	  else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
+						  + req->key_len), 1)) != NULL)
 	    {
 	      dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
 	      dataset->head.recsize = total;