summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-01-23 14:40:19 -0800
committerTim Prouty <tprouty@samba.org>2009-01-23 21:05:38 -0800
commit48b0016cff4bad621b94fc0bf678ec15260dd7d7 (patch)
tree960f825709d1a8eb2af5fb0afb31553262ee290f /source3/modules
parent7bb3860f49cd8b09c2015f6646c07fe5ebaa0de3 (diff)
downloadsamba-48b0016cff4bad621b94fc0bf678ec15260dd7d7.tar.gz
samba-48b0016cff4bad621b94fc0bf678ec15260dd7d7.tar.bz2
samba-48b0016cff4bad621b94fc0bf678ec15260dd7d7.zip
Extend NTIMES to allow setting create_time
1) Add in smb_file_time struct to clarify code and make room for createtime. 2) Get and set create time from SMB messages. 3) Fixup existing VFS modules + examples Some OS'es allow for the setting of the birthtime through kernel interfaces. This value is generically used for Windows createtime, but is not settable in the code today.
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_cap.c5
-rw-r--r--source3/modules/vfs_catia.c4
-rw-r--r--source3/modules/vfs_default.c15
-rw-r--r--source3/modules/vfs_full_audit.c6
-rw-r--r--source3/modules/vfs_recycle.c10
-rw-r--r--source3/modules/vfs_shadow_copy2.c4
6 files changed, 24 insertions, 20 deletions
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 6950ab2168..ac85d3a804 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -208,7 +208,8 @@ static int cap_chdir(vfs_handle_struct *handle, const char *path)
return SMB_VFS_NEXT_CHDIR(handle, cappath);
}
-static int cap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2])
+static int cap_ntimes(vfs_handle_struct *handle, const char *path,
+ struct smb_file_time *ft)
{
char *cappath = capencode(talloc_tos(), path);
@@ -216,7 +217,7 @@ static int cap_ntimes(vfs_handle_struct *handle, const char *path, const struct
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_NTIMES(handle, cappath, ts);
+ return SMB_VFS_NEXT_NTIMES(handle, cappath, ft);
}
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 47d178a33f..d0c341fdd3 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -252,9 +252,9 @@ static char *catia_getwd(vfs_handle_struct *handle, char *buf)
}
static int catia_ntimes(vfs_handle_struct *handle,
- const char *path, const struct timespec ts[2])
+ const char *path, struct smb_file_time *ft)
{
- return SMB_VFS_NEXT_NTIMES(handle, path, ts);
+ return SMB_VFS_NEXT_NTIMES(handle, path, ft);
}
static bool catia_symlink(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 61e1deb81e..a9aabab768 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -682,25 +682,26 @@ static char *vfswrap_getwd(vfs_handle_struct *handle, char *path)
system will support.
**********************************************************************/
-static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2])
+static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path,
+ struct smb_file_time *ft)
{
int result;
START_PROFILE(syscall_ntimes);
#if defined(HAVE_UTIMES)
- if (ts != NULL) {
+ if (ft != NULL) {
struct timeval tv[2];
- tv[0] = convert_timespec_to_timeval(ts[0]);
- tv[1] = convert_timespec_to_timeval(ts[1]);
+ tv[0] = convert_timespec_to_timeval(ft->atime);
+ tv[1] = convert_timespec_to_timeval(ft->mtime);
result = utimes(path, tv);
} else {
result = utimes(path, NULL);
}
#elif defined(HAVE_UTIME)
- if (ts != NULL) {
+ if (ft != NULL) {
struct utimbuf times;
- times.actime = convert_timespec_to_time_t(ts[0]);
- times.modtime = convert_timespec_to_time_t(ts[1]);
+ times.actime = convert_timespec_to_time_t(ft->atime);
+ times.modtime = convert_timespec_to_time_t(ft->mtime);
result = utime(path, times);
} else {
result = utime(path, NULL);
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 1d9983a753..73758a2d9d 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -172,7 +172,7 @@ static int smb_full_audit_chdir(vfs_handle_struct *handle,
static char *smb_full_audit_getwd(vfs_handle_struct *handle,
char *path);
static int smb_full_audit_ntimes(vfs_handle_struct *handle,
- const char *path, const struct timespec ts[2]);
+ const char *path, struct smb_file_time *ft);
static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
SMB_OFF_T len);
static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
@@ -1426,11 +1426,11 @@ static char *smb_full_audit_getwd(vfs_handle_struct *handle,
}
static int smb_full_audit_ntimes(vfs_handle_struct *handle,
- const char *path, const struct timespec ts[2])
+ const char *path, struct smb_file_time *ft)
{
int result;
- result = SMB_VFS_NEXT_NTIMES(handle, path, ts);
+ result = SMB_VFS_NEXT_NTIMES(handle, path, ft);
do_log(SMB_VFS_OP_NTIMES, (result >= 0), handle, "%s", path);
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index cb985e1be2..2b0edcdb4a 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -391,19 +391,21 @@ static void recycle_do_touch(vfs_handle_struct *handle, const char *fname,
bool touch_mtime)
{
SMB_STRUCT_STAT st;
- struct timespec ts[2];
+ struct smb_file_time ft;
int ret, err;
+ ZERO_STRUCT(ft);
+
if (SMB_VFS_NEXT_STAT(handle, fname, &st) != 0) {
DEBUG(0,("recycle: stat for %s returned %s\n",
fname, strerror(errno)));
return;
}
- ts[0] = timespec_current(); /* atime */
- ts[1] = touch_mtime ? ts[0] : get_mtimespec(&st); /* mtime */
+ ft.atime = timespec_current(); /* atime */
+ ft.mtime = touch_mtime ? ft.atime : get_mtimespec(&st); /* mtime */
become_root();
- ret = SMB_VFS_NEXT_NTIMES(handle, fname, ts);
+ ret = SMB_VFS_NEXT_NTIMES(handle, fname, &ft);
err = errno;
unbecome_root();
if (ret == -1 ) {
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index c95600b642..56dd6ea8d8 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -393,9 +393,9 @@ static int shadow_copy2_chdir(vfs_handle_struct *handle,
}
static int shadow_copy2_ntimes(vfs_handle_struct *handle,
- const char *fname, const struct timespec ts[2])
+ const char *fname, struct smb_file_time *ft)
{
- SHADOW2_NEXT(NTIMES, (handle, name, ts), int, -1);
+ SHADOW2_NEXT(NTIMES, (handle, name, ft), int, -1);
}
static int shadow_copy2_readlink(vfs_handle_struct *handle,