[SCM] Samba Shared Repository - branch v3-devel updated -
release-3-2-0pre2-3976-gd6cb5fd
Volker Lendecke
vlendec at samba.org
Fri Sep 5 10:31:11 GMT 2008
The branch, v3-devel has been updated
via d6cb5fdafbddb08d32b788674eff509cae9525c6 (commit)
via e5a27773f97d7017cfa345799c6803fd82c8e797 (commit)
from 0d9f3dfc4c139938ee57b6cf60c29cf4ce404be7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-devel
- Log -----------------------------------------------------------------
commit d6cb5fdafbddb08d32b788674eff509cae9525c6
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Sep 5 11:47:48 2008 +0200
Protect against a closed socket
commit e5a27773f97d7017cfa345799c6803fd82c8e797
Author: Volker Lendecke <vl at sernet.de>
Date: Fri Sep 5 11:48:36 2008 +0200
Do proper error handling if the socket is closed
-----------------------------------------------------------------------
Summary of changes:
source/libsmb/async_smb.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/libsmb/async_smb.c b/source/libsmb/async_smb.c
index 79a924b..435c8c1 100644
--- a/source/libsmb/async_smb.c
+++ b/source/libsmb/async_smb.c
@@ -382,6 +382,11 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
SMB_ASSERT(cli->chain_accumulator == NULL);
+ if (cli->fd == -1) {
+ DEBUG(10, ("cli->fd closed\n"));
+ return false;
+ }
+
if (cli->fd_event == NULL) {
SMB_ASSERT(cli->outstanding_requests == NULL);
cli->fd_event = event_add_fd(ev, cli, cli->fd,
@@ -845,6 +850,7 @@ static void cli_state_handler(struct event_context *event_ctx,
{
struct cli_state *cli = (struct cli_state *)p;
struct cli_request *req;
+ NTSTATUS status;
DEBUG(11, ("cli_state_handler called with flags %d\n", flags));
@@ -857,11 +863,13 @@ static void cli_state_handler(struct event_context *event_ctx,
if (res == -1) {
DEBUG(10, ("ioctl(FIONREAD) failed: %s\n",
strerror(errno)));
+ status = map_nt_error_from_unix(errno);
goto sock_error;
}
if (available == 0) {
/* EOF */
+ status = NT_STATUS_END_OF_FILE;
goto sock_error;
}
@@ -870,6 +878,7 @@ static void cli_state_handler(struct event_context *event_ctx,
if (new_size < old_size) {
/* wrap */
+ status = NT_STATUS_UNEXPECTED_IO_ERROR;
goto sock_error;
}
@@ -877,6 +886,7 @@ static void cli_state_handler(struct event_context *event_ctx,
new_size);
if (tmp == NULL) {
/* nomem */
+ status = NT_STATUS_NO_MEMORY;
goto sock_error;
}
cli->evt_inbuf = tmp;
@@ -884,6 +894,7 @@ static void cli_state_handler(struct event_context *event_ctx,
res = recv(cli->fd, cli->evt_inbuf + old_size, available, 0);
if (res == -1) {
DEBUG(10, ("recv failed: %s\n", strerror(errno)));
+ status = map_nt_error_from_unix(errno);
goto sock_error;
}
@@ -930,6 +941,7 @@ static void cli_state_handler(struct event_context *event_ctx,
to_send - req->sent, 0);
if (sent < 0) {
+ status = map_nt_error_from_unix(errno);
goto sock_error;
}
@@ -945,8 +957,7 @@ static void cli_state_handler(struct event_context *event_ctx,
for (req = cli->outstanding_requests; req; req = req->next) {
int i;
for (i=0; i<req->num_async; i++) {
- req->async[i]->state = ASYNC_REQ_ERROR;
- req->async[i]->status = map_nt_error_from_unix(errno);
+ async_req_error(req->async[i], status);
}
}
TALLOC_FREE(cli->fd_event);
--
Samba Shared Repository
More information about the samba-cvs
mailing list