From aadd7d9d2645450f757ea99234192abb9aa7e244 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 13 Sep 2004 17:24:41 +0000 Subject: [PATCH] Update. 2004-09-13 Thorsten Kukuk * nscd/nscd_stat.c: Don't access dbs[cnt].head for disabled services. * nscd/nscd.init: Fix path to socket. --- ChangeLog | 6 ++++++ nscd/nscd.init | 2 +- nscd/nscd_helper.c | 4 ++-- nscd/nscd_stat.c | 30 +++++++++++++++++------------- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e3dd23..ed08e6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-09-13 Thorsten Kukuk + + * nscd/nscd_stat.c: Don't access dbs[cnt].head for disabled services. + + * nscd/nscd.init: Fix path to socket. + 2004-09-12 Ulrich Drepper * nscd/nscd_helper.c (get_mapping): Correctly check cmsg length. diff --git a/nscd/nscd.init b/nscd/nscd.init index 3796b3d..568fe3e 100644 --- a/nscd/nscd.init +++ b/nscd/nscd.init @@ -62,7 +62,7 @@ stop () { # nscd won't be able to remove these if it is running as # a non-privileged user rm -f /var/run/nscd/nscd.pid - rm -f /var/run/nscd/.socket + rm -f /var/run/nscd/socket success $"$prog shutdown" else failure $"$prog shutdown" diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index ff27b07..e40500c 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -141,11 +141,11 @@ get_mapping (request_type type, const char *key, if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0)) != keylen) goto out_close2; + mapfd = *(int *) CMSG_DATA (cmsg); + if (CMSG_FIRSTHDR (&msg)->cmsg_len != CMSG_LEN (sizeof (int))) goto out_close; - mapfd = *(int *) CMSG_DATA (cmsg); - struct stat64 st; if (strcmp (resdata, key) != 0 || fstat64 (mapfd, &st) != 0 diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c index 73dafe1..ebdfeac 100644 --- a/nscd/nscd_stat.c +++ b/nscd/nscd_stat.c @@ -88,25 +88,29 @@ send_stats (int fd, struct database_dyn dbs[lastdb]) for (cnt = 0; cnt < lastdb; ++cnt) { + memset (&data.dbs[cnt], 0, sizeof (data.dbs[cnt])); data.dbs[cnt].enabled = dbs[cnt].enabled; data.dbs[cnt].check_file = dbs[cnt].check_file; data.dbs[cnt].shared = dbs[cnt].shared; data.dbs[cnt].persistent = dbs[cnt].persistent; - data.dbs[cnt].module = dbs[cnt].head->module; data.dbs[cnt].postimeout = dbs[cnt].postimeout; data.dbs[cnt].negtimeout = dbs[cnt].negtimeout; - data.dbs[cnt].poshit = dbs[cnt].head->poshit; - data.dbs[cnt].neghit = dbs[cnt].head->neghit; - data.dbs[cnt].posmiss = dbs[cnt].head->posmiss; - data.dbs[cnt].negmiss = dbs[cnt].head->negmiss; - data.dbs[cnt].nentries = dbs[cnt].head->nentries; - data.dbs[cnt].maxnentries = dbs[cnt].head->maxnentries; - data.dbs[cnt].datasize = dbs[cnt].head->data_size; - data.dbs[cnt].dataused = dbs[cnt].head->first_free; - data.dbs[cnt].maxnsearched = dbs[cnt].head->maxnsearched; - data.dbs[cnt].rdlockdelayed = dbs[cnt].head->rdlockdelayed; - data.dbs[cnt].wrlockdelayed = dbs[cnt].head->wrlockdelayed; - data.dbs[cnt].addfailed = dbs[cnt].head->addfailed; + if (dbs[cnt].head != NULL) + { + data.dbs[cnt].module = dbs[cnt].head->module; + data.dbs[cnt].poshit = dbs[cnt].head->poshit; + data.dbs[cnt].neghit = dbs[cnt].head->neghit; + data.dbs[cnt].posmiss = dbs[cnt].head->posmiss; + data.dbs[cnt].negmiss = dbs[cnt].head->negmiss; + data.dbs[cnt].nentries = dbs[cnt].head->nentries; + data.dbs[cnt].maxnentries = dbs[cnt].head->maxnentries; + data.dbs[cnt].datasize = dbs[cnt].head->data_size; + data.dbs[cnt].dataused = dbs[cnt].head->first_free; + data.dbs[cnt].maxnsearched = dbs[cnt].head->maxnsearched; + data.dbs[cnt].rdlockdelayed = dbs[cnt].head->rdlockdelayed; + data.dbs[cnt].wrlockdelayed = dbs[cnt].head->wrlockdelayed; + data.dbs[cnt].addfailed = dbs[cnt].head->addfailed; + } } if (TEMP_FAILURE_RETRY (write (fd, &data, sizeof (data))) != sizeof (data)) -- 2.7.4