[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Nov 29 03:22:36 MST 2009


The branch, master has been updated
       via  69a6820... s3: Restore "fake directory create times" as a share parameter
       via  e71c17b... s3: "copy_reg" only looks at mode, uid, gid, atime and mtime (no birthtime)
       via  224691a... s3: Pass up fake_dir_create_times from atalk_build_paths
       via  36e8d8e... s3: Move directory_exist_stat to testparm.c, it only looks at the mode
       via  33601b8... s3: Pass fake_dir_create_times down to file_exist_stat, none of the callers look at the mtime
       via  129e976... s3: "startsmbfilepwent" only looks at the inode -- is that enough?
       via  6e94113... s3: "get_file_size" only looks at the size
       via  9009277... s3: "socket_exist" only looks at the mode
       via  66e6439... s3: "sys_path_to_bdev" only looks at the devicenumber
       via  c4f9adf... s3: "check_log_size" only looks at the size
       via  77fb5e1... s3: "regf_hbin_allocate" only looks at the size
       via  d5e5d09... s3: "read_block" only looks at the size
       via  13e7005... s3: "write_block" does not use the sbuf at all
       via  5915996... s3: "net_conf_addshare" only looks at the mode
       via  2f2a156... s3: "net_usershare_add" only looks at the mode, device and inode
       via  2a7778f... s3: "net_usershare_add" only looks at the device and inode
       via  41b2af3... s3: "net_usershare_add" only looks at the mode and uid
       via  36eed01... s3: "count_num_usershares" only looks at the mode
       via  7c65709... s3: "info_fn" only looks at the mode and uid
       via  a95404b... s3: "get_share_list" only looks at the mode and uid
       via  188b940... s3: "cgi_download" only looks at the mode and size
       via  b1a0c68... s3: "print_job_end" only looks at the size
       via  19a7a6c... s3: "check_magic" only looks at the size
       via  359e71d... s3: "disk_quotas" only looks at the devicenumber
       via  e41e21b... s3: "load_usershare_shares" only looks at the mode and uid
       via  5e6031c... s3: "load_usershare_service" only looks at the mode and uid
       via  7e9c2c5... s3: "usershare_exists" only looks at the mode and mtime
       via  e539274... s3: "process_usershare_file" only looks at the dev, ino, mode and size
       via  552313a... s3: "process_usershare_file" only looks at the mode and size
       via  0d0eec9... s3: "parse_usershare_file" only looks at the mode and uid
       via  5ba42b0... s3: "tar_parseargs" only looks at the mtime
       via  e1f53e5... s3: "dotareof" only looks at the file type
       via  932ab0c... s3: client "newer" does not look at the create timestamp
       via  44ce560... s3: Pass the "fake dir create times" parameter to sys_*stat
      from  b973c50... s4:upgrade_from_s3 - Move it back to "setup"

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 69a68208bd971dbe9905dedd0554b3a79d2d2ce6
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 15:44:50 2009 +0100

    s3: Restore "fake directory create times" as a share parameter

commit e71c17b2b008ba926e74dd184523723a742b76ba
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 15:10:23 2009 +0100

    s3: "copy_reg" only looks at mode, uid, gid, atime and mtime (no birthtime)

commit 224691aa53e1ed407de69182fdb045e6c73bcb38
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 14:58:46 2009 +0100

    s3: Pass up fake_dir_create_times from atalk_build_paths
    
    The callers only look at the mode

commit 36e8d8ed455ab712023ddc199beaeb01e4d40ff2
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:19:30 2009 +0100

    s3: Move directory_exist_stat to testparm.c, it only looks at the mode

commit 33601b8632edf65af4d4ab787c5615ab5c6af6fb
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:17:05 2009 +0100

    s3: Pass fake_dir_create_times down to file_exist_stat, none of the callers look at the mtime

commit 129e976c47037731c9344a3994597b5781210914
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:12:40 2009 +0100

    s3: "startsmbfilepwent" only looks at the inode -- is that enough?

commit 6e94113b6f23622e0e5688cd1b7e9acf23391de9
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:11:17 2009 +0100

    s3: "get_file_size" only looks at the size

commit 9009277b76cfee708954e2b4c7172b955ad0c633
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:10:48 2009 +0100

    s3: "socket_exist" only looks at the mode

commit 66e6439b7bf19bec1cc8a59667253b68dc0f3ce9
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:08:51 2009 +0100

    s3: "sys_path_to_bdev" only looks at the devicenumber

commit c4f9adf9dd83265358f8f086add883d63890c68f
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:07:54 2009 +0100

    s3: "check_log_size" only looks at the size

commit 77fb5e19d8a09b3f649ecaeed16118e4229bdedc
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:07:12 2009 +0100

    s3: "regf_hbin_allocate" only looks at the size

commit d5e5d09d73d4033aad54dd8dd3edb2c6fd7d630e
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:06:44 2009 +0100

    s3: "read_block" only looks at the size

commit 13e70058c01afa474cad66e25e5c37fc8d2c5488
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:06:14 2009 +0100

    s3: "write_block" does not use the sbuf at all

commit 591599645263fc95a2b3f0e8dee6eac32a4f7790
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:05:16 2009 +0100

    s3: "net_conf_addshare" only looks at the mode

commit 2f2a156c7348d9911ce26636544303f8d1f15ff0
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:04:38 2009 +0100

    s3: "net_usershare_add" only looks at the mode, device and inode

commit 2a7778f7b20b77b82bd4a78609586025ea4a3330
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:04:18 2009 +0100

    s3: "net_usershare_add" only looks at the device and inode

commit 41b2af34b166108475de3142de43c7b239b8b18a
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:03:09 2009 +0100

    s3: "net_usershare_add" only looks at the mode and uid

commit 36eed017301fdb7ab017b8ccaab6a877aa0d8727
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:02:26 2009 +0100

    s3: "count_num_usershares" only looks at the mode

commit 7c657098872588ac209ae30d40b08e88c003a05b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:01:46 2009 +0100

    s3: "info_fn" only looks at the mode and uid

commit a95404bbaedb5528ec47a54e7cdaa952fb9a71f4
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:00:51 2009 +0100

    s3: "get_share_list" only looks at the mode and uid

commit 188b94012b33f0e225d3fff89813d96ca13dbe05
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 13:00:10 2009 +0100

    s3: "cgi_download" only looks at the mode and size

commit b1a0c68ff2408081e10dc29ebe745a51cda3b73a
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:59:11 2009 +0100

    s3: "print_job_end" only looks at the size

commit 19a7a6cbe39dd1a5d0a1ddccfab1ff07db7b041a
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:58:26 2009 +0100

    s3: "check_magic" only looks at the size

commit 359e71d956dc912a9b548b3e40612b7f40ef94ea
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:57:43 2009 +0100

    s3: "disk_quotas" only looks at the devicenumber

commit e41e21b9d443930604092853b3bef4ef33759a13
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:53:48 2009 +0100

    s3: "load_usershare_shares" only looks at the mode and uid

commit 5e6031c9c584a517daa881a5c1832b0c61374547
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:53:23 2009 +0100

    s3: "load_usershare_service" only looks at the mode and uid

commit 7e9c2c5df33c55f47000573245551b50043bc590
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:52:31 2009 +0100

    s3: "usershare_exists" only looks at the mode and mtime

commit e5392748ec9ceb70d342f85d0194d47417509752
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:51:56 2009 +0100

    s3: "process_usershare_file" only looks at the dev, ino, mode and size

commit 552313a79c27d47005fbf0e663797ca82303a7c0
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:51:04 2009 +0100

    s3: "process_usershare_file" only looks at the mode and size

commit 0d0eec9fb26cf6100a7671a1cf75e2a68a5dd3ba
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:49:42 2009 +0100

    s3: "parse_usershare_file" only looks at the mode and uid

commit 5ba42b0a5bbd5ab1eaecd4301d8e5e7ee79db8e8
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:48:33 2009 +0100

    s3: "tar_parseargs" only looks at the mtime

commit e1f53e5d49c0a1a0a07afc91843aca955ca3f653
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:47:57 2009 +0100

    s3: "dotareof" only looks at the file type

commit 932ab0c299c89ae63a35f8b0a59e0c03b9c5ec3f
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:44:33 2009 +0100

    s3: client "newer" does not look at the create timestamp

commit 44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 27 12:42:39 2009 +0100

    s3: Pass the "fake dir create times" parameter to sys_*stat
    
    Step 0 to restore it as a per-share paramter

-----------------------------------------------------------------------

Summary of changes:
 .../smbdotconf/misc/fakedirectorycreatetimes.xml   |    2 +-
 source3/client/client.c                            |    6 ++--
 source3/client/clitar.c                            |    5 ++-
 source3/include/proto.h                            |   15 +++++---
 source3/lib/debug.c                                |    3 +-
 source3/lib/sysquotas.c                            |    6 ++--
 source3/lib/system.c                               |   24 +++++++-----
 source3/lib/util.c                                 |   30 +++-------------
 source3/modules/vfs_default.c                      |   11 ++++--
 source3/modules/vfs_netatalk.c                     |   39 ++++++++++++--------
 source3/param/loadparm.c                           |   21 ++++++-----
 source3/passdb/pdb_smbpasswd.c                     |    4 +-
 source3/printing/printing.c                        |    2 +-
 source3/registry/regfio.c                          |    6 ++--
 source3/smbd/close.c                               |    2 +-
 source3/smbd/quotas.c                              |   28 ++++++++-------
 source3/utils/net_conf.c                           |    2 +-
 source3/utils/net_usershare.c                      |   12 +++---
 source3/utils/testparm.c                           |   21 +++++++++++
 source3/web/cgi.c                                  |    6 ++--
 20 files changed, 135 insertions(+), 110 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/misc/fakedirectorycreatetimes.xml b/docs-xml/smbdotconf/misc/fakedirectorycreatetimes.xml
index 7c8807e..974b6f0 100644
--- a/docs-xml/smbdotconf/misc/fakedirectorycreatetimes.xml
+++ b/docs-xml/smbdotconf/misc/fakedirectorycreatetimes.xml
@@ -1,5 +1,5 @@
 <samba:parameter name="fake directory create times"
-		 context="G"
+		 context="S"
 		 type="boolean"
 		 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
diff --git a/source3/client/client.c b/source3/client/client.c
index ca2f9a8..504b1dd 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1745,7 +1745,7 @@ static int cmd_put(void)
 		SMB_STRUCT_STAT st;
 		/* allow '-' to represent stdin
 		   jdblair, 24.jun.98 */
-		if (!file_exist_stat(lname,&st) &&
+		if (!file_exist_stat(lname, &st, false) &&
 		    (strcmp(lname,"-"))) {
 			d_printf("%s does not exist\n",lname);
 			return 1;
@@ -3439,7 +3439,7 @@ static int cmd_newer(void)
 	SMB_STRUCT_STAT sbuf;
 
 	ok = next_token_talloc(ctx, &cmd_ptr,&buf,NULL);
-	if (ok && (sys_stat(buf,&sbuf) == 0)) {
+	if (ok && (sys_stat(buf, &sbuf, false) == 0)) {
 		newer_than = convert_timespec_to_time_t(sbuf.st_ex_mtime);
 		DEBUG(1,("Getting files newer than %s",
 			 time_to_asc(newer_than)));
@@ -3618,7 +3618,7 @@ static int cmd_reput(void)
 		return 1;
 	}
 
-	if (!file_exist_stat(local_name, &st)) {
+	if (!file_exist_stat(local_name, &st, false)) {
 		d_printf("%s does not exist\n", local_name);
 		return 1;
 	}
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index d973329..fc98fa8 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -404,7 +404,7 @@ static void dotareof(int f)
 	(void) dozerobuf(f, TBLOCK);
 	(void) dozerobuf(f, TBLOCK);
 
-	if (sys_fstat(f, &stbuf) == -1) {
+	if (sys_fstat(f, &stbuf, false) == -1) {
 		DEBUG(0, ("Couldn't stat file handle\n"));
 		return;
 	}
@@ -1792,7 +1792,8 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
 				} else {
 					SMB_STRUCT_STAT stbuf;
 
-					if (sys_stat(argv[Optind], &stbuf) == 0) {
+					if (sys_stat(argv[Optind], &stbuf,
+						     false) == 0) {
 						newer_than = convert_timespec_to_time_t(
 							stbuf.st_ex_mtime);
 						DEBUG(1,("Getting files newer than %s",
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9e0f3a2..f0ce7a3 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -925,9 +925,12 @@ int sys_fcntl_ptr(int fd, int cmd, void *arg);
 int sys_fcntl_long(int fd, int cmd, long arg);
 void update_stat_ex_mtime(struct stat_ex *dst, struct timespec write_ts);
 void update_stat_ex_create_time(struct stat_ex *dst, struct timespec create_time);
-int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
-int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
-int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf);
+int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
+	     bool fake_dir_create_times);
+int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf,
+	      bool fake_dir_create_times);
+int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
+	      bool fake_dir_create_times);
 int sys_ftruncate(int fd, SMB_OFF_T offset);
 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
@@ -1116,9 +1119,9 @@ struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
 						 const struct user_auth_info *info);
 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
-bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
+bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
+		     bool fake_dir_create_times);
 bool socket_exist(const char *fname);
-bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
 uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
 SMB_OFF_T get_file_size(char *file_name);
 char *attrib_string(uint16 mode);
@@ -4207,7 +4210,7 @@ bool lp_recursive_veto_delete(int );
 bool lp_dos_filemode(int );
 bool lp_dos_filetimes(int );
 bool lp_dos_filetime_resolution(int );
-bool lp_fake_dir_create_times(void);
+bool lp_fake_dir_create_times(int);
 bool lp_blocking_locks(int );
 bool lp_inherit_perms(int );
 bool lp_inherit_acls(int );
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index e851fd2..80b8310 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -746,7 +746,8 @@ void check_log_size( void )
 
 	maxlog = lp_max_log_size() * 1024;
 
-	if( sys_fstat( x_fileno( dbf ), &st ) == 0 && st.st_ex_size > maxlog ) {
+	if(sys_fstat(x_fileno(dbf), &st, false) == 0
+	   && st.st_ex_size > maxlog ) {
 		(void)reopen_logs();
 		if( dbf && get_file_size( debugf ) > maxlog ) {
 			char *name = NULL;
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index 7eed0ca..3d4697c 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -60,7 +60,7 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
 	(*bdev) = NULL;
 	(*fs) = NULL;
 	
-	if ( sys_stat(path, &S) == -1 )
+	if ( sys_stat(path, &S, false) == -1 )
 		return (-1);
 
 	devno = S.st_ex_dev ;
@@ -71,7 +71,7 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
 	}
   
 	while ((mnt = getmntent(fp))) {
-		if ( sys_stat(mnt->mnt_dir,&S) == -1 )
+		if ( sys_stat(mnt->mnt_dir, &S, false) == -1 )
 			continue ;
 
 		if (S.st_ex_dev == devno) {
@@ -114,7 +114,7 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
 	
 	/* find the block device file */
 
-	if ((ret=sys_stat(path, &S))!=0) {
+	if ((ret=sys_stat(path, &S, false))!=0) {
 		return ret;
 	}
 	
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 8abcb3d..86802d0 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -456,9 +456,10 @@ static struct timespec calc_create_time_stat_ex(const struct stat_ex *st)
  use the best approximation.
 ****************************************************************************/
 
-static void make_create_timespec(const struct stat *pst, struct stat_ex *dst)
+static void make_create_timespec(const struct stat *pst, struct stat_ex *dst,
+				 bool fake_dir_create_times)
 {
-	if (S_ISDIR(pst->st_mode) && lp_fake_dir_create_times()) {
+	if (S_ISDIR(pst->st_mode) && fake_dir_create_times) {
 		dst->st_ex_btime.tv_sec = 315493200L;          /* 1/1/1980 */
 		dst->st_ex_btime.tv_nsec = 0;
 	}
@@ -512,7 +513,8 @@ void update_stat_ex_create_time(struct stat_ex *dst,
 }
 
 static void init_stat_ex_from_stat (struct stat_ex *dst,
-				    const struct stat *src)
+				    const struct stat *src,
+				    bool fake_dir_create_times)
 {
 	dst->st_ex_dev = src->st_dev;
 	dst->st_ex_ino = src->st_ino;
@@ -525,7 +527,7 @@ static void init_stat_ex_from_stat (struct stat_ex *dst,
 	dst->st_ex_atime = get_atimespec(src);
 	dst->st_ex_mtime = get_mtimespec(src);
 	dst->st_ex_ctime = get_ctimespec(src);
-	make_create_timespec(src, dst);
+	make_create_timespec(src, dst, fake_dir_create_times);
 	dst->st_ex_blksize = src->st_blksize;
 	dst->st_ex_blocks = src->st_blocks;
 
@@ -540,7 +542,8 @@ static void init_stat_ex_from_stat (struct stat_ex *dst,
 A stat() wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
+int sys_stat(const char *fname, SMB_STRUCT_STAT *sbuf,
+	     bool fake_dir_create_times)
 {
 	int ret;
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_STAT64)
@@ -554,7 +557,7 @@ int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
 		if (S_ISDIR(statbuf.st_mode)) {
 			statbuf.st_size = 0;
 		}
-		init_stat_ex_from_stat(sbuf, &statbuf);
+		init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
 	}
 	return ret;
 }
@@ -563,7 +566,7 @@ int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
  An fstat() wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
+int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf, bool fake_dir_create_times)
 {
 	int ret;
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FSTAT64)
@@ -577,7 +580,7 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
 		if (S_ISDIR(statbuf.st_mode)) {
 			statbuf.st_size = 0;
 		}
-		init_stat_ex_from_stat(sbuf, &statbuf);
+		init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
 	}
 	return ret;
 }
@@ -586,7 +589,8 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
  An lstat() wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
 
-int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
+int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
+	      bool fake_dir_create_times)
 {
 	int ret;
 #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSTAT64)
@@ -600,7 +604,7 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
 		if (S_ISDIR(statbuf.st_mode)) {
 			statbuf.st_size = 0;
 		}
-		init_stat_ex_from_stat(sbuf, &statbuf);
+		init_stat_ex_from_stat(sbuf, &statbuf, fake_dir_create_times);
 	}
 	return ret;
 }
diff --git a/source3/lib/util.c b/source3/lib/util.c
index e0b09c4..8525d9c 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -527,13 +527,14 @@ void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info)
  Check if a file exists - call vfs_file_exist for samba files.
 ********************************************************************/
 
-bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
+bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
+		     bool fake_dir_create_times)
 {
 	SMB_STRUCT_STAT st;
 	if (!sbuf)
 		sbuf = &st;
 
-	if (sys_stat(fname,sbuf) != 0) 
+	if (sys_stat(fname, sbuf, fake_dir_create_times) != 0)
 		return(False);
 
 	return((S_ISREG(sbuf->st_ex_mode)) || (S_ISFIFO(sbuf->st_ex_mode)));
@@ -546,34 +547,13 @@ bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
 bool socket_exist(const char *fname)
 {
 	SMB_STRUCT_STAT st;
-	if (sys_stat(fname,&st) != 0) 
+	if (sys_stat(fname, &st, false) != 0)
 		return(False);
 
 	return S_ISSOCK(st.st_ex_mode);
 }
 
 /*******************************************************************
- Check if a directory exists.
-********************************************************************/
-
-bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st)
-{
-	SMB_STRUCT_STAT st2;
-	bool ret;
-
-	if (!st)
-		st = &st2;
-
-	if (sys_stat(dname,st) != 0) 
-		return(False);
-
-	ret = S_ISDIR(st->st_ex_mode);
-	if(!ret)
-		errno = ENOTDIR;
-	return ret;
-}
-
-/*******************************************************************
  Returns the size in bytes of the named given the stat struct.
 ********************************************************************/
 
@@ -590,7 +570,7 @@ SMB_OFF_T get_file_size(char *file_name)
 {
 	SMB_STRUCT_STAT buf;
 	buf.st_ex_size = 0;
-	if(sys_stat(file_name,&buf) != 0)
+	if (sys_stat(file_name, &buf, false) != 0)
 		return (SMB_OFF_T)-1;
 	return get_file_size_stat(&buf);
 }
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 258caf8..9abf792 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -487,7 +487,7 @@ static int copy_reg(const char *source, const char *dest)
 	int ifd = -1;
 	int ofd = -1;
 
-	if (sys_lstat (source, &source_stats) == -1)
+	if (sys_lstat(source, &source_stats, false) == -1)
 		return -1;
 
 	if (!S_ISREG (source_stats.st_ex_mode))
@@ -615,7 +615,8 @@ static int vfswrap_stat(vfs_handle_struct *handle,
 		goto out;
 	}
 
-	result = sys_stat(smb_fname->base_name, &smb_fname->st);
+	result = sys_stat(smb_fname->base_name, &smb_fname->st,
+			  lp_fake_dir_create_times(SNUM(handle->conn)));
  out:
 	END_PROFILE(syscall_stat);
 	return result;
@@ -626,7 +627,8 @@ static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUC
 	int result;
 
 	START_PROFILE(syscall_fstat);
-	result = sys_fstat(fsp->fh->fd, sbuf);
+	result = sys_fstat(fsp->fh->fd,
+			   sbuf, lp_fake_dir_create_times(SNUM(handle->conn)));
 	END_PROFILE(syscall_fstat);
 	return result;
 }
@@ -643,7 +645,8 @@ static int vfswrap_lstat(vfs_handle_struct *handle,
 		goto out;
 	}
 
-	result = sys_lstat(smb_fname->base_name, &smb_fname->st);
+	result = sys_lstat(smb_fname->base_name, &smb_fname->st,
+			   lp_fake_dir_create_times(SNUM(handle->conn)));
  out:
 	END_PROFILE(syscall_lstat);
 	return result;
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index fa9e774..68f6a31 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -29,8 +29,11 @@
 /* atalk functions */
 
 static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
-  const char *fname, char **adbl_path, char **orig_path, 
-  SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info);
+			     const char *fname,
+			     char **adbl_path, char **orig_path,
+			     SMB_STRUCT_STAT *adbl_info,
+			     SMB_STRUCT_STAT *orig_info,
+			     bool fake_dir_create_times);
 
 static int atalk_unlink_file(const char *path);
 
@@ -52,9 +55,12 @@ static int atalk_get_path_ptr(char *path)
 	return ptr;
 }
 
-static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fname,
-                              char **adbl_path, char **orig_path,
-                              SMB_STRUCT_STAT *adbl_info, SMB_STRUCT_STAT *orig_info)
+static int atalk_build_paths(TALLOC_CTX *ctx, const char *path,
+			     const char *fname,
+			     char **adbl_path, char **orig_path,
+			     SMB_STRUCT_STAT *adbl_info,
+			     SMB_STRUCT_STAT *orig_info,
+			     bool fake_dir_create_times)
 {
 	int ptr0 = 0;
 	int ptr1 = 0;
@@ -80,7 +86,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fnam
 	/* get pointer to last '/' */
 	ptr1 = atalk_get_path_ptr(*orig_path);
 
-	sys_lstat(*orig_path, orig_info);
+	sys_lstat(*orig_path, orig_info, fake_dir_create_times);
 
 	if (S_ISDIR(orig_info->st_ex_mode)) {
 		*adbl_path = talloc_asprintf(ctx, "%s/%s/%s/", 
@@ -95,7 +101,7 @@ static int atalk_build_paths(TALLOC_CTX *ctx, const char *path, const char *fnam
 #if 0
 	DEBUG(3, ("ATALK: DEBUG:\n%s\n%s\n", *orig_path, *adbl_path)); 
 #endif
-	sys_lstat(*adbl_path, adbl_info);
+	sys_lstat(*adbl_path, adbl_info, fake_dir_create_times);
 	return 0;
 }
 
@@ -243,7 +249,7 @@ static int atalk_rename(struct vfs_handle_struct *handle,
 
 	if (atalk_build_paths(talloc_tos(), handle->conn->origpath, oldname,
 			      &adbl_path, &orig_path, &adbl_info,
-			      &orig_info) != 0)
+			      &orig_info, false) != 0)
 		goto exit_rename;
 
 	if (S_ISDIR(orig_info.st_ex_mode) || S_ISREG(orig_info.st_ex_mode)) {
@@ -304,7 +310,7 @@ static int atalk_unlink(struct vfs_handle_struct *handle,
 
 	if (atalk_build_paths(talloc_tos(), handle->conn->origpath, path,
 			      &adbl_path, &orig_path,
-	  &adbl_info, &orig_info) != 0)
+			      &adbl_info, &orig_info, false) != 0)
 		goto exit_unlink;
 
 	if (S_ISDIR(orig_info.st_ex_mode) || S_ISREG(orig_info.st_ex_mode)) {
@@ -337,8 +343,9 @@ static int atalk_chmod(struct vfs_handle_struct *handle, const char *path, mode_
 	if (!(ctx = talloc_init("chmod_file")))
 		return ret;
 
-	if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path, &orig_path,
-	  &adbl_info, &orig_info) != 0)
+	if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path,
+			      &orig_path, &adbl_info, &orig_info,
+			      false) != 0)
 		goto exit_chmod;
 
 	if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
@@ -369,8 +376,9 @@ static int atalk_chown(struct vfs_handle_struct *handle, const char *path, uid_t
 	if (!(ctx = talloc_init("chown_file")))
 		return ret;
 
-	if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path, &orig_path,
-	  &adbl_info, &orig_info) != 0)
+	if (atalk_build_paths(ctx, handle->conn->origpath, path,
+			      &adbl_path, &orig_path,
+			      &adbl_info, &orig_info, false) != 0)
 		goto exit_chown;
 
 	if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
@@ -403,8 +411,9 @@ static int atalk_lchown(struct vfs_handle_struct *handle, const char *path, uid_
 	if (!(ctx = talloc_init("lchown_file")))
 		return ret;
 
-	if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path, &orig_path,
-	  &adbl_info, &orig_info) != 0)
+	if (atalk_build_paths(ctx, handle->conn->origpath, path,
+			      &adbl_path, &orig_path,
+			      &adbl_info, &orig_info, false) != 0)
 		goto exit_lchown;
 
 	if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 83c6ef5..29e3a25 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -357,7 +357,6 @@ struct global {
 	int cups_connection_timeout;
 	char *szSMBPerfcountModule;
 	bool bMapUntrustedToDomain;
-	bool bFakeDirCreateTimes;
 };
 
 static struct global Globals;
@@ -475,6 +474,7 @@ struct service {
 	bool bDosFilemode;
 	bool bDosFiletimes;
 	bool bDosFiletimeResolution;
+	bool bFakeDirCreateTimes;
 	bool bBlockingLocks;
 	bool bInheritPerms;
 	bool bInheritACLS;
@@ -618,6 +618,7 @@ static struct service sDefault = {
 	False,			/* bDosFilemode */
 	True,			/* bDosFiletimes */
 	False,			/* bDosFiletimeResolution */
+	False,			/* bFakeDirCreateTimes */
 	True,			/* bBlockingLocks */
 	False,			/* bInheritPerms */
 	False,			/* bInheritACLS */
@@ -4301,8 +4302,8 @@ static struct parm_struct parm_table[] = {
 	{
 		.label		= "fake directory create times",
 		.type		= P_BOOL,
-		.p_class	= P_GLOBAL,
-		.ptr		= &Globals.bFakeDirCreateTimes,
+		.p_class	= P_LOCAL,
+		.ptr		= &sDefault.bFakeDirCreateTimes,
 		.special	= NULL,
 		.enum_list	= NULL,
 		.flags		= FLAG_ADVANCED | FLAG_GLOBAL,
@@ -5629,7 +5630,7 @@ FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list