summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorPierre Carrier <geoffroy.carrier@gmail.com>2010-08-23 00:53:40 +0100
committerVolker Lendecke <vl@samba.org>2010-08-26 18:23:00 +0200
commit4b3630b7e7c843add1965b6d35b3f2020957c101 (patch)
tree43bdc9bfe280b73e802a12d8eeddc9dcf6b6b616 /source3/winbindd
parentb219bfe699ef9bfa91135808ef2ee192adf0245b (diff)
downloadsamba-4b3630b7e7c843add1965b6d35b3f2020957c101.tar.gz
samba-4b3630b7e7c843add1965b6d35b3f2020957c101.tar.bz2
samba-4b3630b7e7c843add1965b6d35b3f2020957c101.zip
winbindd: Add the client status in the clients list output
Hello list, Considered relevant by a customer. As I suppose one doesn't send SIGUSR2 very often, I didn't bother adding another DEBUGLEVEL. -- Pierre
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index a8605340fa..7a9ebb8a82 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -36,6 +36,7 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
+static bool client_is_idle(struct winbindd_cli_state *state);
static void remove_client(struct winbindd_cli_state *state);
static bool opt_nocache = False;
@@ -95,8 +96,9 @@ static void winbindd_status(void)
if (DEBUGLEVEL >= 2 && winbindd_num_clients()) {
DEBUG(2, ("\tclient list:\n"));
for(tmp = winbindd_client_list(); tmp; tmp = tmp->next) {
- DEBUGADD(2, ("\t\tpid %lu, sock %d\n",
- (unsigned long)tmp->pid, tmp->sock));
+ DEBUGADD(2, ("\t\tpid %lu, sock %d (%s)\n",
+ (unsigned long)tmp->pid, tmp->sock,
+ client_is_idle(tmp) ? "idle" : "active"));
}
}
}
@@ -858,6 +860,13 @@ static void remove_client(struct winbindd_cli_state *state)
TALLOC_FREE(state);
}
+/* Is a client idle? */
+
+static bool client_is_idle(struct winbindd_cli_state *state) {
+ return (state->response == NULL &&
+ !state->pwent_state && !state->grent_state);
+}
+
/* Shutdown client connection which has been idle for the longest time */
static bool remove_idle_client(void)
@@ -867,8 +876,7 @@ static bool remove_idle_client(void)
int nidle = 0;
for (state = winbindd_client_list(); state; state = state->next) {
- if (state->response == NULL &&
- !state->pwent_state && !state->grent_state) {
+ if (client_is_idle(state)) {
nidle++;
if (!last_access || state->last_access < last_access) {
last_access = state->last_access;