From: Jeremy Allison Date: Fri, 28 Jan 2005 23:17:12 +0000 (+0000) Subject: r5069: Ensure we return the correct errors for old-style search requests. X-Git-Tag: samba-misc-tags/initial-v3-0-unstable~5334 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ef73dfe0d6c3b7f71109e32115d528ecdbe562ea;p=thirdparty%2Fsamba.git r5069: Ensure we return the correct errors for old-style search requests. Jeremy. --- diff --git a/source/smbd/reply.c b/source/smbd/reply.c index 86ee331e6b2..85e66d5971f 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -947,18 +947,21 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size and no entries were found then return error and close dirptr (X/Open spec) */ - if(ok && expect_close && numentries == 0 && status_len == 0) { - /* Close the dptr - we know it's gone */ + if (numentries == 0 || !ok) { dptr_close(&dptr_num); - return ERROR_BOTH(STATUS_NO_MORE_FILES,ERRDOS,ERRnofiles); - } else if (numentries == 0 || !ok) { + } else if(ok && expect_close && status_len == 0) { + /* Close the dptr - we know it's gone */ dptr_close(&dptr_num); - return ERROR_BOTH(STATUS_NO_MORE_FILES,ERRDOS,ERRnofiles); } /* If we were called as SMBfunique, then we can close the dirptr now ! */ - if(dptr_num >= 0 && CVAL(inbuf,smb_com) == SMBfunique) + if(dptr_num >= 0 && CVAL(inbuf,smb_com) == SMBfunique) { dptr_close(&dptr_num); + } + + if ((numentries == 0) && !ms_has_wild(mask)) { + return ERROR_BOTH(STATUS_NO_MORE_FILES,ERRDOS,ERRnofiles); + } SSVAL(outbuf,smb_vwv0,numentries); SSVAL(outbuf,smb_vwv1,3 + numentries * DIR_STRUCT_SIZE);