[SCM] Samba Shared Repository - branch v3-5-test updated

Volker Lendecke vlendec at samba.org
Sun Nov 29 04:05:23 MST 2009


The branch, v3-5-test has been updated
       via  bd652cc... s3: Restore "fake directory create times" as a share parameter
       via  0d03ddd... s3: "copy_reg" only looks at mode, uid, gid, atime and mtime (no birthtime)
       via  5bb20f3... s3: Pass up fake_dir_create_times from atalk_build_paths
       via  f216509... s3: Move directory_exist_stat to testparm.c, it only looks at the mode
       via  6d432d4... s3: Pass fake_dir_create_times down to file_exist_stat, none of the callers look at the mtime
       via  70b754a... s3: "startsmbfilepwent" only looks at the inode -- is that enough?
       via  dd82e9d... s3: "get_file_size" only looks at the size
       via  581a334... s3: "socket_exist" only looks at the mode
       via  8a79bc6... s3: "sys_path_to_bdev" only looks at the devicenumber
       via  c7f1c62... s3: "check_log_size" only looks at the size
       via  37f1a09... s3: "regf_hbin_allocate" only looks at the size
       via  7e0f610... s3: "read_block" only looks at the size
       via  72a7a1d... s3: "write_block" does not use the sbuf at all
       via  04435d7... s3: "net_conf_addshare" only looks at the mode
       via  4cc0045... s3: "net_usershare_add" only looks at the mode, device and inode
       via  50a3344... s3: "net_usershare_add" only looks at the device and inode
       via  ad2be46... s3: "net_usershare_add" only looks at the mode and uid
       via  d51a8d2... s3: "count_num_usershares" only looks at the mode
       via  1a38e0f... s3: "info_fn" only looks at the mode and uid
       via  2db0566... s3: "get_share_list" only looks at the mode and uid
       via  0b8810b... s3: "cgi_download" only looks at the mode and size
       via  5bf6187... s3: "print_job_end" only looks at the size
       via  fb87f93... s3: "check_magic" only looks at the size
       via  0c812dc... s3: "disk_quotas" only looks at the devicenumber
       via  f93be99... s3: "load_usershare_shares" only looks at the mode and uid
       via  026befc... s3: "load_usershare_service" only looks at the mode and uid
       via  f1d180d... s3: "usershare_exists" only looks at the mode and mtime
       via  437681d... s3: "process_usershare_file" only looks at the dev, ino, mode and size
       via  c824165... s3: "process_usershare_file" only looks at the mode and size
       via  5bb2825... s3: "parse_usershare_file" only looks at the mode and uid
       via  7c3d16a... s3: "tar_parseargs" only looks at the mtime
       via  34782bb... s3: "dotareof" only looks at the file type
       via  b6e23d5... s3: client "newer" does not look at the create timestamp
       via  572b1f7... s3: Pass the "fake dir create times" parameter to sys_*stat
      from  dc13391... WHATSNEW: Start 3.5.0pre2 release notes.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit bd652cce8f38f33b1f36cec4099c61adf67d7dbf
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 0d03ddd2aba7d65055e07becc4461c7e5ea4babb
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 5bb20f3e6f76614f3fba0eaa757a563e59fa5916
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 f216509a4004cc3d7920e9ef25160222166299a6
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 6d432d4db84427345c03438eb656b3f387288988
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 70b754a838e5ddc025d4e6a65c08cb61596261b8
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 dd82e9d503a1547aaef8ef600cb6224440234c1d
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 581a33494ae98282238d069c2874a0a46c3624be
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 8a79bc673c5ee980a2389f47e32306848989af2a
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 c7f1c6220219fbc66561910ce286eb5dfdb90b06
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 37f1a0933a4a6b1ff3462ea802c49b765f3f6126
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 7e0f61066f44ba9e44720d27f53de57d5265dc45
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 72a7a1dc9c760580cb222692724e949d423cc82e
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 04435d7439270f6abac1803aac066543925b3538
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 4cc0045a4ea748299da892ce21283b9ec864053d
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 50a3344ac87669de665d5ac7a5a9ad63d14f7e38
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 ad2be463bc386128075331b3695655c997e7aea7
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 d51a8d2717c9cd83b530a5d75893bba90c044e84
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 1a38e0fa633e273d17e876926601ce2a3f3f1bb8
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 2db05665032f927698adadedebb21eb83289140d
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 0b8810b80cf9532099851aa0b0989ed107c82454
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 5bf61870ef1c982ba5454ee887646aa3cedb32e2
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 fb87f93adf71a26ff62469c528a8495143a7ab42
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 0c812dcd2da29ebbd876649def1320e959b5f350
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 f93be990f571cfd0a44c0eef88d29138c68d4907
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 026befc823b672d3c94af1354c3d817f6ab0ed74
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 f1d180da90b4d7e5cd068360054a77dfc3836921
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 437681d00fb9f67f3bb5c959b4106af7ba069eeb
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 c8241653f9255372137561e8231384d12eb417f4
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 5bb28252d9bfab6ddc25cf4d97d48398a7e08e8f
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 7c3d16a603163d4231cbff708b4e8088d071b40a
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 34782bbf586c7c554812bcac2573d6db8453b560
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 b6e23d526291ec85d5e6ea9fbaf8b8113148931e
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 572b1f7d7fbfd7719b51033f34f139497cda0f00
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                                 |   32 +++-------------
 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, 136 insertions(+), 111 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 a462470..6d39977 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;
@@ -3436,7 +3436,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)));
@@ -3615,7 +3615,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 a2df1ab..52808f6 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -927,9 +927,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);
@@ -1118,9 +1121,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);
@@ -4194,7 +4197,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 247042d..5fe7bce 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 c024603..9da853f 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)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list