summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-03-21 18:10:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:09 -0500
commitff107a93cdf4ab75be44097897ecc42ea46580e2 (patch)
tree7a76abbdee61a3c026c5790d5b700bc54aa56d86 /source3/smbd/dir.c
parenteeefe8cf5e2303863ea63d1487042082cdfc2778 (diff)
downloadsamba-ff107a93cdf4ab75be44097897ecc42ea46580e2.tar.gz
samba-ff107a93cdf4ab75be44097897ecc42ea46580e2.tar.bz2
samba-ff107a93cdf4ab75be44097897ecc42ea46580e2.zip
r5922: Fix for NASTY NASTY bug #2501. All my fault :-(. Brown paper bag time.
Stops Win98 from looping doing findnext on a singleton directory. More testing very welcome. Jeremy. (This used to be commit e32a58742e618a49934e19b72cd5222c9666cf95)
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index db16b8a6e0..1ec35d839c 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -595,6 +595,13 @@ const char *dptr_ReadDirName(struct dptr_struct *dptr, long *poffset, SMB_STRUCT
BOOL dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst)
{
ZERO_STRUCTP(pst);
+
+ if (!dptr->has_wild && (dptr->dir_hnd->offset == -1)) {
+ /* This is a singleton directory and we're already at the end. */
+ *poffset = -1;
+ return False;
+ }
+
while (SearchDir(dptr->dir_hnd, name, poffset) == True) {
if (is_visible_file(dptr->conn, dptr->path, name, pst, True)) {
return True;