diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/process.c | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 38682ff2ce..5e9392bddb 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2730,103 +2730,6 @@ static void smbd_echo_exit(struct tevent_context *ev, exit(0); } -static void smbd_echo_reader(struct tevent_context *ev, - struct tevent_fd *fde, uint16_t flags, - void *private_data) -{ - struct smbd_echo_state *state = talloc_get_type_abort( - private_data, struct smbd_echo_state); - struct smbd_server_connection *sconn = state->sconn; - size_t unread, num_pending; - NTSTATUS status; - struct iovec *tmp; - size_t iov_len; - uint32_t seqnum = 0; - bool reply; - bool ok; - bool encrypted = false; - - smb_msleep(1000); - - ok = smbd_lock_socket_internal(sconn); - if (!ok) { - DEBUG(0, ("%s: failed to lock socket\n", - __location__)); - exit(1); - } - - if (!fd_is_readable(sconn->sock)) { - DEBUG(10,("echo_handler[%d] the parent smbd was faster\n", - (int)sys_getpid())); - ok = smbd_unlock_socket_internal(sconn); - if (!ok) { - DEBUG(1, ("%s: failed to unlock socket in\n", - __location__)); - exit(1); - } - return; - } - - num_pending = talloc_array_length(state->pending); - tmp = talloc_realloc(state, state->pending, struct iovec, - num_pending+1); - if (tmp == NULL) { - DEBUG(1, ("talloc_realloc failed\n")); - exit(1); - } - state->pending = tmp; - - DEBUG(10,("echo_handler[%d]: reading pdu\n", (int)sys_getpid())); - - status = receive_smb_talloc(state->pending, sconn, sconn->sock, - (char **)(void *)&state->pending[num_pending].iov_base, - 0 /* timeout */, - &unread, - &encrypted, - &iov_len, - &seqnum, - false /* trusted_channel*/); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("echo_handler[%d]: receive_smb_raw_talloc failed: %s\n", - (int)sys_getpid(), nt_errstr(status))); - exit(1); - } - state->pending[num_pending].iov_len = iov_len; - - ok = smbd_unlock_socket_internal(sconn); - if (!ok) { - DEBUG(1, ("%s: failed to unlock socket in\n", - __location__)); - exit(1); - } - - reply = smbd_echo_reply((uint8_t *)state->pending[num_pending].iov_base, - state->pending[num_pending].iov_len, - seqnum); - if (reply) { - DEBUG(10,("echo_handler[%d]: replied to client\n", (int)sys_getpid())); - /* no check, shrinking by some bytes does not fail */ - state->pending = talloc_realloc(state, state->pending, - struct iovec, - num_pending); - return; - } - - if (state->pending[num_pending].iov_len >= smb_size) { - /* - * place the seqnum in the packet so that the main process - * can reply with signing - */ - SIVAL((uint8_t *)state->pending[num_pending].iov_base, - smb_ss_field, seqnum); - SIVAL((uint8_t *)state->pending[num_pending].iov_base, - smb_ss_field+4, NT_STATUS_V(NT_STATUS_OK)); - } - - DEBUG(10,("echo_handler[%d]: forward to main\n", (int)sys_getpid())); - smbd_echo_activate_writer(state); -} - static void smbd_echo_got_packet(struct tevent_req *req); static void smbd_echo_loop(struct smbd_server_connection *sconn, |