rebus / rpms / samba

Forked from rpms/samba 3 years ago
Clone
Blob Blame History Raw
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/examples/VFS/skel_opaque.c samba-3.0.20-new/examples/VFS/skel_opaque.c
--- samba-3.0.20-orig/examples/VFS/skel_opaque.c	2005-07-28 08:19:54.000000000 -0500
+++ samba-3.0.20-new/examples/VFS/skel_opaque.c	2005-08-26 09:42:08.000000000 -0500
@@ -71,27 +71,27 @@
 	return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels);
 }
 
-static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
 	return vfswrap_opendir(NULL, conn, fname, mask, attr);
 }
 
-static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	return vfswrap_readdir(NULL, conn, dirp);
 }
 
-static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset)
+static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset)
 {
 	return vfswrap_seekdir(NULL, conn, dirp, offset);
 }
 
-static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	return vfswrap_telldir(NULL, conn, dirp);
 }
 
-static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	return vfswrap_rewinddir(NULL, conn, dirp);
 }
@@ -106,7 +106,7 @@
 	return vfswrap_rmdir(NULL, conn, path);
 }
 
-static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir)
+static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir)
 {
 	return vfswrap_closedir(NULL, conn, dir);
 }
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/examples/VFS/skel_transparent.c samba-3.0.20-new/examples/VFS/skel_transparent.c
--- samba-3.0.20-orig/examples/VFS/skel_transparent.c	2005-07-28 08:19:54.000000000 -0500
+++ samba-3.0.20-new/examples/VFS/skel_transparent.c	2005-08-26 09:42:08.000000000 -0500
@@ -70,27 +70,27 @@
 	return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
 }
 
-static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
 	return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
 }
 
-static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	return SMB_VFS_NEXT_READDIR(handle, conn, dirp);
 }
 
-static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset)
+static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset)
 {
 	return SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset);
 }
 
-static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	return SMB_VFS_NEXT_TELLDIR(handle, conn, dirp);
 }
 
-static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	return SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp);
 }
@@ -105,7 +105,7 @@
 	return SMB_VFS_NEXT_RMDIR(handle, conn, path);
 }
 
-static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir)
+static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir)
 {
 	return SMB_VFS_NEXT_CLOSEDIR(handle, conn, dir);
 }
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/client/client.c samba-3.0.20-new/source/client/client.c
--- samba-3.0.20-orig/source/client/client.c	2005-07-28 08:19:53.000000000 -0500
+++ samba-3.0.20-new/source/client/client.c	2005-08-26 09:42:08.000000000 -0500
@@ -1379,7 +1379,7 @@
 static int file_find(struct file_list **list, const char *directory, 
 		      const char *expression, BOOL match)
 {
-	DIR *dir;
+	SMB_STRUCT_DIR *dir;
 	struct file_list *entry;
         struct stat statbuf;
         int ret;
@@ -1387,7 +1387,7 @@
 	BOOL isdir;
 	const char *dname;
 
-        dir = opendir(directory);
+        dir = sys_opendir(directory);
 	if (!dir)
 		return -1;
 	
@@ -1416,14 +1416,14 @@
 				
 				if (ret == -1) {
 					SAFE_FREE(path);
-					closedir(dir);
+					sys_closedir(dir);
 					return -1;
 				}
 			}
 			entry = SMB_MALLOC_P(struct file_list);
 			if (!entry) {
 				d_printf("Out of memory in file_find\n");
-				closedir(dir);
+				sys_closedir(dir);
 				return -1;
 			}
 			entry->file_path = path;
@@ -1434,7 +1434,7 @@
 		}
         }
 
-	closedir(dir);
+	sys_closedir(dir);
 	return 0;
 }
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/client/smbspool.c samba-3.0.20-new/source/client/smbspool.c
--- samba-3.0.20-orig/source/client/smbspool.c	2005-07-28 08:19:53.000000000 -0500
+++ samba-3.0.20-new/source/client/smbspool.c	2005-08-26 09:42:08.000000000 -0500
@@ -288,7 +288,7 @@
 static
 char * get_ticket_cache( uid_t uid )
 {
-  DIR *tcdir;                  /* directory where ticket caches are stored */
+  SMB_STRUCT_DIR *tcdir;                  /* directory where ticket caches are stored */
   SMB_STRUCT_DIRENT *dirent;   /* directory entry */
   char *filename = NULL;       /* holds file names on the tmp directory */
   SMB_STRUCT_STAT buf;        
@@ -298,7 +298,7 @@
   time_t t = 0;
   
   snprintf(user_cache_prefix, CC_MAX_FILE_LEN, "%s%d", CC_PREFIX, uid );
-  tcdir = opendir( TICKET_CC_DIR );
+  tcdir = sys_opendir( TICKET_CC_DIR );
   if ( tcdir == NULL ) 
     return NULL; 
   
@@ -331,6 +331,8 @@
     }
   }
 
+  sys_closedir(tcdir);
+
   if ( ticket_file == NULL )
   {
     /* no ticket cache found */
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/configure.in samba-3.0.20-new/source/configure.in
--- samba-3.0.20-orig/source/configure.in	2005-08-19 12:16:29.000000000 -0500
+++ samba-3.0.20-new/source/configure.in	2005-08-26 09:42:08.000000000 -0500
@@ -1089,8 +1089,9 @@
 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
 AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath)
 AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate chsize stat64 fstat64)
-AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
+AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64)
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
+AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64)
 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
 AC_CHECK_FUNCS(syslog vsyslog timegm)
 AC_CHECK_FUNCS(setlocale nl_langinfo)
@@ -1594,6 +1595,19 @@
     AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available])
 fi
 
+AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIR64,[
+AC_TRY_COMPILE([
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <dirent.h>],
+[DIR64 de;],
+samba_cv_HAVE_STRUCT_DIR64=yes,samba_cv_HAVE_STRUCT_DIR64=no)])
+if test x"$samba_cv_HAVE_STRUCT_DIR64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then
+    AC_DEFINE(HAVE_STRUCT_DIR64,1,[Whether the 'DIR64' abstract data type is available])
+fi
+
 AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[
 AC_TRY_COMPILE([
 #if defined(HAVE_UNISTD_H)
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/include/includes.h samba-3.0.20-new/source/include/includes.h
--- samba-3.0.20-orig/source/include/includes.h	2005-07-28 08:19:49.000000000 -0500
+++ samba-3.0.20-new/source/include/includes.h	2005-08-26 09:42:08.000000000 -0500
@@ -744,6 +744,18 @@
 #endif
 
 /*
+ * Type for DIR structure.
+ */
+
+#ifndef SMB_STRUCT_DIR
+#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64)
+#    define SMB_STRUCT_DIR DIR64
+#  else
+#    define SMB_STRUCT_DIR DIR
+#  endif
+#endif
+
+/*
  * Defines for 64 bit fcntl locks.
  */
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/include/vfs.h samba-3.0.20-new/source/include/vfs.h
--- samba-3.0.20-orig/source/include/vfs.h	2005-08-07 18:09:56.000000000 -0500
+++ samba-3.0.20-new/source/include/vfs.h	2005-08-26 09:42:08.000000000 -0500
@@ -59,7 +59,8 @@
 /* Changed to version 12 to add mask and attributes to opendir(). JRA 
    Also include aio calls. JRA. */
 /* Changed to version 13 as the internal structure of files_struct has changed. JRA */
-#define SMB_VFS_INTERFACE_VERSION 13
+/* Changed to version 14 as the we had to change DIR to SMB_STRUCT_DIR. JRA */
+#define SMB_VFS_INTERFACE_VERSION 14
 
 
 /* to bug old modules which are trying to compile with the old functions */
@@ -224,14 +225,14 @@
 		
 		/* Directory operations */
 		
-		DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attributes);
-		SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
-		void (*seekdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp, long offset);
-		long (*telldir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
-		void (*rewind_dir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp);
+		SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attributes);
+		SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp);
+		void (*seekdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset);
+		long (*telldir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp);
+		void (*rewind_dir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp);
 		int (*mkdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode);
 		int (*rmdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path);
-		int (*closedir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dir);
+		int (*closedir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dir);
 		
 		/* File operations */
 		
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/lib/system.c samba-3.0.20-new/source/lib/system.c
--- samba-3.0.20-orig/source/lib/system.c	2005-07-28 08:19:45.000000000 -0500
+++ samba-3.0.20-new/source/lib/system.c	2005-08-26 09:42:08.000000000 -0500
@@ -366,7 +366,7 @@
  An opendir wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-DIR *sys_opendir(const char *name)
+SMB_STRUCT_DIR *sys_opendir(const char *name)
 {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPENDIR64)
 	return opendir64(name);
@@ -379,7 +379,7 @@
  A readdir wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp)
+SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp)
 {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64)
 	return readdir64(dirp);
@@ -392,7 +392,7 @@
  A seekdir wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-void sys_seekdir(DIR *dirp, long offset)
+void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset)
 {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_SEEKDIR64)
 	seekdir64(dirp, offset);
@@ -405,7 +405,7 @@
  A telldir wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-long sys_telldir(DIR *dirp)
+long sys_telldir(SMB_STRUCT_DIR *dirp)
 {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_TELLDIR64)
 	return (long)telldir64(dirp);
@@ -418,7 +418,7 @@
  A rewinddir wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-void sys_rewinddir(DIR *dirp)
+void sys_rewinddir(SMB_STRUCT_DIR *dirp)
 {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_REWINDDIR64)
 	rewinddir64(dirp);
@@ -431,7 +431,7 @@
  A close wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-int sys_closedir(DIR *dirp)
+int sys_closedir(SMB_STRUCT_DIR *dirp)
 {
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CLOSEDIR64)
 	return closedir64(dirp);
@@ -960,7 +960,7 @@
  Wide opendir. Just narrow and call sys_xxx.
 ****************************************************************************/
 
-DIR *wsys_opendir(const smb_ucs2_t *wfname)
+SMB_STRUCT_DIR *wsys_opendir(const smb_ucs2_t *wfname)
 {
 	pstring fname;
 	return opendir(unicode_to_unix(fname,wfname,sizeof(fname)));
@@ -970,7 +970,7 @@
  Wide readdir. Return a structure pointer containing a wide filename.
 ****************************************************************************/
 
-SMB_STRUCT_WDIRENT *wsys_readdir(DIR *dirp)
+SMB_STRUCT_WDIRENT *wsys_readdir(SMB_STRUCT_DIR *dirp)
 {
 	static SMB_STRUCT_WDIRENT retval;
 	SMB_STRUCT_DIRENT *dirval = sys_readdir(dirp);
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_audit.c samba-3.0.20-new/source/modules/vfs_audit.c
--- samba-3.0.20-orig/source/modules/vfs_audit.c	2005-07-28 08:19:46.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_audit.c	2005-08-26 09:42:08.000000000 -0500
@@ -31,7 +31,7 @@
 
 static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user);
 static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn);
-static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr);
+static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr);
 static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode);
 static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path);
 static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode);
@@ -119,9 +119,9 @@
 	return;
 }
 
-static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
-	DIR *result;
+	SMB_STRUCT_DIR *result;
 	
 	result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_cap.c samba-3.0.20-new/source/modules/vfs_cap.c
--- samba-3.0.20-orig/source/modules/vfs_cap.c	2005-07-28 08:19:46.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_cap.c	2005-08-26 09:42:08.000000000 -0500
@@ -38,14 +38,14 @@
 					 dfree, dsize);
 }
 
-static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
         pstring capname;
         capencode(capname, fname);
 	return SMB_VFS_NEXT_OPENDIR(handle, conn, capname, mask, attr);
 }
 
-static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
         SMB_STRUCT_DIRENT *result;
 	DEBUG(3,("cap: cap_readdir\n"));
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_catia.c samba-3.0.20-new/source/modules/vfs_catia.c
--- samba-3.0.20-orig/source/modules/vfs_catia.c	2005-07-28 08:19:45.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_catia.c	2005-08-26 09:42:08.000000000 -0500
@@ -71,7 +71,7 @@
         catia_string_replace(s, '\xb1', ' ');
 }
 
-static DIR *catia_opendir(vfs_handle_struct *handle, connection_struct 
+static SMB_STRUCT_DIR *catia_opendir(vfs_handle_struct *handle, connection_struct 
 			  *conn, const char *fname, const char *mask, uint32 attr)
 {
         pstring name;
@@ -82,7 +82,7 @@
 }
 
 static SMB_STRUCT_DIRENT *catia_readdir(vfs_handle_struct *handle, 
-					connection_struct *conn, DIR *dirp)
+					connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
         SMB_STRUCT_DIRENT *result = SMB_VFS_NEXT_READDIR(handle, conn, dirp);
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_extd_audit.c samba-3.0.20-new/source/modules/vfs_extd_audit.c
--- samba-3.0.20-orig/source/modules/vfs_extd_audit.c	2005-07-28 08:19:46.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_extd_audit.c	2005-08-26 09:42:08.000000000 -0500
@@ -34,7 +34,7 @@
 
 static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user);
 static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn);
-static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr);
+static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr);
 static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode);
 static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path);
 static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode);
@@ -125,9 +125,9 @@
 	return;
 }
 
-static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
-	DIR *result;
+	SMB_STRUCT_DIR *result;
 
 	result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_full_audit.c samba-3.0.20-new/source/modules/vfs_full_audit.c
--- samba-3.0.20-orig/source/modules/vfs_full_audit.c	2005-07-28 08:19:45.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_full_audit.c	2005-08-26 09:42:08.000000000 -0500
@@ -86,22 +86,22 @@
                                 struct files_struct *fsp,
                                 SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
 
-static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
+static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
 			  const char *fname, const char *mask, uint32 attr);
 static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
-				    connection_struct *conn, DIR *dirp);
+				    connection_struct *conn, SMB_STRUCT_DIR *dirp);
 static void smb_full_audit_seekdir(vfs_handle_struct *handle, connection_struct *conn,
-			DIR *dirp, long offset);
+			SMB_STRUCT_DIR *dirp, long offset);
 static long smb_full_audit_telldir(vfs_handle_struct *handle, connection_struct *conn,
-			DIR *dirp);
+			SMB_STRUCT_DIR *dirp);
 static void smb_full_audit_rewinddir(vfs_handle_struct *handle, connection_struct *conn,
-			DIR *dirp);
+			SMB_STRUCT_DIR *dirp);
 static int smb_full_audit_mkdir(vfs_handle_struct *handle, connection_struct *conn,
 		       const char *path, mode_t mode);
 static int smb_full_audit_rmdir(vfs_handle_struct *handle, connection_struct *conn,
 		       const char *path);
 static int smb_full_audit_closedir(vfs_handle_struct *handle, connection_struct *conn,
-			  DIR *dirp);
+			  SMB_STRUCT_DIR *dirp);
 static int smb_full_audit_open(vfs_handle_struct *handle, connection_struct *conn,
 		      const char *fname, int flags, mode_t mode);
 static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
@@ -845,10 +845,10 @@
 	return result;
 }
 
-static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
+static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn,
 			  const char *fname, const char *mask, uint32 attr)
 {
-	DIR *result;
+	SMB_STRUCT_DIR *result;
 
 	result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
 
@@ -858,7 +858,7 @@
 }
 
 static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
-				    connection_struct *conn, DIR *dirp)
+				    connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	SMB_STRUCT_DIRENT *result;
 
@@ -873,7 +873,7 @@
 }
 
 static void smb_full_audit_seekdir(vfs_handle_struct *handle, connection_struct *conn,
-			DIR *dirp, long offset)
+			SMB_STRUCT_DIR *dirp, long offset)
 {
 	SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset);
 
@@ -882,7 +882,7 @@
 }
 
 static long smb_full_audit_telldir(vfs_handle_struct *handle, connection_struct *conn,
-			DIR *dirp)
+			SMB_STRUCT_DIR *dirp)
 {
 	long result;
 
@@ -894,7 +894,7 @@
 }
 
 static void smb_full_audit_rewinddir(vfs_handle_struct *handle, connection_struct *conn,
-			DIR *dirp)
+			SMB_STRUCT_DIR *dirp)
 {
 	SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp);
 
@@ -927,7 +927,7 @@
 }
 
 static int smb_full_audit_closedir(vfs_handle_struct *handle, connection_struct *conn,
-			  DIR *dirp)
+			  SMB_STRUCT_DIR *dirp)
 {
 	int result;
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_netatalk.c samba-3.0.20-new/source/modules/vfs_netatalk.c
--- samba-3.0.20-orig/source/modules/vfs_netatalk.c	2005-07-28 08:19:46.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_netatalk.c	2005-08-26 09:42:08.000000000 -0500
@@ -148,11 +148,11 @@
 {
 	char *dpath;
 	SMB_STRUCT_DIRENT *dent = 0;
-	DIR *dir;
+	SMB_STRUCT_DIR *dir;
 
 	if (!path) return;
 
-	dir = opendir(path);
+	dir = sys_opendir(path);
 	if (!dir) return;
 
 	while (NULL != (dent = sys_readdir(dir))) {
@@ -165,16 +165,16 @@
 		atalk_unlink_file(dpath);
 	}
 
-	closedir(dir);
+	sys_closedir(dir);
 }
 
 /* Disk operations */
 
 /* Directory operations */
 
-DIR *atalk_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+SMB_STRUCT_DIR *atalk_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
-	DIR *ret = 0;
+	SMB_STRUCT_DIR *ret = 0;
 
 	ret = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr);
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/modules/vfs_shadow_copy.c samba-3.0.20-new/source/modules/vfs_shadow_copy.c
--- samba-3.0.20-orig/source/modules/vfs_shadow_copy.c	2005-07-28 08:19:46.000000000 -0500
+++ samba-3.0.20-new/source/modules/vfs_shadow_copy.c	2005-08-26 09:42:08.000000000 -0500
@@ -72,10 +72,10 @@
 	return False;
 }
 
-static DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+static SMB_STRUCT_DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
 	shadow_copy_Dir *dirp;
-	DIR *p = SMB_VFS_NEXT_OPENDIR(handle,conn,fname,mask,attr);
+	SMB_STRUCT_DIR *p = SMB_VFS_NEXT_OPENDIR(handle,conn,fname,mask,attr);
 
 	if (!p) {
 		DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() failed for [%s]\n",fname));
@@ -119,10 +119,10 @@
 	}
 
 	SMB_VFS_NEXT_CLOSEDIR(handle,conn,p);
-	return((DIR *)dirp);
+	return((SMB_STRUCT_DIR *)dirp);
 }
 
-SMB_STRUCT_DIRENT *shadow_copy_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *_dirp)
+SMB_STRUCT_DIRENT *shadow_copy_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *_dirp)
 {
 	shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
 
@@ -133,7 +133,7 @@
 	return NULL;
 }
 
-static void shadow_copy_seekdir(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *_dirp, long offset)
+static void shadow_copy_seekdir(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *_dirp, long offset)
 {
 	shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
 
@@ -142,19 +142,19 @@
 	}
 }
 
-static long shadow_copy_telldir(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *_dirp)
+static long shadow_copy_telldir(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *_dirp)
 {
 	shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
 	return( dirp->pos ) ;
 }
 
-static void shadow_copy_rewinddir(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *_dirp)
+static void shadow_copy_rewinddir(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *_dirp)
 {
 	shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
 	dirp->pos = 0 ;
 }
 
-int shadow_copy_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *_dirp)
+int shadow_copy_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *_dirp)
 {
 	shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
 
@@ -166,7 +166,7 @@
 
 static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
 {
-	DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn,fsp->conn->connectpath,NULL,0);
+	SMB_STRUCT_DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn,fsp->conn->connectpath,NULL,0);
 
 	shadow_copy_data->num_volumes = 0;
 	shadow_copy_data->labels = NULL;
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/script/mkproto.awk samba-3.0.20-new/source/script/mkproto.awk
--- samba-3.0.20-orig/source/script/mkproto.awk	2005-07-28 08:19:52.000000000 -0500
+++ samba-3.0.20-new/source/script/mkproto.awk	2005-08-26 09:42:08.000000000 -0500
@@ -136,7 +136,7 @@
     gotstart = 1;
   }
 
-  if( $0 ~ /^NODE_STATUS_STRUCT/ ) {
+  if( $0 ~ /^NODE_STATUS_STRUCT|SMB_STRUCT_DIR/ ) {
     gotstart = 1;
   }
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/smbd/chgpasswd.c samba-3.0.20-new/source/smbd/chgpasswd.c
--- samba-3.0.20-orig/source/smbd/chgpasswd.c	2005-07-28 08:19:42.000000000 -0500
+++ samba-3.0.20-new/source/smbd/chgpasswd.c	2005-08-26 09:42:08.000000000 -0500
@@ -64,7 +64,7 @@
 {
 	int master;
 	static fstring line;
-	DIR *dirp;
+	SMB_STRUCT_DIR *dirp;
 	const char *dpname;
 
 #if defined(HAVE_GRANTPT)
@@ -93,7 +93,7 @@
 
 	fstrcpy(line, "/dev/ptyXX");
 
-	dirp = opendir("/dev");
+	dirp = sys_opendir("/dev");
 	if (!dirp)
 		return (-1);
 	while ((dpname = readdirname(dirp)) != NULL)
@@ -110,12 +110,12 @@
 				DEBUG(3, ("pty: opened %s\n", line));
 				line[5] = 't';
 				*slave = line;
-				closedir(dirp);
+				sys_closedir(dirp);
 				return (master);
 			}
 		}
 	}
-	closedir(dirp);
+	sys_closedir(dirp);
 	return (-1);
 }
 
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/smbd/dir.c samba-3.0.20-new/source/smbd/dir.c
--- samba-3.0.20-orig/source/smbd/dir.c	2005-07-28 08:19:43.000000000 -0500
+++ samba-3.0.20-new/source/smbd/dir.c	2005-08-26 09:42:08.000000000 -0500
@@ -42,7 +42,7 @@
 
 struct smb_Dir {
 	connection_struct *conn;
-	DIR *dir;
+	SMB_STRUCT_DIR *dir;
 	long offset;
 	char *dir_path;
 	struct name_cache_entry *name_cache;
@@ -1098,6 +1098,9 @@
 		}
 		dirp->file_number++;
 		return n;
+	} else if (*poffset == END_OF_DIRECTORY_OFFSET) {
+		*poffset = dirp->offset = END_OF_DIRECTORY_OFFSET;
+		return NULL;
 	} else {
 		/* A real offset, seek to it. */
 		SeekDir(dirp, *poffset);
@@ -1120,7 +1123,7 @@
 		dirp->file_number++;
 		return e->name;
 	}
-	dirp->offset = END_OF_DIRECTORY_OFFSET;
+	*poffset = dirp->offset = END_OF_DIRECTORY_OFFSET;
 	return NULL;
 }
 
@@ -1145,6 +1148,8 @@
 	if (offset != dirp->offset) {
 		if (offset == START_OF_DIRECTORY_OFFSET || offset == DOT_DOT_DIRECTORY_OFFSET) {
 			RewindDir(dirp, &offset);
+		} else if (offset == END_OF_DIRECTORY_OFFSET) {
+			; /* Don't seek in this case. */
 		} else {
 			SMB_VFS_SEEKDIR(dirp->conn, dirp->dir, offset);
 		}
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/smbd/msdfs.c samba-3.0.20-new/source/smbd/msdfs.c
--- samba-3.0.20-orig/source/smbd/msdfs.c	2005-08-07 18:09:53.000000000 -0500
+++ samba-3.0.20-new/source/smbd/msdfs.c	2005-08-26 09:42:08.000000000 -0500
@@ -1010,7 +1010,7 @@
 static int form_junctions(TALLOC_CTX *ctx, int snum, struct junction_map *jucn, int jn_remain)
 {
 	int cnt = 0;
-	DIR *dirp;
+	SMB_STRUCT_DIR *dirp;
 	char* dname;
 	pstring connect_path;
 	char* service_name = lp_servicename(snum);
diff -uBbrN --exclude-from=/misc/src/samba-cvs/diff.excludes samba-3.0.20-orig/source/smbd/vfs-wrap.c samba-3.0.20-new/source/smbd/vfs-wrap.c
--- samba-3.0.20-orig/source/smbd/vfs-wrap.c	2005-07-28 08:19:43.000000000 -0500
+++ samba-3.0.20-new/source/smbd/vfs-wrap.c	2005-08-26 09:42:08.000000000 -0500
@@ -88,9 +88,9 @@
     
 /* Directory operations */
 
-DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
+SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr)
 {
-	DIR *result;
+	SMB_STRUCT_DIR *result;
 
 	START_PROFILE(syscall_opendir);
 	result = sys_opendir(fname);
@@ -98,7 +98,7 @@
 	return result;
 }
 
-SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	SMB_STRUCT_DIRENT *result;
 
@@ -108,14 +108,14 @@
 	return result;
 }
 
-void vfswrap_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset)
+void vfswrap_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset)
 {
 	START_PROFILE(syscall_seekdir);
 	sys_seekdir(dirp, offset);
 	END_PROFILE(syscall_seekdir);
 }
 
-long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	long result;
 	START_PROFILE(syscall_telldir);
@@ -124,7 +124,7 @@
 	return result;
 }
 
-void vfswrap_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+void vfswrap_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	START_PROFILE(syscall_rewinddir);
 	sys_rewinddir(dirp);
@@ -170,7 +170,7 @@
 	return result;
 }
 
-int vfswrap_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp)
+int vfswrap_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp)
 {
 	int result;