diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-06-20 13:42:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:57:20 -0500 |
commit | b62247f1eee94cadcf293084ce747c4b58aa1ac5 (patch) | |
tree | 9c32eda3836675166c7d791cfcef365d99dec5ce /source3/nsswitch/winbindd.c | |
parent | e6ef7ba7a4bc79dbc98119abc5cb9bd72d43c2a4 (diff) | |
download | samba-b62247f1eee94cadcf293084ce747c4b58aa1ac5.tar.gz samba-b62247f1eee94cadcf293084ce747c4b58aa1ac5.tar.bz2 samba-b62247f1eee94cadcf293084ce747c4b58aa1ac5.zip |
r7785: This looks much larger than it is. It changes the top-level functions of the
parent winbind not to return winbindd_result. This is to hopefully fix all the
problems where a result has been scheduled for write twice.
The problematic ones have been the functions that might have been delayed as
well as under other circumstances immediately gets answered from the cache.
Now a request needs to be explicitly replied to with a request_error() or
request_ok().
Volker
(This used to be commit 7365c9accf98ec1dd78a59dd7f62462bbb8528d4)
Diffstat (limited to 'source3/nsswitch/winbindd.c')
-rw-r--r-- | source3/nsswitch/winbindd.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index a13a293e7a..5e38a84d65 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -224,7 +224,11 @@ static void msg_shutdown(int msg_type, pid_t src, void *buf, size_t len) terminate(); } -static struct winbindd_dispatch_table dispatch_table[] = { +static struct winbindd_dispatch_table { + enum winbindd_cmd cmd; + void (*fn)(struct winbindd_cli_state *state); + const char *winbindd_cmd_name; +} dispatch_table[] = { /* User functions */ @@ -326,7 +330,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->response.result = table->fn(state); + table->fn(state); break; } } @@ -334,7 +338,7 @@ static void process_request(struct winbindd_cli_state *state) if (!table->fn) { DEBUG(10,("process_request: unknown request fn number %d\n", (int)state->request.cmd )); - state->response.result = WINBINDD_ERROR; + request_error(state); } } @@ -458,7 +462,7 @@ void setup_async_write(struct fd_event *event, void *data, size_t length, static void request_len_recv(void *private, BOOL success); static void request_recv(void *private, BOOL success); -void request_finished(struct winbindd_cli_state *state); +static void request_finished(struct winbindd_cli_state *state); void request_finished_cont(void *private, BOOL success); static void response_main_sent(void *private, BOOL success); static void response_extra_sent(void *private, BOOL success); @@ -510,20 +514,35 @@ static void response_main_sent(void *private, BOOL success) response_extra_sent, state); } -void request_finished(struct winbindd_cli_state *state) +static void request_finished(struct winbindd_cli_state *state) { setup_async_write(&state->fd_event, &state->response, sizeof(state->response), response_main_sent, state); } +void request_error(struct winbindd_cli_state *state) +{ + SMB_ASSERT(state->response.result == WINBINDD_PENDING); + state->response.result = WINBINDD_ERROR; + request_finished(state); +} + +void request_ok(struct winbindd_cli_state *state) +{ + SMB_ASSERT(state->response.result == WINBINDD_PENDING); + state->response.result = WINBINDD_OK; + request_finished(state); +} + void request_finished_cont(void *private, BOOL success) { struct winbindd_cli_state *state = talloc_get_type_abort(private, struct winbindd_cli_state); - if (!success) - state->response.result = WINBINDD_ERROR; - request_finished(state); + if (success) + request_ok(state); + else + request_error(state); } static void request_recv(void *private, BOOL success) @@ -537,9 +556,6 @@ static void request_recv(void *private, BOOL success) } process_request(state); - - if (state->response.result != WINBINDD_PENDING) - request_finished(state); } static void request_len_recv(void *private, BOOL success) |