]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Get in_minimum and EOF errors right.
authorJeremy Allison <jra@samba.org>
Wed, 5 May 2010 16:47:49 +0000 (09:47 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 5 May 2010 16:47:49 +0000 (09:47 -0700)
Jeremy.

source3/smbd/smb2_read.c

index a858758aee1825812bc1ae0bc337c548868e7949..a428c26ea26dc65daaaefb1992909f13f18f66b7 100644 (file)
@@ -289,13 +289,23 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
                tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
                return tevent_req_post(req, ev);
        }
-       if (nread == 0 && (in_length != 0 || in_minimum != 0)) {
+       if (nread == 0 && in_length != 0) {
                DEBUG(5,("smbd_smb2_read: read_file[%s] end of file\n",
                         fsp_str_dbg(fsp)));
                tevent_req_nterror(req, NT_STATUS_END_OF_FILE);
                return tevent_req_post(req, ev);
        }
 
+       if (nread < in_minimum) {
+               DEBUG(5,("smbd_smb2_read: read_file[%s] read less %d than "
+                       "minimum requested %u. Returning end of file\n",
+                        fsp_str_dbg(fsp),
+                       (int)nread,
+                       (unsigned int)in_minimum));
+               tevent_req_nterror(req, NT_STATUS_END_OF_FILE);
+               return tevent_req_post(req, ev);
+       }
+
        state->out_data.length = nread;
        state->out_remaining = 0;
        tevent_req_done(req);