return status;
}
+static NTSTATUS child_write_response(int sock, struct winbindd_response *wrsp)
+{
+ struct iovec iov[2];
+ int iov_count;
+
+ iov[0].iov_base = (void *)wrsp;
+ iov[0].iov_len = sizeof(struct winbindd_response);
+ iov_count = 1;
+
+ if (wrsp->length > sizeof(struct winbindd_response)) {
+ iov[1].iov_base = (void *)wrsp->extra_data.data;
+ iov[1].iov_len = wrsp->length-iov[0].iov_len;
+ iov_count = 2;
+ }
+
+ DEBUG(10, ("Writing %d bytes to parent\n", (int)wrsp->length));
+
+ if (write_data_iov(sock, iov, iov_count) != wrsp->length) {
+ DEBUG(0, ("Could not write result\n"));
+ return NT_STATUS_INVALID_HANDLE;
+ }
+
+ return NT_STATUS_OK;
+}
+
/*
* Do winbind child async request. This is not simply wb_simple_trans. We have
* to do the queueing ourselves because while a request is queued, the child
struct timeval t;
struct timeval *tp;
TALLOC_CTX *frame = talloc_stackframe();
- struct iovec iov[2];
- int iov_count;
if (run_events_poll(winbind_event_context(), 0, NULL, 0)) {
TALLOC_FREE(frame);
SAFE_FREE(state.request->extra_data.data);
- iov[0].iov_base = (void *)state.response;
- iov[0].iov_len = sizeof(struct winbindd_response);
- iov_count = 1;
-
- if (state.response->length > sizeof(struct winbindd_response)) {
- iov[1].iov_base =
- (void *)state.response->extra_data.data;
- iov[1].iov_len = state.response->length-iov[0].iov_len;
- iov_count = 2;
- }
-
- DEBUG(10, ("Writing %d bytes to parent\n",
- (int)state.response->length));
-
- if (write_data_iov(state.sock, iov, iov_count) !=
- state.response->length) {
- DEBUG(0, ("Could not write result\n"));
- exit(1);
+ status = child_write_response(state.sock, state.response);
+ if (!NT_STATUS_IS_OK(status)) {
+ _exit(1);
}
TALLOC_FREE(frame);
}