s3:winbindd: Also log the process name in winbindd
authorAndreas Schneider <asn@samba.org>
Fri, 2 Nov 2018 17:45:26 +0000 (18:45 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 12 Nov 2018 08:50:25 +0000 (09:50 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd.c
source3/winbindd/winbindd.h

index 07a813293584be92881fd5dfa82e0b95114c8194..86c3cd952442736453016113f6b4d73c1e264dd5 100644 (file)
@@ -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;
index 6d4b92f27cfe70539da22db6aa0640de4a01bff0..7490d62a7051b36c984fc8791e99b4377d195cf7 100644 (file)
@@ -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' */