The Samba-Bugzilla – Attachment 876 Details for
Bug 2205
[patch] Support setting file creation time in VFS layer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
clean patch against 3.0.10
samba_file_create_time.patch.clean (text/plain), 13.58 KB, created by
yuval yeret
on 2005-01-03 02:02:17 UTC
(
hide
)
Description:
clean patch against 3.0.10
Filename:
MIME Type:
Creator:
yuval yeret
Created:
2005-01-03 02:02:17 UTC
Size:
13.58 KB
patch
obsolete
>Only in samba-3.0.10-crtime: samba-3.0.10-bug2205.vpj >Only in samba-3.0.10-crtime: samba-3.0.10-bug2205.vpw >Only in samba-3.0.10-crtime: samba-3.0.10-bug2205.vpwhistu >Only in samba-3.0.10-crtime: samba-3.0.10-bug2205.vtg >Only in samba-3.0.10/source: config.log >Only in samba-3.0.10/source: config.status >Only in samba-3.0.10/source/include: config.h >Only in samba-3.0.10/source/include: stamp-h >diff -u -p -r samba-3.0.10/source/include/vfs.h samba-3.0.10-crtime/source/include/vfs.h >--- samba-3.0.10/source/include/vfs.h 2005-01-03 09:48:07.000000000 +0200 >+++ samba-3.0.10-crtime/source/include/vfs.h 2005-01-03 10:51:17.000000000 +0200 >@@ -236,7 +236,7 @@ struct vfs_ops { > 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); >diff -u -p -r samba-3.0.10/source/include/vfs_macros.h samba-3.0.10-crtime/source/include/vfs_macros.h >--- samba-3.0.10/source/include/vfs_macros.h 2005-01-03 09:48:08.000000000 +0200 >+++ samba-3.0.10-crtime/source/include/vfs_macros.h 2005-01-03 10:51:17.000000000 +0200 >@@ -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))) >@@ -161,7 +161,7 @@ > #define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid))) > #define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (conn), (path))) > #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (conn), (buf))) >-#define SMB_VFS_OPAQUE_UTIME(conn, path, times) ((conn)->vfs_opaque.ops.utime((conn)->vfs_opaque.handles.utime, (conn), (path), (times))) >+#define SMB_VFS_OPAQUE_UTIME(conn, path, times, cr_time) ((conn)->vfs_opaque.ops.utime((conn)->vfs_opaque.handles.utime, (conn), (path), (times), (cr_time))) > #define SMB_VFS_OPAQUE_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (fd), (offset))) > #define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) > #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.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, cr_time) ((handle)->vfs_next.ops.utime((handle)->vfs_next.handles.utime, (conn), (path), (times), (cr_time))) > #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))) >Only in samba-3.0.10/source/locking: locking.c.orig >Only in samba-3.0.10/source: Makefile >diff -u -p -r samba-3.0.10/source/modules/vfs_cap.c samba-3.0.10-crtime/source/modules/vfs_cap.c >--- samba-3.0.10/source/modules/vfs_cap.c 2005-01-03 09:48:01.000000000 +0200 >+++ samba-3.0.10-crtime/source/modules/vfs_cap.c 2005-01-03 10:51:17.000000000 +0200 >@@ -131,11 +131,11 @@ static int cap_chdir(vfs_handle_struct * > return SMB_VFS_NEXT_CHDIR(handle, conn, cappath); > } > >-static int cap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times) >+static int cap_utime(vfs_handle_struct *handle, connection_struct *conn, const char *path, struct utimbuf *times, time_t *cr_time) > { > pstring cappath; > capencode(cappath, path); >- return SMB_VFS_NEXT_UTIME(handle, conn, cappath, times); >+ return SMB_VFS_NEXT_UTIME(handle, conn, cappath, times, cr_time); > } > > >diff -u -p -r samba-3.0.10/source/modules/vfs_full_audit.c samba-3.0.10-crtime/source/modules/vfs_full_audit.c >--- samba-3.0.10/source/modules/vfs_full_audit.c 2005-01-03 09:48:01.000000000 +0200 >+++ samba-3.0.10-crtime/source/modules/vfs_full_audit.c 2005-01-03 10:51:17.000000000 +0200 >@@ -134,7 +134,7 @@ static int smb_full_audit_chdir(vfs_hand > static char *smb_full_audit_getwd(vfs_handle_struct *handle, connection_struct *conn, > char *path); > static int smb_full_audit_utime(vfs_handle_struct *handle, connection_struct *conn, >- const char *path, struct utimbuf *times); >+ const char *path, struct utimbuf *times, time_t *cr_time); > static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp, > int fd, SMB_OFF_T len); > static BOOL smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, >@@ -1089,11 +1089,11 @@ static char *smb_full_audit_getwd(vfs_ha > } > > static int smb_full_audit_utime(vfs_handle_struct *handle, connection_struct *conn, >- const char *path, struct utimbuf *times) >+ const char *path, struct utimbuf *times, time_t *cr_time) > { > int result; > >- result = SMB_VFS_NEXT_UTIME(handle, conn, path, times); >+ result = SMB_VFS_NEXT_UTIME(handle, conn, path, times, cr_time); > > do_log(SMB_VFS_OP_UTIME, (result >= 0), handle, "%s", path); > >diff -u -p -r samba-3.0.10/source/modules/vfs_recycle.c samba-3.0.10-crtime/source/modules/vfs_recycle.c >--- samba-3.0.10/source/modules/vfs_recycle.c 2005-01-03 09:48:01.000000000 +0200 >+++ samba-3.0.10-crtime/source/modules/vfs_recycle.c 2005-01-03 10:51:17.000000000 +0200 >@@ -312,7 +312,7 @@ static void recycle_do_touch(vfs_handle_ > tb.actime = currtime; > tb.modtime = st.st_mtime; > >- if (SMB_VFS_NEXT_UTIME(handle, handle->conn, fname, &tb) == -1 ) { >+ if (SMB_VFS_NEXT_UTIME(handle, handle->conn, fname, &tb, NULL) == -1 ) { > DEBUG(0, ("recycle: touching %s failed, reason = %s\n", fname, strerror(errno))); > } > } >Only in samba-3.0.10/source/script: findsmb >diff -u -p -r samba-3.0.10/source/smbd/dosmode.c samba-3.0.10-crtime/source/smbd/dosmode.c >--- samba-3.0.10/source/smbd/dosmode.c 2005-01-03 09:47:58.000000000 +0200 >+++ samba-3.0.10-crtime/source/smbd/dosmode.c 2005-01-03 10:51:17.000000000 +0200 >@@ -431,7 +431,8 @@ int file_set_dosmode(connection_struct * > 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; >@@ -439,7 +440,9 @@ int file_utime(connection_struct *conn, > > errno = 0; > >- if(SMB_VFS_UTIME(conn,fname, times) == 0) >+ DEBUG(0,("file_utime. creation_time %s " , ctime(cr_time))); >+ >+ if(SMB_VFS_UTIME(conn,fname, times,cr_time) == 0) > return 0; > > if((errno != EPERM) && (errno != EACCES)) >@@ -466,7 +469,7 @@ int file_utime(connection_struct *conn, > 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(); > } > } >@@ -487,7 +490,7 @@ BOOL set_filetime(connection_struct *con > > 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; > } >diff -u -p -r samba-3.0.10/source/smbd/reply.c samba-3.0.10-crtime/source/smbd/reply.c >--- samba-3.0.10/source/smbd/reply.c 2005-01-03 09:47:58.000000000 +0200 >+++ samba-3.0.10-crtime/source/smbd/reply.c 2005-01-03 10:51:17.000000000 +0200 >@@ -4811,7 +4811,7 @@ int reply_setattrE(connection_struct *co > } > > /* 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); > } >diff -u -p -r samba-3.0.10/source/smbd/trans2.c samba-3.0.10-crtime/source/smbd/trans2.c >--- samba-3.0.10/source/smbd/trans2.c 2005-01-03 09:47:57.000000000 +0200 >+++ samba-3.0.10-crtime/source/smbd/trans2.c 2005-01-03 10:51:17.000000000 +0200 >@@ -3001,6 +3001,7 @@ static int call_trans2setfilepathinfo(co > 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); >@@ -3170,11 +3171,15 @@ static int call_trans2setfilepathinfo(co > 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. >+ * Dikla >+ */ >+ 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); > >@@ -3618,6 +3623,7 @@ size = %.0f, uid = %u, gid = %u, raw per > 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)); >@@ -3648,8 +3654,10 @@ size = %.0f, uid = %u, gid = %u, raw per > * 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 >@@ -3657,8 +3665,11 @@ size = %.0f, uid = %u, gid = %u, raw per > * 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; > } >@@ -3667,7 +3678,7 @@ size = %.0f, uid = %u, gid = %u, raw per > > 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)); > } > } >diff -u -p -r samba-3.0.10/source/smbd/vfs-wrap.c samba-3.0.10-crtime/source/smbd/vfs-wrap.c >--- samba-3.0.10/source/smbd/vfs-wrap.c 2005-01-03 09:47:57.000000000 +0200 >+++ samba-3.0.10-crtime/source/smbd/vfs-wrap.c 2005-01-03 10:51:17.000000000 +0200 >@@ -584,7 +584,7 @@ char *vfswrap_getwd(vfs_handle_struct *h > 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; > >Only in samba-3.0.10-crtime/source/utils: ntlm_auth_proto.h
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 2205
:
874
|
875
| 876