s3:winbindd: add DEBUG(10,...) for the end of each top level
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Mar 2010 10:16:12 +0000 (11:16 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Mar 2010 07:41:00 +0000 (09:41 +0200)
That will hopefully make debugging a bit easier (at least for me).

metze
(cherry picked from commit 31293c64a323eb59fd8e81cd44bb33768a43e0c0)

Fix bug #7225 (Make winbindd logs more verbose for troubleshooting).
(cherry picked from commit 1c8e5543195e418605ff468eecf64bfa7e0761aa)

source3/winbindd/winbindd.c
source3/winbindd/winbindd.h

index c0b42b811d7bf9044819caee649993275e4a9547..f3c269731d8375066bc714ad874941652cc66d93 100644 (file)
@@ -570,6 +570,9 @@ static void process_request(struct winbindd_cli_state *state)
        /* Remember who asked us. */
        state->pid = state->request->pid;
 
+       state->cmd_name = "unknown request";
+       state->recv_fn = NULL;
+
        /* Process command */
 
        for (atable = async_nonpriv_table; atable->send_req; atable += 1) {
@@ -590,8 +593,11 @@ static void process_request(struct winbindd_cli_state *state)
        if (atable->send_req != NULL) {
                struct tevent_req *req;
 
-               DEBUG(10, ("process_request: Handling async request %s\n",
-                          atable->cmd_name));
+               state->cmd_name = atable->cmd_name;
+               state->recv_fn = atable->recv_req;
+
+               DEBUG(10, ("process_request: Handling async request %d:%s\n",
+                          (int)state->pid, state->cmd_name));
 
                req = atable->send_req(state->mem_ctx, winbind_event_context(),
                                       state, state->request);
@@ -602,7 +608,6 @@ static void process_request(struct winbindd_cli_state *state)
                        return;
                }
                tevent_req_set_callback(req, wb_request_done, state);
-               state->recv_fn = atable->recv_req;
                return;
        }
 
@@ -620,6 +625,7 @@ static void process_request(struct winbindd_cli_state *state)
                if (state->request->cmd == table->cmd) {
                        DEBUG(10,("process_request: request fn %s\n",
                                  table->winbindd_cmd_name ));
+                       state->cmd_name = table->winbindd_cmd_name;
                        table->fn(state);
                        break;
                }
@@ -640,6 +646,8 @@ static void wb_request_done(struct tevent_req *req)
 
        state->response = talloc_zero(state, struct winbindd_response);
        if (state->response == NULL) {
+               DEBUG(0, ("wb_request_done[%d:%s]: talloc_zero failed - removing client\n",
+                         (int)state->pid, state->cmd_name));
                remove_client(state);
                return;
        }
@@ -648,8 +656,11 @@ static void wb_request_done(struct tevent_req *req)
 
        status = state->recv_fn(req, state->response);
        TALLOC_FREE(req);
+
+       DEBUG(10,("wb_request_done[%d:%s]: %s\n",
+                 (int)state->pid, state->cmd_name, nt_errstr(status)));
+
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("returning %s\n", nt_errstr(status)));
                request_error(state);
                return;
        }
@@ -681,6 +692,8 @@ static void request_finished(struct winbindd_cli_state *state)
                                 state->out_queue, state->sock,
                                 state->response);
        if (req == NULL) {
+               DEBUG(10,("request_finished[%d:%s]: wb_resp_write_send() failed\n",
+                         (int)state->pid, state->cmd_name));
                remove_client(state);
                return;
        }
@@ -699,14 +712,19 @@ static void winbind_client_response_written(struct tevent_req *req)
        if (ret == -1) {
                close(state->sock);
                state->sock = -1;
-               DEBUG(2, ("Could not write response to client: %s\n",
-                         strerror(err)));
+               DEBUG(2, ("Could not write response[%d:%s] to client: %s\n",
+                         (int)state->pid, state->cmd_name, strerror(err)));
                remove_client(state);
                return;
        }
 
+       DEBUG(10,("winbind_client_response_written[%d:%s]: deliverd response to client\n",
+                 (int)state->pid, state->cmd_name));
+
        TALLOC_FREE(state->mem_ctx);
        state->response = NULL;
+       state->cmd_name = "no request";
+       state->recv_fn = NULL;
 
        req = wb_req_read_send(state, winbind_event_context(), state->sock,
                               WINBINDD_MAX_EXTRA_DATA);
index ea791234fb3131886016b4d48e7033ed6661e748..f1815ac870bb71ec07c1b77fe3b4933ff32d55b7 100644 (file)
@@ -56,6 +56,7 @@ struct winbindd_cli_state {
        bool privileged;                           /* Is the client 'privileged' */
 
        TALLOC_CTX *mem_ctx;                      /* memory per request */
+       const char *cmd_name;
        NTSTATUS (*recv_fn)(struct tevent_req *req,
                            struct winbindd_response *presp);
        struct winbindd_request *request;         /* Request from client */