aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/connections.c22
-rw-r--r--nscd/nscd.c2
2 files changed, 17 insertions, 7 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 4daa099..9d1b4d3 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -311,13 +311,15 @@ cannot handle old request version %d; current version is %d"),
break;
case GETSTAT:
- send_stats (fd, dbs);
- break;
-
case SHUTDOWN:
- /* Accept shutdown only from root */
+ /* Accept shutdown and getstat only from root */
if (secure_in_use && uid == 0)
- termination_handler (0);
+ {
+ if (req->type == GETSTAT)
+ send_stats (fd, dbs);
+ else
+ termination_handler (0);
+ }
else
{
struct ucred caller;
@@ -330,8 +332,14 @@ cannot handle old request version %d; current version is %d"),
dbg_log (_("error getting callers id: %s"),
strerror_r (errno, buf, sizeof (buf)));
}
- else if (caller.uid == 0)
- termination_handler (0);
+ else
+ if (caller.uid == 0)
+ {
+ if (req->type == GETSTAT)
+ send_stats (fd, dbs);
+ else
+ termination_handler (0);
+ }
}
break;
diff --git a/nscd/nscd.c b/nscd/nscd.c
index af5ce42..8c61406 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -205,6 +205,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
case 'g':
+ if (getuid () != 0)
+ error (EXIT_FAILURE, 0, _("Only root is allowed to use this option!"));
receive_print_stats ();
/* Does not return. */