diff options
author | David Disseldorp <ddiss@samba.org> | 2014-01-16 19:00:04 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2014-01-20 12:29:13 +0100 |
commit | 8f3cf00c20415de9b29483f49739d03a45b6532d (patch) | |
tree | 3b7be48cb30309f1754fcc39702eb3ea3f912128 /source3/winbindd | |
parent | dad72a3b7ae310f8049cd76681d9d9d89ce6da52 (diff) | |
download | samba-8f3cf00c20415de9b29483f49739d03a45b6532d.tar.gz |
s3-winbind: only pass needed args to child_read_request
The socket and request are the only arguments required, the entire
winbind child state structure is not needed.
This allows for the separation of the request and response structures,
which is useful for asynchronous conversion.
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3/winbindd')
-rw-r--r-- | source3/winbindd/winbindd_dual.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 1d6a5baf708..18ec3dd9008 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -49,42 +49,34 @@ static struct winbindd_child *winbindd_children = NULL; /* Read some data from a client connection */ -static NTSTATUS child_read_request(struct winbindd_cli_state *state) +static NTSTATUS child_read_request(int sock, struct winbindd_request *wreq) { NTSTATUS status; - /* Read data */ - - status = read_data(state->sock, (char *)state->request, - sizeof(*state->request)); - + status = read_data(sock, (char *)wreq, sizeof(*wreq)); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("child_read_request: read_data failed: %s\n", nt_errstr(status))); return status; } - if (state->request->extra_len == 0) { - state->request->extra_data.data = NULL; + if (wreq->extra_len == 0) { + wreq->extra_data.data = NULL; return NT_STATUS_OK; } - DEBUG(10, ("Need to read %d extra bytes\n", (int)state->request->extra_len)); + DEBUG(10, ("Need to read %d extra bytes\n", (int)wreq->extra_len)); - state->request->extra_data.data = - SMB_MALLOC_ARRAY(char, state->request->extra_len + 1); - - if (state->request->extra_data.data == NULL) { + wreq->extra_data.data = SMB_MALLOC_ARRAY(char, wreq->extra_len + 1); + if (wreq->extra_data.data == NULL) { DEBUG(0, ("malloc failed\n")); return NT_STATUS_NO_MEMORY; } /* Ensure null termination */ - state->request->extra_data.data[state->request->extra_len] = '\0'; - - status= read_data(state->sock, state->request->extra_data.data, - state->request->extra_len); + wreq->extra_data.data[wreq->extra_len] = '\0'; + status = read_data(sock, wreq->extra_data.data, wreq->extra_len); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Could not read extra data: %s\n", nt_errstr(status))); @@ -1327,7 +1319,7 @@ static void child_handler(struct tevent_context *ev, struct tevent_fd *fde, int iov_count; /* fetch a request from the main daemon */ - status = child_read_request(&state->cli); + status = child_read_request(state->cli.sock, state->cli.request); if (!NT_STATUS_IS_OK(status)) { /* we lost contact with our parent */ |