diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-09-27 00:22:04 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-09-27 00:22:04 +0000 |
commit | 756409c4cffe5a4ad6ef965c7cf14eecc3bf5760 (patch) | |
tree | 1bbd17925a97ce9935231b2b3e034418d27dfad3 /nscd/connections.c | |
parent | 6e42b0f1ac30da9806b6917378bf19335328096d (diff) | |
download | glibc-756409c4cffe5a4ad6ef965c7cf14eecc3bf5760.tar.gz glibc-756409c4cffe5a4ad6ef965c7cf14eecc3bf5760.tar.xz glibc-756409c4cffe5a4ad6ef965c7cf14eecc3bf5760.zip |
Update.
1999-09-26 Thorsten Kukuk <kukuk@suse.de> * nscd/connections.c: Invalidate caches on request. * nscd/nscd-client.h: Add INVALIDATE to request_type. * nscd/nscd.c: Add invalidate cache option. * nscd/nscd.conf: Change log directory to /var/log (FHS).
Diffstat (limited to 'nscd/connections.c')
-rw-r--r-- | nscd/connections.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/nscd/connections.c b/nscd/connections.c index eef2568863..cbacf9650a 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -61,7 +61,8 @@ const char *serv2str[LASTREQ] = [GETHOSTBYADDR] = "GETHOSTBYADDR", [GETHOSTBYADDRv6] = "GETHOSTBYADDRv6", [SHUTDOWN] = "SHUTDOWN", - [GETSTAT] = "GETSTAT" + [GETSTAT] = "GETSTAT", + [INVALIDATE] = "INVALIDATE" }; /* The control data structures for the services. */ @@ -193,6 +194,22 @@ close_sockets (void) close (sock); } +static void +invalidate_cache (void *key) +{ + dbtype number; + + if (strcmp (key, "passwd") == 0) + number = pwddb; + else if (strcmp (key, "group") == 0) + number = grpdb; + else if (strcmp (key, "hosts") == 0) + number = hstdb; + else return; + + prune_cache (&dbs[number], LONG_MAX); +} + /* Handle new request. */ static void @@ -272,9 +289,13 @@ cannot handle old request version %d; current version is %d"), pthread_rwlock_unlock (&db->lock); } - else - if (debug_level > 0) - dbg_log ("\t%s", serv2str[req->type]); + else if (debug_level > 0) + { + if (req->type == INVALIDATE) + dbg_log ("\t%s (%s)", serv2str[req->type], key); + else + dbg_log ("\t%s", serv2str[req->type]); + } /* Handle the request. */ switch (req->type) @@ -313,11 +334,14 @@ cannot handle old request version %d; current version is %d"), case GETSTAT: case SHUTDOWN: - /* Accept shutdown and getstat only from root */ + case INVALIDATE: + /* Accept shutdown, getstat and invalidate only from root */ if (secure_in_use && uid == 0) { if (req->type == GETSTAT) send_stats (fd, dbs); + else if (req->type == INVALIDATE) + invalidate_cache (key); else termination_handler (0); } @@ -338,6 +362,8 @@ cannot handle old request version %d; current version is %d"), { if (req->type == GETSTAT) send_stats (fd, dbs); + else if (req->type == INVALIDATE) + invalidate_cache (key); else termination_handler (0); } |