]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r5922: Fix for NASTY NASTY bug #2501. All my fault :-(. Brown paper bag time.
authorJeremy Allison <jra@samba.org>
Mon, 21 Mar 2005 18:10:21 +0000 (18:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:09 +0000 (10:56 -0500)
Stops Win98 from looping doing findnext on a singleton directory. More
testing very welcome.
Jeremy.

source/smbd/dir.c

index db16b8a6e00a5139613af835be4c89a7967336a4..1ec35d839c24718b07f76fd71e07ff5cf9d5f8ae 100644 (file)
@@ -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;