From 305f3bc492b2d0664cafbd805f3a668a37d4ebc1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 2 Nov 2018 18:45:26 +0100 Subject: [PATCH] s3:winbindd: Also log the process name in winbindd Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- source3/winbindd/winbindd.c | 19 ++++++++++++++----- source3/winbindd/winbindd.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 07a81329358..86c3cd95244 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -708,6 +708,9 @@ static struct tevent_req *process_request_send( /* Remember who asked us. */ cli_state->pid = cli_state->request->pid; + memcpy(cli_state->client_name, + cli_state->request->client_name, + sizeof(cli_state->client_name)); cli_state->cmd_name = "unknown request"; cli_state->recv_fn = NULL; @@ -734,8 +737,11 @@ static struct tevent_req *process_request_send( cli_state->cmd_name = atable->cmd_name; cli_state->recv_fn = atable->recv_req; - DEBUG(10, ("process_request: Handling async request %d:%s\n", - (int)cli_state->pid, cli_state->cmd_name)); + DBG_DEBUG("process_request: " + "Handling async request %s(%d):%s\n", + cli_state->client_name, + (int)cli_state->pid, + cli_state->cmd_name); subreq = atable->send_req( state, @@ -797,7 +803,8 @@ static void process_request_done(struct tevent_req *subreq) status = cli_state->recv_fn(subreq, cli_state->response); TALLOC_FREE(subreq); - DBG_DEBUG("[%d:%s]: %s\n", + DBG_DEBUG("[%s(%d):%s]: %s\n", + cli_state->client_name, (int)cli_state->pid, cli_state->cmd_name, nt_errstr(status)); @@ -841,8 +848,10 @@ static void process_request_written(struct tevent_req *subreq) return; } - DBG_DEBUG("[%d:%s]: delivered response to client\n", - (int)cli_state->pid, cli_state->cmd_name); + DBG_DEBUG("[%s(%d):%s]: delivered response to client\n", + cli_state->client_name, + (int)cli_state->pid, + cli_state->cmd_name); TALLOC_FREE(cli_state->mem_ctx); cli_state->response = NULL; diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index 6d4b92f27cf..7490d62a705 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -47,6 +47,7 @@ struct winbindd_cli_state { struct winbindd_cli_state *prev, *next; /* Linked list pointers */ int sock; /* Open socket from client */ pid_t pid; /* pid of client */ + char client_name[32]; /* The process name of the client */ time_t last_access; /* Time of last access (read or write) */ bool privileged; /* Is the client 'privileged' */