[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-2987-g1558a5c

Volker Lendecke vlendec at samba.org
Fri Sep 5 10:07:38 GMT 2008


The branch, v3-2-test has been updated
       via  1558a5c1977b1f87600ec487238fa8db009f41fd (commit)
      from  cc54b4d74171d27e7a0b09aff0376804ac7ab69b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 1558a5c1977b1f87600ec487238fa8db009f41fd
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
    
    This is a step in fixing bug 5707.
    
    Thanks to Igor Galić <i.galic at brainsware.org> for reporting!
    
    Volker

-----------------------------------------------------------------------

Summary of changes:
 source/libsmb/async_smb.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libsmb/async_smb.c b/source/libsmb/async_smb.c
index 58bba2b..9346264 100644
--- a/source/libsmb/async_smb.c
+++ b/source/libsmb/async_smb.c
@@ -319,6 +319,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));
 
@@ -331,11 +332,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;
 		}
 
@@ -344,6 +347,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;
 		}
 
@@ -351,6 +355,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;
@@ -358,6 +363,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;
 		}
 
@@ -402,6 +408,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;
 		}
 
@@ -415,8 +422,7 @@ static void cli_state_handler(struct event_context *event_ctx,
 
  sock_error:
 	for (req = cli->outstanding_requests; req; req = req->next) {
-		req->async->state = ASYNC_REQ_ERROR;
-		req->async->status = map_nt_error_from_unix(errno);
+		async_req_error(req->async, status);
 	}
 	TALLOC_FREE(cli->fd_event);
 	close(cli->fd);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list