summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-27 12:42:39 +0100
committerVolker Lendecke <vl@samba.org>2009-11-29 11:22:01 +0100
commit44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67 (patch)
treebd10abc110d1f33352b102f0d3c0df83c1a88774 /source3
parentb973c5083699ad2b22c72fafe5c4b77f1f4eeccb (diff)
downloadsamba-44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67.tar.gz
samba-44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67.tar.bz2
samba-44ce5603ddbb1b9d75bfff58e40e7f1ea2821c67.zip
s3: Pass the "fake dir create times" parameter to sys_*stat
Step 0 to restore it as a per-share paramter
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c2
-rw-r--r--source3/client/clitar.c5
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/lib/debug.c4
-rw-r--r--source3/lib/sysquotas.c7
-rw-r--r--source3/lib/system.c24
-rw-r--r--source3/lib/util.c8
-rw-r--r--source3/modules/vfs_default.c12
-rw-r--r--source3/modules/vfs_netatalk.c4
-rw-r--r--source3/param/loadparm.c15
-rw-r--r--source3/passdb/pdb_smbpasswd.c6
-rw-r--r--source3/printing/printing.c3
-rw-r--r--source3/registry/regfio.c6
-rw-r--r--source3/smbd/close.c2
-rw-r--r--source3/smbd/quotas.c32
-rw-r--r--source3/utils/net_conf.c2
-rw-r--r--source3/utils/net_usershare.c15
-rw-r--r--source3/web/cgi.c3
18 files changed, 94 insertions, 65 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index ca2f9a8842..187fd88743 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -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, lp_fake_dir_create_times()) == 0)) {
newer_than = convert_timespec_to_time_t(sbuf.st_ex_mtime);
DEBUG(1,("Getting files newer than %s",
time_to_asc(newer_than)));
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index d973329427..cf5eb6782a 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, lp_fake_dir_create_times()) == -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,
+ lp_fake_dir_create_times()) == 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 9e0f3a28df..55da2cf8db 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);
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index e851fd20e9..1986d6cfca 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -746,7 +746,9 @@ 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,
+ lp_fake_dir_create_times()) == 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 7eed0cadf9..d9bdbf402a 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, lp_fake_dir_create_times()) == -1 )
return (-1);
devno = S.st_ex_dev ;
@@ -71,7 +71,8 @@ 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, lp_fake_dir_create_times())
+ == -1 )
continue ;
if (S.st_ex_dev == devno) {
@@ -114,7 +115,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, lp_fake_dir_create_times()))!=0) {
return ret;
}
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 8abcb3dc66..86802d0c8d 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 e0b09c4f1f..0351587131 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -533,7 +533,7 @@ bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
if (!sbuf)
sbuf = &st;
- if (sys_stat(fname,sbuf) != 0)
+ if (sys_stat(fname, sbuf, lp_fake_dir_create_times()) != 0)
return(False);
return((S_ISREG(sbuf->st_ex_mode)) || (S_ISFIFO(sbuf->st_ex_mode)));
@@ -546,7 +546,7 @@ 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, lp_fake_dir_create_times()) != 0)
return(False);
return S_ISSOCK(st.st_ex_mode);
@@ -564,7 +564,7 @@ bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st)
if (!st)
st = &st2;
- if (sys_stat(dname,st) != 0)
+ if (sys_stat(dname, st, lp_fake_dir_create_times()) != 0)
return(False);
ret = S_ISDIR(st->st_ex_mode);
@@ -590,7 +590,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, lp_fake_dir_create_times()) != 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 258caf8299..318e03ecff 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -487,7 +487,8 @@ 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,
+ lp_fake_dir_create_times()) == -1)
return -1;
if (!S_ISREG (source_stats.st_ex_mode))
@@ -615,7 +616,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());
out:
END_PROFILE(syscall_stat);
return result;
@@ -626,7 +628,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());
END_PROFILE(syscall_fstat);
return result;
}
@@ -643,7 +646,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());
out:
END_PROFILE(syscall_lstat);
return result;
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index fa9e774c1a..2bcd42af4c 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -80,7 +80,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, lp_fake_dir_create_times());
if (S_ISDIR(orig_info->st_ex_mode)) {
*adbl_path = talloc_asprintf(ctx, "%s/%s/%s/",
@@ -95,7 +95,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, lp_fake_dir_create_times());
return 0;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 83c6ef59da..f43a11b2de 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -8550,7 +8550,8 @@ enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
/* Ensure the owner of the usershare file has permission to share
this directory. */
- if (sys_stat(sharepath, &sbuf) == -1) {
+ if (sys_stat(sharepath, &sbuf,
+ lp_fake_dir_create_times()) == -1) {
DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
servicename, sharepath, strerror(errno) ));
sys_closedir(dp);
@@ -8622,7 +8623,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
/* Minimize the race condition by doing an lstat before we
open and fstat. Ensure this isn't a symlink link. */
- if (sys_lstat(fname, &lsbuf) != 0) {
+ if (sys_lstat(fname, &lsbuf, lp_fake_dir_create_times()) != 0) {
DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
fname, strerror(errno) ));
SAFE_FREE(fname);
@@ -8675,7 +8676,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
}
/* Now fstat to be *SURE* it's a regular file. */
- if (sys_fstat(fd, &sbuf) != 0) {
+ if (sys_fstat(fd, &sbuf, lp_fake_dir_create_times()) != 0) {
close(fd);
DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
fname, strerror(errno) ));
@@ -8793,7 +8794,7 @@ static bool usershare_exists(int iService, struct timespec *last_mod)
return false;
}
- if (sys_lstat(fname, &lsbuf) != 0) {
+ if (sys_lstat(fname, &lsbuf, lp_fake_dir_create_times()) != 0) {
SAFE_FREE(fname);
return false;
}
@@ -8823,7 +8824,8 @@ int load_usershare_service(const char *servicename)
return -1;
}
- if (sys_stat(usersharepath, &sbuf) != 0) {
+ if (sys_stat(usersharepath, &sbuf, lp_fake_dir_create_times())
+ != 0) {
DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
usersharepath, strerror(errno) ));
return -1;
@@ -8900,7 +8902,8 @@ int load_usershare_shares(void)
return lp_numservices();
}
- if (sys_stat(usersharepath, &sbuf) != 0) {
+ if (sys_stat(usersharepath, &sbuf, lp_fake_dir_create_times())
+ != 0) {
DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
usersharepath, strerror(errno) ));
return ret;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index cac95c40a9..1595d65c2e 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -276,7 +276,8 @@ Error was %s\n", pfile, strerror(errno) ));
* prevent infinate loops. JRA.
*/
- if (sys_stat(pfile,&sbuf1) != 0) {
+ if (sys_stat(pfile, &sbuf1,
+ lp_fake_dir_create_times()) != 0) {
DEBUG(0, ("startsmbfilepwent_internal: unable to stat file %s. \
Error was %s\n", pfile, strerror(errno)));
pw_file_unlock(fileno(fp), lock_depth);
@@ -284,7 +285,8 @@ Error was %s\n", pfile, strerror(errno)));
return NULL;
}
- if (sys_fstat(fileno(fp),&sbuf2) != 0) {
+ if (sys_fstat(fileno(fp), &sbuf2,
+ lp_fake_dir_create_times()) != 0) {
DEBUG(0, ("startsmbfilepwent_internal: unable to fstat file %s. \
Error was %s\n", pfile, strerror(errno)));
pw_file_unlock(fileno(fp), lock_depth);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 986176d6d1..2ef395e4a5 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -2582,7 +2582,8 @@ bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type)
return False;
if ((close_type == NORMAL_CLOSE || close_type == SHUTDOWN_CLOSE) &&
- (sys_fstat(pjob->fd, &sbuf) == 0)) {
+ (sys_fstat(pjob->fd, &sbuf, lp_fake_dir_create_times())
+ == 0)) {
pjob->size = sbuf.st_ex_size;
close(pjob->fd);
pjob->fd = -1;
diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c
index 38411d8556..42c2475a2b 100644
--- a/source3/registry/regfio.c
+++ b/source3/registry/regfio.c
@@ -45,7 +45,7 @@ static int write_block( REGF_FILE *file, prs_struct *ps, uint32 offset )
/* check for end of file */
- if ( sys_fstat( file->fd, &sbuf ) ) {
+ if (sys_fstat(file->fd, &sbuf, lp_fake_dir_create_times())) {
DEBUG(0,("write_block: stat() failed! (%s)\n", strerror(errno)));
return -1;
}
@@ -79,7 +79,7 @@ static int read_block( REGF_FILE *file, prs_struct *ps, uint32 file_offset, uint
/* check for end of file */
- if ( sys_fstat( file->fd, &sbuf ) ) {
+ if (sys_fstat(file->fd, &sbuf, lp_fake_dir_create_times())) {
DEBUG(0,("read_block: stat() failed! (%s)\n", strerror(errno)));
return -1;
}
@@ -1429,7 +1429,7 @@ static REGF_HBIN* regf_hbin_allocate( REGF_FILE *file, uint32 block_size )
memcpy( hbin->header, "hbin", sizeof(HBIN_HDR_SIZE) );
- if ( sys_fstat( file->fd, &sbuf ) ) {
+ if (sys_fstat(file->fd, &sbuf, lp_fake_dir_create_times())) {
DEBUG(0,("regf_hbin_allocate: stat() failed! (%s)\n", strerror(errno)));
return NULL;
}
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index a8e3793ea0..816c5d98bd 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -103,7 +103,7 @@ static NTSTATUS check_magic(struct files_struct *fsp)
goto out;
}
- if (sys_fstat(tmp_fd,&st) == -1) {
+ if (sys_fstat(tmp_fd, &st, lp_fake_dir_create_times()) == -1) {
int err = errno;
close(tmp_fd);
close(outfd);
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index 43b700935e..a424602d5f 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -224,7 +224,7 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
/* find the block device file */
- if ( sys_stat(path, &S) == -1 )
+ if ( sys_stat(path, &S, lp_fake_dir_create_times()) == -1 )
return(False) ;
devno = S.st_ex_dev ;
@@ -235,7 +235,8 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
found = False ;
while ((mnt = getmntent(fp))) {
- if ( sys_stat(mnt->mnt_dir,&S) == -1 )
+ if ( sys_stat(mnt->mnt_dir, &S, lp_fake_dir_create_times())
+ == -1 )
continue ;
if (S.st_ex_dev == devno) {
@@ -317,7 +318,7 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
int quota_default = 0 ;
bool found = false;
- if (sys_stat(path,&sbuf) == -1) {
+ if (sys_stat(path, &sbuf, lp_fake_dir_create_times()) == -1) {
return false;
}
@@ -328,7 +329,8 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
}
while ((mnt = getmntent(fd)) != NULL) {
- if (sys_stat(mnt->mnt_dir,&sbuf) == -1) {
+ if (sys_stat(mnt->mnt_dir, &sbuf, lp_fake_dir_create_times())
+ == -1) {
continue;
}
if (sbuf.st_ex_dev == devno) {
@@ -599,7 +601,7 @@ bool disk_quotas(const char *path,
euser_id = geteuid();
- if (sys_stat(path,&sbuf) == -1) {
+ if (sys_stat(path, &sbuf, lp_fake_dir_create_times()) == -1) {
return false;
}
@@ -612,7 +614,8 @@ bool disk_quotas(const char *path,
}
while (getmntent(fd, &mnt) == 0) {
- if (sys_stat(mnt.mnt_mountp, &sbuf) == -1) {
+ if (sys_stat(mnt.mnt_mountp, &sbuf,
+ lp_fake_dir_create_times()) == -1) {
continue;
}
@@ -639,7 +642,8 @@ bool disk_quotas(const char *path,
}
while ((mnt = getmntent(fd)) != NULL) {
- if (sys_stat(mnt->mnt_dir,&sbuf) == -1) {
+ if (sys_stat(mnt->mnt_dir, &sbuf,
+ lp_fake_dir_create_times()) == -1) {
continue;
}
DEBUG(5,("disk_quotas: testing \"%s\" devno=%x\n",
@@ -832,7 +836,7 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
/* find the block device file */
- if ( sys_stat(path, &S) == -1 ) {
+ if ( sys_stat(path, &S, lp_fake_dir_create_times()) == -1 ) {
return(False) ;
}
@@ -842,7 +846,7 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
found = False ;
while ((mnt = getmntent(fp))) {
- if ( sys_stat(mnt->mnt_dir,&S) == -1 )
+ if ( sys_stat(mnt->mnt_dir, &S, lp_fake_dir_create_times()) == -1 )
continue ;
if (S.st_ex_dev == devno) {
found = True ;
@@ -1154,9 +1158,11 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
* to have a significant performance boost when
* lstat calls on /dev access this function.
*/
- if ((sys_stat(path, &S)<0) || (devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 1)<0))
+ if ((sys_stat(path, &S, lp_fake_dir_create_times())<0)
+ || (devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 1)<0))
#else
- if ((sys_stat(path, &S)<0) || (devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 0)<0))
+ if ((sys_stat(path, &S, lp_fake_dir_create_times())<0)
+ || (devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 0)<0))
return (False);
#endif /* ifdef HPUX */
@@ -1183,7 +1189,7 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
SMB_STRUCT_STAT st;
int mntsize, i;
- if (sys_stat(path,&st) < 0)
+ if (sys_stat(path, &st, lp_fake_dir_create_times()) < 0)
return False;
devno = st.st_ex_dev;
@@ -1192,7 +1198,7 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *d
return False;
for (i = 0; i < mntsize; i++) {
- if (sys_stat(mnts[i].f_mntonname,&st) < 0)
+ if (sys_stat(mnts[i].f_mntonname, &st, lp_fake_dir_create_times()) < 0)
return False;
if (st.st_ex_dev == devno)
break;
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 4b511f2faa..736871f215 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -654,7 +654,7 @@ static int net_conf_addshare(struct net_context *c,
goto done;
}
- if (sys_stat(path, &sbuf) != 0) {
+ if (sys_stat(path, &sbuf, lp_fake_dir_create_times()) != 0) {
d_fprintf(stderr,
_("ERROR: cannot stat path '%s' to ensure "
"this is a directory.\n"
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index edcb7df5cb..9e2bf29409 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -248,7 +248,8 @@ static int get_share_list(TALLOC_CTX *ctx, const char *wcard, bool only_ours)
return -1;
}
- if (sys_lstat(path, &sbuf) != 0) {
+ if (sys_lstat(path, &sbuf, lp_fake_dir_create_times())
+ != 0) {
d_fprintf(stderr,
_("get_share_list: can't lstat file %s. Error "
"was %s\n"),
@@ -365,7 +366,7 @@ static int info_fn(struct file_list *fl, void *priv)
}
/* Paranoia... */
- if (sys_fstat(fd, &sbuf) != 0) {
+ if (sys_fstat(fd, &sbuf, lp_fake_dir_create_times()) != 0) {
d_fprintf(stderr,
_("info_fn: can't fstat file %s. Error was %s\n"),
basepath, strerror(errno) );
@@ -585,7 +586,8 @@ static int count_num_usershares(void)
return -1;
}
- if (sys_lstat(path, &sbuf) != 0) {
+ if (sys_lstat(path, &sbuf, lp_fake_dir_create_times())
+ != 0) {
d_fprintf(stderr,
_("count_num_usershares: can't lstat file %s. "
"Error was %s\n"),
@@ -749,7 +751,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
}
/* Check the directory to be shared exists. */
- if (sys_stat(us_path, &sbuf) != 0) {
+ if (sys_stat(us_path, &sbuf, lp_fake_dir_create_times()) != 0) {
d_fprintf(stderr,
_("net usershare add: cannot stat path %s to ensure "
"this is a directory. Error was %s\n"),
@@ -892,7 +894,8 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
}
/* Ensure we opened the file we thought we did. */
- if (sys_lstat(full_path_tmp, &lsbuf) != 0) {
+ if (sys_lstat(full_path_tmp, &lsbuf, lp_fake_dir_create_times())
+ != 0) {
d_fprintf(stderr,
_("net usershare add: cannot lstat tmp file %s\n"),
full_path_tmp );
@@ -901,7 +904,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
}
/* Check this is the same as the file we opened. */
- if (sys_fstat(tmpfd, &sbuf) != 0) {
+ if (sys_fstat(tmpfd, &sbuf, lp_fake_dir_create_times()) != 0) {
d_fprintf(stderr,
_("net usershare add: cannot fstat tmp file %s\n"),
full_path_tmp );
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index a31943fa8d..d81970746e 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -442,8 +442,7 @@ static void cgi_download(char *file)
}
}
- if (sys_stat(file, &st) != 0)
- {
+ if (sys_stat(file, &st, lp_fake_dir_create_times()) != 0) {
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
}