about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-05-21 21:23:18 +0000
committerUlrich Drepper <drepper@redhat.com>2007-05-21 21:23:18 +0000
commite2b1e3431247f32ce1192839fe39984af0a923cf (patch)
treecb6b37727791dccdeac2c6399b80b81ff4809295
parentbfe6f5fa899ebc951222e5c29d33c9c223824a1e (diff)
downloadglibc-e2b1e3431247f32ce1192839fe39984af0a923cf.tar.gz
glibc-e2b1e3431247f32ce1192839fe39984af0a923cf.tar.xz
glibc-e2b1e3431247f32ce1192839fe39984af0a923cf.zip
* nscd/aicache.c (addhstaiX): If reported TTL is zero don't cache
	the entry.
-rw-r--r--ChangeLog3
-rw-r--r--nscd/aicache.c22
2 files changed, 8 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 000a9ac99e..4b582368b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-05-21  Ulrich Drepper  <drepper@redhat.com>
 
+	* nscd/aicache.c (addhstaiX): If reported TTL is zero don't cache
+	the entry.
+
 	* sysdeps/unix/sysv/linux/x86_64/sysconf.c: Move cache information
 	handling to ...
 	* sysdeps/x86_64/cacheinfo.c: ... here.  New file.
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 4640b4df94..bccac3abbc 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -1,5 +1,5 @@
 /* Cache handling for host lookup.
-   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -78,15 +78,6 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	dbg_log (_("Reloading \"%s\" in hosts cache!"), (char *) key);
     }
 
-#if 0
-  uid_t oldeuid = 0;
-  if (db->secure)
-    {
-      oldeuid = geteuid ();
-      pthread_seteuid_np (uid);
-    }
-#endif
-
   static service_user *hosts_database;
   service_user *nip = NULL;
   int no_more;
@@ -263,8 +254,10 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 
 	      total = sizeof (*dataset) + naddrs + addrslen + canonlen;
 
-	      /* Now we can allocate the data structure.  */
-	      if (he == NULL)
+	      /* Now we can allocate the data structure.  If the TTL
+		 of the entry is reported as zero do not cache the
+		 entry at all.  */
+	      if (ttl != 0 && he == NULL)
 		{
 		  dataset = (struct dataset *) mempool_alloc (db,
 							      total
@@ -453,11 +446,6 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
  out:
   _res.options = old_res_options;
 
-#if 0
-  if (db->secure)
-    pthread_seteuid_np (oldeuid);
-#endif
-
   if (dataset != NULL && !alloca_used)
     {
       /* If necessary, we also propagate the data to disk.  */