s3: Pass the "fake dir create times" parameter to sys_*stat
authorVolker Lendecke <vl@samba.org>
Fri, 27 Nov 2009 11:42:39 +0000 (12:42 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 29 Nov 2009 10:22:01 +0000 (11:22 +0100)
Step 0 to restore it as a per-share paramter

18 files changed:
source3/client/client.c
source3/client/clitar.c
source3/include/proto.h
source3/lib/debug.c
source3/lib/sysquotas.c
source3/lib/system.c
source3/lib/util.c
source3/modules/vfs_default.c
source3/modules/vfs_netatalk.c
source3/param/loadparm.c
source3/passdb/pdb_smbpasswd.c
source3/printing/printing.c
source3/registry/regfio.c
source3/smbd/close.c
source3/smbd/quotas.c
source3/utils/net_conf.c
source3/utils/net_usershare.c
source3/web/cgi.c

index ca2f9a88421903f2f0bd2d6d0c9110ec1600982c..187fd88743566ec88a34dcb2bbcada203b687499 100644 (file)
@@ -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)));
index d9733294274e70fec692d2e98c4fa9eb5545a1a4..cf5eb6782a63d4795112189cce9abd782ee993b6 100644 (file)
@@ -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",
index 9e0f3a28df4e5214e51fa7c943364fabbd5fe34c..55da2cf8dbc54c7f85e4687ce846904b408048cd 100644 (file)
@@ -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);
index e851fd20e9aaa51eb0eaafedad36a4557c1ab732..1986d6cfca3eea502861fcc8adc159a37b89ba95 100644 (file)
@@ -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;
index 7eed0cadf9b762fdc6b1c771fde130e7a5566555..d9bdbf402a65448cb860f96e37224acd06dcdc07 100644 (file)
@@ -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;
        }
        
index 8abcb3dc666d0c6cceb89741e6c33842940c9c4b..86802d0c8dcd5cdd7e5836a4e3dca6e9723adc8d 100644 (file)
@@ -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;
 }
index e0b09c4f1fa91396ab8e4fa2e505cba007482598..0351587131a5ae776d08dcb34a68416848839aaf 100644 (file)
@@ -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);
 }
index 258caf82994905d536cb4a4e1bc6c06b1df8adf5..318e03ecff9d7d859e8ba69761ecf69cdb202ebe 100644 (file)
@@ -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;
index fa9e774c1a718a7517633a4b6d9532c2a71cb922..2bcd42af4cad0ed6d73320366b213751f5ecb508 100644 (file)
@@ -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;
 }
 
index 83c6ef59da541a7dd52c26c6df52bf6931225311..f43a11b2de78f04cfd184351b967b4fd7d794631 100644 (file)
@@ -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;
index cac95c40a91e40bc80fd8e0f571bd4a1fdea6f51..1595d65c2eca91f02b4157b4842c526b04e99a1e 100644 (file)
@@ -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);
index 986176d6d145905c493d4ff8f9cfc40521730e9a..2ef395e4a5d1c8b285998d18f380fe2134c1a719 100644 (file)
@@ -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;
index 38411d8556b5e27a8d192a4f33875ab6a7138ca5..42c2475a2b915cf4af927b5bb2e1973437db4ab7 100644 (file)
@@ -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;
        }
index a8e3793ea076daeabfd1c341f940da9695952822..816c5d98bd6d5a77c33af448ddb99f6caef5e07c 100644 (file)
@@ -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);
index 43b700935e1f86961935914a24218b5810488699..a424602d5fe519d44e5e5c908d1a2ab0af4f5f90 100644 (file)
@@ -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;
index 4b511f2faa0c3a7cd14aec28177d2ae640532ecb..736871f215b7d848fc2622fa80374a30c7e061fc 100644 (file)
@@ -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"
index edcb7df5cbd27245bf02a2800522a97a07a182d7..9e2bf2940987efe2f69c2be4f07ebb4450805483 100644 (file)
@@ -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 );
index a31943fa8d26daa6e9e20ab35d5cd8abfa7f63d4..d81970746e2efb400b71b54b6c66df83738ef60c 100644 (file)
@@ -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");
        }