Author: jerry
Date: 2005-09-27 20:44:54 +0000 (Tue, 27 Sep 2005)
New Revision: 10559

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10559

Log:
jra's looping directory fix (BUG 3065)
Modified:
   branches/SAMBA_3_0_RELEASE/source/smbd/dir.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/source/smbd/dir.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/smbd/dir.c        2005-09-27 20:41:22 UTC 
(rev 10558)
+++ branches/SAMBA_3_0_RELEASE/source/smbd/dir.c        2005-09-27 20:44:54 UTC 
(rev 10559)
@@ -1148,8 +1148,23 @@
 void SeekDir(struct smb_Dir *dirp, long offset)
 {
        if (offset != dirp->offset) {
-               if (offset == START_OF_DIRECTORY_OFFSET || offset == 
DOT_DOT_DIRECTORY_OFFSET) {
+               if (offset == START_OF_DIRECTORY_OFFSET) {
                        RewindDir(dirp, &offset);
+                       /* 
+                        * Ok we should really set the file number here
+                        * to 1 to enable ".." to be returned next. Trouble
+                        * is I'm worried about callers using SeekDir(dirp,0)
+                        * as equivalent to RewindDir(). So leave this alone
+                        * for now.
+                        */
+               } else if  (offset == DOT_DOT_DIRECTORY_OFFSET) {
+                       RewindDir(dirp, &offset);
+                       /*
+                        * Set the file number to 2 - we want to get the first
+                        * real file entry (the one we return after "..")
+                        * on the next ReadDir.
+                        */
+                       dirp->file_number = 2;
                } else if (offset == END_OF_DIRECTORY_OFFSET) {
                        ; /* Don't seek in this case. */
                } else {

Reply via email to