From 1c8e5543195e418605ff468eecf64bfa7e0761aa Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 5 Mar 2010 11:16:12 +0100 Subject: [PATCH] s3:winbindd: add DEBUG(10,...) for the end of each top level 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). --- source3/winbindd/winbindd.c | 30 ++++++++++++++++++++++++------ source3/winbindd/winbindd.h | 1 + 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index c0b42b811d7..f3c269731d8 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -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); diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index ea791234fb3..f1815ac870b 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -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 */ -- 2.11.4.GIT