--------------------- Add cr_time parameter to SMB_VFS_UTIME - can also be null. Members: include/vfs.h:1.4->1.5 include/vfs_macros.h:1.2->1.3 Index: third_party/samba/samba/source/include/vfs.h diff -u third_party/samba/samba/source/include/vfs.h:1.4 third_party/samba/samba/source/include/vfs.h:1.5 --- third_party/samba/samba/source/include/vfs.h:1.4 Mon May 10 09:43:24 2004 +++ third_party/samba/samba/source/include/vfs.h Mon Oct 18 16:14:01 2004 @@ -236,7 +236,7 @@ int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid); int (*chdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); char *(*getwd)(struct vfs_handle_struct *handle, struct connection_struct *conn, char *buf); - int (*utime)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct utimbuf *times); + int (*utime)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, struct utimbuf *times,time_t *cr_time); int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset); BOOL (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int (*symlink)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *oldpath, const char *newpath); Index: third_party/samba/samba/source/include/vfs_macros.h diff -u third_party/samba/samba/source/include/vfs_macros.h:1.2 third_party/samba/samba/source/include/vfs_macros.h:1.3 --- third_party/samba/samba/source/include/vfs_macros.h:1.2 Tue Feb 3 14:21:02 2004 +++ third_party/samba/samba/source/include/vfs_macros.h Mon Oct 18 16:14:01 2004 @@ -63,7 +63,7 @@ #define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid))) #define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (conn), (path))) #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (conn), (buf))) -#define SMB_VFS_UTIME(conn, path, times) ((conn)->vfs.ops.utime((conn)->vfs.handles.utime, (conn), (path), (times))) +#define SMB_VFS_UTIME(conn, path, times,cr_time) ((conn)->vfs.ops.utime((conn)->vfs.handles.utime, (conn), (path), (times), (cr_time))) #define SMB_VFS_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (fd), (offset))) #define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) #define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (conn), (oldpath), (newpath))) @@ -259,7 +259,7 @@ #define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid))) #define SMB_VFS_NEXT_CHDIR(handle, conn, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (conn), (path))) #define SMB_VFS_NEXT_GETWD(handle, conn, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (conn), (buf))) -#define SMB_VFS_NEXT_UTIME(handle, conn, path, times) ((handle)->vfs_next.ops.utime((handle)->vfs_next.handles.utime, (conn), (path), (times))) +#define SMB_VFS_NEXT_UTIME(handle, conn, path, times) ((handle)->vfs_next.ops.utime((handle)->vfs_next.handles.utime, (conn), (path), (times),NULL)) #define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (fd), (offset))) #define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) #define SMB_VFS_NEXT_SYMLINK(handle, conn, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (conn), (oldpath), (newpath))) --------------------- Add cr_time to file_utime Members: smbd/dosmode.c:1.5->1.6 Index: third_party/samba/samba/source/smbd/dosmode.c diff -u third_party/samba/samba/source/smbd/dosmode.c:1.5 third_party/samba/samba/source/smbd/dosmode.c:1.6 --- third_party/samba/samba/source/smbd/dosmode.c:1.5 Tue Sep 14 17:01:35 2004 +++ third_party/samba/samba/source/smbd/dosmode.c Mon Oct 18 16:16:17 2004 @@ -445,7 +445,8 @@ than POSIX. *******************************************************************/ -int file_utime(connection_struct *conn, char *fname, struct utimbuf *times) +int file_utime(connection_struct *conn, char *fname, struct utimbuf *times, + time_t *cr_time) { extern struct current_user current_user; SMB_STRUCT_STAT sb; @@ -453,7 +454,9 @@ errno = 0; - if(SMB_VFS_UTIME(conn,fname, times) == 0) + if(SMB_VFS_UTIME(conn,fname, times,cr_time) == 0) return 0; if((errno != EPERM) && (errno != EACCES)) @@ -480,7 +483,7 @@ current_user.ngroups,current_user.groups)))) { /* We are allowed to become root and change the filetime. */ become_root(); - ret = SMB_VFS_UTIME(conn,fname, times); + ret = SMB_VFS_UTIME(conn,fname, times,cr_time); unbecome_root(); } } @@ -501,7 +504,7 @@ times.modtime = times.actime = mtime; - if (file_utime(conn, fname, ×)) { + if (file_utime(conn, fname, ×,NULL)) { DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno))); return False; } --------------------- PatchSet 64 Date: 2004/10/18 14:18:11 Author: dikla Branch: HEAD Tag: (none) Log: Read cr_time from the smb bufffer in trans2 command. Send it to smb_vfs_utime Members: smbd/trans2.c:1.2->1.3 Index: third_party/samba/samba/source/smbd/trans2.c diff -u third_party/samba/samba/source/smbd/trans2.c:1.2 third_party/samba/samba/source/smbd/trans2.c:1.3 --- third_party/samba/samba/source/smbd/trans2.c:1.2 Tue Sep 14 17:01:36 2004 +++ third_party/samba/samba/source/smbd/trans2.c Mon Oct 18 16:18:11 2004 @@ -2977,6 +2977,7 @@ gid_t set_grp = (uid_t)SMB_GID_NO_CHANGE; mode_t unixmode = 0; NTSTATUS status = NT_STATUS_OK; + time_t cr_time = (time_t)0; if (!params) return ERROR_NT(NT_STATUS_INVALID_PARAMETER); @@ -3146,11 +3147,15 @@ if (total_data < 36) return(ERROR_DOS(ERRDOS,ERRinvalidparam)); - /* Ignore create time at offset pdata. */ + /* Add support in creation time of a file. + * rertieve creation_date from the transaction and send it + * to the vfs layer. + */ + cr_time = interpret_long_date(pdata); /* access time */ tvs.actime = interpret_long_date(pdata+8); - write_time = interpret_long_date(pdata+16); changed_time = interpret_long_date(pdata+24); @@ -3594,6 +3599,7 @@ if (tvs.modtime == (time_t)0 || tvs.modtime == (time_t)-1) tvs.modtime = sbuf.st_mtime; + DEBUG(6,("creation time : %s " , ctime(&cr_time))); DEBUG(6,("actime: %s " , ctime(&tvs.actime))); DEBUG(6,("modtime: %s ", ctime(&tvs.modtime))); DEBUG(6,("size: %.0f ", (double)size)); @@ -3624,8 +3630,10 @@ * Try and set the times, size and mode of this file - * if they are different from the current values */ - if (sbuf.st_mtime != tvs.modtime || sbuf.st_atime != tvs.actime) { + if (sbuf.st_mtime != tvs.modtime || sbuf.st_atime != tvs.actime || + cr_time != (time_t)0) { if(fsp != NULL) { + /* * This was a setfileinfo on an open file. * NT does this a lot. It's actually pointless @@ -3633,8 +3641,11 @@ * on the next write, so we save the request * away and will set it on file close. JRA. */ - - if (tvs.modtime != (time_t)0 && tvs.modtime != (time_t)-1) { + if (cr_time != (time_t)0) { + if(file_utime(conn, fname, &tvs,&cr_time)!=0) + return(UNIXERROR(ERRDOS,ERRnoaccess)); + + } else if (tvs.modtime != (time_t)0 && tvs.modtime != (time_t)-1) { DEBUG(10,("call_trans2setfilepathinfo: setting pending modtime to %s\n", ctime(&tvs.modtime) )); fsp->pending_modtime = tvs.modtime; } @@ -3643,7 +3654,7 @@ DEBUG(10,("call_trans2setfilepathinfo: setting utimes to modified values.\n")); - if(file_utime(conn, fname, &tvs)!=0) + if(file_utime(conn, fname, &tvs,&cr_time)!=0) return(UNIXERROR(ERRDOS,ERRnoaccess)); } } --------------------- PatchSet 65 Date: 2004/10/19 07:50:31 Author: dikla Branch: HEAD Tag: RELEASE-3_0_7d1-9_rb Log: add null parameter for file_utime Members: smbd/reply.c:1.2->1.3 Index: third_party/samba/samba/source/smbd/reply.c diff -u third_party/samba/samba/source/smbd/reply.c:1.2 third_party/samba/samba/source/smbd/reply.c:1.3 --- third_party/samba/samba/source/smbd/reply.c:1.2 Tue Sep 14 17:01:36 2004 +++ third_party/samba/samba/source/smbd/reply.c Tue Oct 19 09:50:31 2004 @@ -4812,7 +4812,7 @@ } /* Set the date on this file */ - if(file_utime(conn, fsp->fsp_name, &unix_times)) { + if(file_utime(conn, fsp->fsp_name, &unix_times,NULL)) { END_PROFILE(SMBsetattrE); return ERROR_DOS(ERRDOS,ERRnoaccess); } ---------------- Default handling for setting creation time is not to do anything since normal unix FSs don't have creation time. Obviously VFSs to other advanced FSs can do smarter stuff with it. Index: smbd/vfs-wrap.c =================================================================== RCS file: /disksites/repository/third_party/samba/samba/source/smbd/vfs-wrap.c,v retrieving revision 1.4 diff -u -r1.4 vfs-wrap.c --- smbd/vfs-wrap.c 4 May 2004 12:37:54 -0000 1.4 +++ smbd/vfs-wrap.c 2 Jan 2005 08:00:26 -0000 @@ -583,7 +583,7 @@ return result; } -int vfswrap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) +int vfswrap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times, time_t *cr_time) { int result;