summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;