diff options
author | Jeremy Allison <jra@samba.org> | 2005-01-28 23:17:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:55:13 -0500 |
commit | e612109aced3284033fc2e9170bbc290d8b5d6c6 (patch) | |
tree | ae9ac5c338cea5156faa22bb31a6481335e24db0 /source3 | |
parent | 8ac31b503433ae6150da9523e58c338aff27e561 (diff) | |
download | samba-e612109aced3284033fc2e9170bbc290d8b5d6c6.tar.gz samba-e612109aced3284033fc2e9170bbc290d8b5d6c6.tar.bz2 samba-e612109aced3284033fc2e9170bbc290d8b5d6c6.zip |
r5069: Ensure we return the correct errors for old-style search requests.
Jeremy.
(This used to be commit ef73dfe0d6c3b7f71109e32115d528ecdbe562ea)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/reply.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 86ee331e6b..85e66d5971 100644 --- a/source3/smbd/reply.c +++ b/source3/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); |