From a1c542bfc5684d914cf2af2c3ec9d5432d0b01dc Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 11 Jun 1999 20:58:21 +0000 Subject: Update. 1999-06-11 Thorsten Kukuk * nscd/nscd.c: Add -S options for separate caching of data for every user. So one user couldn't see the data another user has gotten with his credentials. * nscd/nscd.h: Add new prototypes. * nscd/cache.c: Compare owner of cache entry if in secure mode. * nscd/connections.c: Check on shutdown if caller really was root. In secure mode get uid of caller. * nscd/grpcache.c: Add support for new secure group mode. * nscd/hstcache.c: Add support for new secure hosts mode. * nscd/pwdcache.c: Add support for new secure passwd mode. --- nscd/cache.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'nscd/cache.c') diff --git a/nscd/cache.c b/nscd/cache.c index e57c8686d2..0071c11524 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -38,7 +38,8 @@ This function must be called with the read-lock held. */ struct hashentry * -cache_search (int type, void *key, size_t len, struct database *table) +cache_search (int type, void *key, size_t len, struct database *table, + uid_t owner) { unsigned long int hash = __nis_hash (key, len) % table->module; struct hashentry *work; @@ -47,8 +48,8 @@ cache_search (int type, void *key, size_t len, struct database *table) while (work != NULL) { - if (type == work->type - && len == work->len && memcmp (key, work->key, len) == 0) + if (type == work->type && len == work->len + && memcmp (key, work->key, len) == 0 && work->owner == owner) { /* We found the entry. Increment the appropriate counter. */ if (work->data == (void *) -1) @@ -76,7 +77,7 @@ cache_search (int type, void *key, size_t len, struct database *table) the readlock reduces the chance of conflicts. */ void cache_add (int type, void *key, size_t len, const void *packet, size_t total, - void *data, int last, time_t t, struct database *table) + void *data, int last, time_t t, struct database *table, uid_t owner) { unsigned long int hash = __nis_hash (key, len) % table->module; struct hashentry *newp; @@ -88,6 +89,7 @@ cache_add (int type, void *key, size_t len, const void *packet, size_t total, newp->type = type; newp->len = len; newp->key = key; + newp->owner = owner; newp->data = data; newp->timeout = t; newp->packet = packet; -- cgit v1.2.1