about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-27 22:52:49 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-27 22:52:49 +0000
commitdc630ccc08c8af6fdf936e5a5bf7420b3ebf0368 (patch)
tree97d2b49d0b50c37881f2ab35e78e22e4feaebdba
parenta29015c344a68dfb82dfd725145873c97b264321 (diff)
downloadglibc-dc630ccc08c8af6fdf936e5a5bf7420b3ebf0368.tar.gz
glibc-dc630ccc08c8af6fdf936e5a5bf7420b3ebf0368.tar.xz
glibc-dc630ccc08c8af6fdf936e5a5bf7420b3ebf0368.zip
Update.
2004-07-27  Ulrich Drepper  <drepper@redhat.com>

	* nscd/grpcache.c (cache_addgr): If necessary, add entry also
	under the name the user provided.
	* nscd/pwdcache.c (cache_addpw): Likewise.
-rw-r--r--ChangeLog6
-rw-r--r--nscd/grpcache.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ff290831a8..b7d78ee600 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-27  Ulrich Drepper  <drepper@redhat.com>
+
+	* nscd/grpcache.c (cache_addgr): If necessary, add entry also
+	under the name the user provided.
+	* nscd/pwdcache.c (cache_addpw): Likewise.
+
 2004-07-26  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/posix/waitid.c [WEXITED]: Clear WEXITED bit in OPTIONS for
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 5d72547a68..2ad6251762 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -75,7 +75,7 @@ struct groupdata
 
 static void
 cache_addgr (struct database *db, int fd, request_header *req, void *key,
-	     struct group *grp, uid_t owner)
+	     struct group *grp, uid_t owner, int type)
 {
   ssize_t total;
   ssize_t written;
@@ -179,6 +179,11 @@ cache_addgr (struct database *db, int fd, request_header *req, void *key,
       cache_add (GETGRBYNAME, gr_name, gr_name_len, data,
 		 total, data, 0, t, db, owner);
 
+      /* If the key is different from the name add a separate entry.  */
+      if (type == GETGRBYNAME && strcmp (key, gr_name) != 0)
+	cache_add (GETGRBYNAME, key, strlen (key) + 1, data,
+		   total, data, 0, t, db, owner);
+
       cache_add (GETGRBYGID, cp, n, data, total, data, 1, t, db, owner);
 
       pthread_rwlock_unlock (&db->lock);
@@ -248,7 +253,7 @@ addgrbyname (struct database *db, int fd, request_header *req,
   if (secure[grpdb])
     seteuid (oldeuid);
 
-  cache_addgr (db, fd, req, key, grp, uid);
+  cache_addgr (db, fd, req, key, grp, uid, GETGRBYNAME);
 
   if (use_malloc)
     free (buffer);
@@ -320,7 +325,7 @@ addgrbygid (struct database *db, int fd, request_header *req,
   if (secure[grpdb])
     seteuid (oldeuid);
 
-  cache_addgr (db, fd, req, key, grp, uid);
+  cache_addgr (db, fd, req, key, grp, uid, GETGRBYGID);
 
   if (use_malloc)
     free (buffer);