r6169: Fix bug #2563. Infinite loop on non-existant file with findnext.
authorJeremy Allison <jra@samba.org>
Fri, 1 Apr 2005 19:57:22 +0000 (19:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:26 +0000 (10:56 -0500)
Jeremy
(This used to be commit 065ab9182dc39557b8c26d3d110abe9963ad9568)

source3/smbd/dir.c

index 55f152386528345bbbd5254cd458a16fb0aec4de..27ec003fb8f9d98c0c544a37aa341f71e9e9d98e 100644 (file)
@@ -573,8 +573,6 @@ const char *dptr_ReadDirName(struct dptr_struct *dptr, long *poffset, SMB_STRUCT
                }
        }
 
-       dptr->has_wild = True;
-
        /* In case sensitive mode we don't search - we know if it doesn't exist 
           with a stat we will fail. */
 
@@ -584,6 +582,7 @@ const char *dptr_ReadDirName(struct dptr_struct *dptr, long *poffset, SMB_STRUCT
                dptr->dir_hnd->offset = *poffset = -1;
                return NULL;
        } else {
+               dptr->has_wild = True;
                return dptr_normal_ReadDirName(dptr, poffset, pst);
        }
 }
@@ -602,7 +601,7 @@ BOOL dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, S
                return False;
        }
 
-       while (SearchDir(dptr->dir_hnd, name, poffset) == True) {
+       if (SearchDir(dptr->dir_hnd, name, poffset)) {
                if (is_visible_file(dptr->conn, dptr->path, name, pst, True)) {
                        return True;
                }