r7857: improved the handling of end-of-file on sockets in the smb server
authorAndrew Tridgell <tridge@samba.org>
Fri, 24 Jun 2005 00:05:41 +0000 (00:05 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:43 +0000 (13:18 -0500)
source/smb_server/smb_server.c

index 7e0aa2c0cbdae07257b0d0ca321a274032141b86..f891fd892cf421caa3f2d2e51b0dc96255fb608d 100644 (file)
@@ -101,9 +101,12 @@ static NTSTATUS receive_smb_request(struct smbsrv_connection *smb_conn)
                if (NT_STATUS_IS_ERR(status)) {
                        return status;
                }
-               if (nread == 0) {
+               if (!NT_STATUS_IS_OK(status)) {
                        return NT_STATUS_OK;
                }
+               if (nread == 0) {
+                       return NT_STATUS_END_OF_FILE;
+               }
                req->in.size += nread;
 
                /* when we have a full NBT header, then allocate the packet */
@@ -129,9 +132,12 @@ static NTSTATUS receive_smb_request(struct smbsrv_connection *smb_conn)
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
-       if (nread == 0) {
+       if (!NT_STATUS_IS_OK(status)) {
                return NT_STATUS_OK;
        }
+       if (nread == 0) {
+               return NT_STATUS_END_OF_FILE;
+       }
 
        req->in.size += nread;