summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-02-01 16:32:02 +0100
committerVolker Lendecke <vl@samba.org>2009-02-01 19:05:39 +0100
commitc14b7e648bcfc4865da4b290e46977fff81d4500 (patch)
tree0986bdd1520bf5df0d17d05f35873154756331cb /source3/lib
parent0931bb8937eaec55844dee0cdeefafa162053c53 (diff)
downloadsamba-c14b7e648bcfc4865da4b290e46977fff81d4500.tar.gz
samba-c14b7e648bcfc4865da4b290e46977fff81d4500.tar.bz2
samba-c14b7e648bcfc4865da4b290e46977fff81d4500.zip
Split up async_req into a generic and a NTSTATUS specific part
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_sock.c26
-rw-r--r--source3/lib/wb_reqtrans.c50
-rw-r--r--source3/lib/wbclient.c54
3 files changed, 65 insertions, 65 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 3ddc4342a7..bafcdc5c5c 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1036,7 +1036,7 @@ struct async_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
return result;
post_status:
- if (!async_post_status(result, ev, status)) {
+ if (!async_post_ntstatus(result, ev, status)) {
goto fail;
}
return result;
@@ -1077,12 +1077,12 @@ static void open_socket_out_connected(struct async_req *subreq)
subreq = async_connect_send(state, state->ev, state->fd,
(struct sockaddr *)&state->ss,
state->salen);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
if (!async_req_set_timeout(subreq, state->ev,
timeval_set(0, state->wait_nsec))) {
- async_req_error(req, NT_STATUS_NO_MEMORY);
+ async_req_nterror(req, NT_STATUS_NO_MEMORY);
return;
}
subreq->async.fn = open_socket_out_connected;
@@ -1098,7 +1098,7 @@ static void open_socket_out_connected(struct async_req *subreq)
#endif
/* real error */
- async_req_error(req, map_nt_error_from_unix(sys_errno));
+ async_req_nterror(req, map_nt_error_from_unix(sys_errno));
}
NTSTATUS open_socket_out_recv(struct async_req *req, int *pfd)
@@ -1107,7 +1107,7 @@ NTSTATUS open_socket_out_recv(struct async_req *req, int *pfd)
req->private_data, struct open_socket_out_state);
NTSTATUS status;
- if (async_req_is_error(req, &status)) {
+ if (async_req_is_nterror(req, &status)) {
return status;
}
*pfd = state->fd;
@@ -1183,7 +1183,7 @@ struct async_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
return result;
post_status:
- if (!async_post_status(result, ev, status)) {
+ if (!async_post_ntstatus(result, ev, status)) {
goto fail;
}
return result;
@@ -1198,18 +1198,18 @@ static void open_socket_out_defer_waited(struct async_req *subreq)
subreq->async.priv, struct async_req);
struct open_socket_out_defer_state *state = talloc_get_type_abort(
req->private_data, struct open_socket_out_defer_state);
- NTSTATUS status;
+ bool ret;
- status = async_wait_recv(subreq);
+ ret = async_wait_recv(subreq);
TALLOC_FREE(subreq);
- if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ if (!ret) {
+ async_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
return;
}
subreq = open_socket_out_send(state, state->ev, &state->ss,
state->port, state->timeout);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
subreq->async.fn = open_socket_out_defer_connected;
@@ -1227,7 +1227,7 @@ static void open_socket_out_defer_connected(struct async_req *subreq)
status = open_socket_out_recv(subreq, &state->fd);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
async_req_done(req);
@@ -1239,7 +1239,7 @@ NTSTATUS open_socket_out_defer_recv(struct async_req *req, int *pfd)
req->private_data, struct open_socket_out_defer_state);
NTSTATUS status;
- if (async_req_is_error(req, &status)) {
+ if (async_req_is_nterror(req, &status)) {
return status;
}
*pfd = state->fd;
diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c
index 0e6e5d15c4..7bca627690 100644
--- a/source3/lib/wb_reqtrans.c
+++ b/source3/lib/wb_reqtrans.c
@@ -81,7 +81,7 @@ static void wb_req_read_len(struct async_req *subreq)
status = recvall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -89,14 +89,14 @@ static void wb_req_read_len(struct async_req *subreq)
DEBUG(0, ("wb_req_read_len: Invalid request size received: "
"%d (expected %d)\n", (int)state->wb_req->length,
(int)sizeof(struct winbindd_request)));
- async_req_error(req, NT_STATUS_INVALID_BUFFER_SIZE);
+ async_req_nterror(req, NT_STATUS_INVALID_BUFFER_SIZE);
return;
}
subreq = recvall_send(
req, state->ev, state->fd, (uint32 *)(state->wb_req)+1,
sizeof(struct winbindd_request) - sizeof(uint32), 0);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -115,7 +115,7 @@ static void wb_req_read_main(struct async_req *subreq)
status = recvall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -124,7 +124,7 @@ static void wb_req_read_main(struct async_req *subreq)
DEBUG(3, ("Got request with %d bytes extra data on "
"unprivileged socket\n",
(int)state->wb_req->extra_len));
- async_req_error(req, NT_STATUS_INVALID_BUFFER_SIZE);
+ async_req_nterror(req, NT_STATUS_INVALID_BUFFER_SIZE);
return;
}
@@ -135,7 +135,7 @@ static void wb_req_read_main(struct async_req *subreq)
state->wb_req->extra_data.data = TALLOC_ARRAY(
state->wb_req, char, state->wb_req->extra_len + 1);
- if (async_req_nomem(state->wb_req->extra_data.data, req)) {
+ if (async_req_ntnomem(state->wb_req->extra_data.data, req)) {
return;
}
@@ -144,7 +144,7 @@ static void wb_req_read_main(struct async_req *subreq)
subreq = recvall_send(
req, state->ev, state->fd, state->wb_req->extra_data.data,
state->wb_req->extra_len, 0);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -161,7 +161,7 @@ static void wb_req_read_extra(struct async_req *subreq)
status = recvall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
async_req_done(req);
@@ -175,7 +175,7 @@ NTSTATUS wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
req->private_data, struct req_read_state);
NTSTATUS status;
- if (async_req_is_error(req, &status)) {
+ if (async_req_is_nterror(req, &status)) {
return status;
}
*preq = talloc_move(mem_ctx, &state->wb_req);
@@ -232,7 +232,7 @@ static void wb_req_write_main(struct async_req *subreq)
status = sendall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -244,7 +244,7 @@ static void wb_req_write_main(struct async_req *subreq)
subreq = sendall_send(state, state->ev, state->fd,
state->wb_req->extra_data.data,
state->wb_req->extra_len, 0);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -261,7 +261,7 @@ static void wb_req_write_extra(struct async_req *subreq)
status = sendall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -270,7 +270,7 @@ static void wb_req_write_extra(struct async_req *subreq)
NTSTATUS wb_req_write_recv(struct async_req *req)
{
- return async_req_simple_recv(req);
+ return async_req_simple_recv_ntstatus(req);
}
struct resp_read_state {
@@ -327,7 +327,7 @@ static void wb_resp_read_len(struct async_req *subreq)
status = recvall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -336,14 +336,14 @@ static void wb_resp_read_len(struct async_req *subreq)
"%d (expected at least%d)\n",
(int)state->wb_resp->length,
(int)sizeof(struct winbindd_response)));
- async_req_error(req, NT_STATUS_INVALID_BUFFER_SIZE);
+ async_req_nterror(req, NT_STATUS_INVALID_BUFFER_SIZE);
return;
}
subreq = recvall_send(
req, state->ev, state->fd, (uint32 *)(state->wb_resp)+1,
sizeof(struct winbindd_response) - sizeof(uint32), 0);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -363,7 +363,7 @@ static void wb_resp_read_main(struct async_req *subreq)
status = recvall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -375,7 +375,7 @@ static void wb_resp_read_main(struct async_req *subreq)
state->wb_resp->extra_data.data = TALLOC_ARRAY(
state->wb_resp, char, extra_len+1);
- if (async_req_nomem(state->wb_resp->extra_data.data, req)) {
+ if (async_req_ntnomem(state->wb_resp->extra_data.data, req)) {
return;
}
((char *)state->wb_resp->extra_data.data)[extra_len] = 0;
@@ -383,7 +383,7 @@ static void wb_resp_read_main(struct async_req *subreq)
subreq = recvall_send(
req, state->ev, state->fd, state->wb_resp->extra_data.data,
extra_len, 0);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -400,7 +400,7 @@ static void wb_resp_read_extra(struct async_req *subreq)
status = recvall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
async_req_done(req);
@@ -414,7 +414,7 @@ NTSTATUS wb_resp_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
req->private_data, struct resp_read_state);
NTSTATUS status;
- if (async_req_is_error(req, &status)) {
+ if (async_req_is_nterror(req, &status)) {
return status;
}
*presp = talloc_move(mem_ctx, &state->wb_resp);
@@ -471,7 +471,7 @@ static void wb_resp_write_main(struct async_req *subreq)
status = sendall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -484,7 +484,7 @@ static void wb_resp_write_main(struct async_req *subreq)
state, state->ev, state->fd,
state->wb_resp->extra_data.data,
state->wb_resp->length - sizeof(struct winbindd_response), 0);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -501,7 +501,7 @@ static void wb_resp_write_extra(struct async_req *subreq)
status = sendall_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -510,5 +510,5 @@ static void wb_resp_write_extra(struct async_req *subreq)
NTSTATUS wb_resp_write_recv(struct async_req *req)
{
- return async_req_simple_recv(req);
+ return async_req_simple_recv_ntstatus(req);
}
diff --git a/source3/lib/wbclient.c b/source3/lib/wbclient.c
index ea0bcb512e..cf5ce7e734 100644
--- a/source3/lib/wbclient.c
+++ b/source3/lib/wbclient.c
@@ -232,7 +232,7 @@ static struct async_req *wb_connect_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
- if (async_post_status(req, ev, status)) {
+ if (async_post_ntstatus(req, ev, status)) {
return req;
}
TALLOC_FREE(req);
@@ -295,8 +295,8 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx,
}
if (winbind_closed_fd(fd)) {
- if (!async_post_status(result, ev,
- NT_STATUS_PIPE_DISCONNECTED)) {
+ if (!async_post_ntstatus(result, ev,
+ NT_STATUS_PIPE_DISCONNECTED)) {
goto fail;
}
return result;
@@ -334,13 +334,13 @@ static void wb_int_trans_write_done(struct async_req *subreq)
status = wb_req_write_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
subreq = wb_resp_read_send(state, state->ev, state->fd);
if (subreq == NULL) {
- async_req_error(req, NT_STATUS_NO_MEMORY);
+ async_req_nterror(req, NT_STATUS_NO_MEMORY);
}
subreq->async.fn = wb_int_trans_read_done;
subreq->async.priv = req;
@@ -357,7 +357,7 @@ static void wb_int_trans_read_done(struct async_req *subreq)
status = wb_resp_read_recv(subreq, state, &state->wb_resp);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -372,7 +372,7 @@ static NTSTATUS wb_int_trans_recv(struct async_req *req,
req->private_data, struct wb_int_trans_state);
NTSTATUS status;
- if (async_req_is_error(req, &status)) {
+ if (async_req_is_nterror(req, &status)) {
return status;
}
@@ -454,7 +454,7 @@ static void wb_open_pipe_connect_nonpriv_done(struct async_req *subreq)
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
state->wb_ctx->is_priv = true;
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -463,7 +463,7 @@ static void wb_open_pipe_connect_nonpriv_done(struct async_req *subreq)
subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->fd,
&state->wb_req);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -483,7 +483,7 @@ static void wb_open_pipe_ping_done(struct async_req *subreq)
status = wb_int_trans_recv(subreq, state, &wb_resp);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -496,7 +496,7 @@ static void wb_open_pipe_ping_done(struct async_req *subreq)
subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->fd,
&state->wb_req);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -516,7 +516,7 @@ static void wb_open_pipe_getpriv_done(struct async_req *subreq)
status = wb_int_trans_recv(subreq, state, &wb_resp);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
@@ -526,7 +526,7 @@ static void wb_open_pipe_getpriv_done(struct async_req *subreq)
subreq = wb_connect_send(state, state->ev, state->wb_ctx,
(char *)wb_resp->extra_data.data);
TALLOC_FREE(wb_resp);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -545,7 +545,7 @@ static void wb_open_pipe_connect_priv_done(struct async_req *subreq)
status = wb_connect_recv(subreq);
TALLOC_FREE(subreq);
if (!NT_STATUS_IS_OK(status)) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return;
}
state->wb_ctx->is_priv = true;
@@ -554,7 +554,7 @@ static void wb_open_pipe_connect_priv_done(struct async_req *subreq)
static NTSTATUS wb_open_pipe_recv(struct async_req *req)
{
- return async_req_simple_recv(req);
+ return async_req_simple_recv_ntstatus(req);
}
struct wb_trans_state {
@@ -582,7 +582,7 @@ static void wb_trigger_trans(struct async_req *req)
subreq = wb_open_pipe_send(state, state->ev, state->wb_ctx,
state->need_priv);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
subreq->async.fn = wb_trans_connect_done;
@@ -592,7 +592,7 @@ static void wb_trigger_trans(struct async_req *req)
subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->fd,
state->wb_req);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
subreq->async.fn = wb_trans_done;
@@ -645,13 +645,13 @@ static bool wb_trans_retry(struct async_req *req,
* Winbind not around or we can't connect to the pipe. Fail
* immediately.
*/
- async_req_error(req, status);
+ async_req_nterror(req, status);
return true;
}
state->num_retries -= 1;
if (state->num_retries == 0) {
- async_req_error(req, status);
+ async_req_nterror(req, status);
return true;
}
@@ -665,7 +665,7 @@ static bool wb_trans_retry(struct async_req *req,
}
subreq = async_wait_send(state, state->ev, timeval_set(1, 0));
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return true;
}
@@ -680,18 +680,18 @@ static void wb_trans_retry_wait_done(struct async_req *subreq)
subreq->async.priv, struct async_req);
struct wb_trans_state *state = talloc_get_type_abort(
req->private_data, struct wb_trans_state);
- NTSTATUS status;
+ bool ret;
- status = async_wait_recv(subreq);
+ ret = async_wait_recv(subreq);
TALLOC_FREE(subreq);
- if (!NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
- async_req_error(req, status);
+ if (ret) {
+ async_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
return;
}
subreq = wb_open_pipe_send(state, state->ev, state->wb_ctx,
state->need_priv);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
subreq->async.fn = wb_trans_connect_done;
@@ -715,7 +715,7 @@ static void wb_trans_connect_done(struct async_req *subreq)
subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->fd,
state->wb_req);
- if (async_req_nomem(subreq, req)) {
+ if (async_req_ntnomem(subreq, req)) {
return;
}
@@ -748,7 +748,7 @@ NTSTATUS wb_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
req->private_data, struct wb_trans_state);
NTSTATUS status;
- if (async_req_is_error(req, &status)) {
+ if (async_req_is_nterror(req, &status)) {
return status;
}