r7617: Fix for bug #2801 - delete veto files was broken with the new
authorJeremy Allison <jra@samba.org>
Wed, 15 Jun 2005 18:37:34 +0000 (18:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:57:16 +0000 (10:57 -0500)
large directory code.
Jeremy.
(This used to be commit f397cc08b5628913af4d7f9c2c6d20c778e5d8ca)

source3/smbd/dir.c
source3/smbd/reply.c

index b9c6cf87973e3305d2eacf4471ec5bcd3357261e..072f396b8ccda8ee5269641942fba1950ae0e6a7 100644 (file)
@@ -1110,6 +1110,18 @@ const char *ReadDirName(struct smb_Dir *dirp, long *poffset)
        return NULL;
 }
 
+/*******************************************************************
+ Rewind to the start.
+********************************************************************/
+
+void RewindDir(struct smb_Dir *dirp, long *poffset)
+{
+       SMB_VFS_REWINDDIR(dirp->conn, dirp->dir);
+       dirp->file_number = 0;
+       dirp->offset = 0;
+       *poffset = 0;
+}
+
 /*******************************************************************
  Seek a dir.
 ********************************************************************/
@@ -1117,7 +1129,11 @@ const char *ReadDirName(struct smb_Dir *dirp, long *poffset)
 void SeekDir(struct smb_Dir *dirp, long offset)
 {
        if (offset != dirp->offset) {
-               SMB_VFS_SEEKDIR(dirp->conn, dirp->dir, offset);
+               if (offset == 0) {
+                       RewindDir(dirp, &offset);
+               } else {
+                       SMB_VFS_SEEKDIR(dirp->conn, dirp->dir, offset);
+               }
                dirp->offset = offset;
        }
 }
index f97bedef9b41546cede72679f7516ee4b7e9c251..c9adbf8fcff6f36f9236da1376b80418eab9ccca 100644 (file)
@@ -3768,7 +3768,7 @@ BOOL rmdir_internals(connection_struct *conn, char *directory)
                struct smb_Dir *dir_hnd = OpenDir(conn, directory);
 
                if(dir_hnd != NULL) {
-                       long dirpos = TellDir(dir_hnd);
+                       long dirpos = 0;
                        while ((dname = ReadDirName(dir_hnd,&dirpos))) {
                                if((strcmp(dname, ".") == 0) || (strcmp(dname, "..")==0))
                                        continue;
@@ -3781,7 +3781,7 @@ BOOL rmdir_internals(connection_struct *conn, char *directory)
                        }
 
                        if(all_veto_files) {
-                               SeekDir(dir_hnd,dirpos);
+                               RewindDir(dir_hnd);
                                while ((dname = ReadDirName(dir_hnd,&dirpos))) {
                                        pstring fullname;