summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-09-09 14:39:17 -0700
committerKarolin Seeger <kseeger@samba.org>2009-10-20 15:00:16 +0200
commit418ebb48e1f995db8ad38c9bea0f9b06289f5a6b (patch)
tree1c0644f8cc6be8da186b8e9aaaaf0831ad6dd710 /source3/modules
parent83a18d1b332a0ceede93acb6ac091090af2bae92 (diff)
downloadsamba-418ebb48e1f995db8ad38c9bea0f9b06289f5a6b.tar.gz
Fix bug 6529 - Offline files conflict with Vista and Office 2003. Jeremy.
(cherry picked from commit e971428f137dcb42e8b735386d79f1b3a6effe34)
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_default.c51
-rw-r--r--source3/modules/vfs_onefs.c4
2 files changed, 53 insertions, 2 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index aa207056b3b..0a66531efe1 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -92,13 +92,62 @@ static int vfswrap_statvfs(struct vfs_handle_struct *handle, const char *path,
static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle)
{
+ connection_struct *conn = handle->conn;
+ uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+ SMB_STRUCT_STAT st;
+ NTSTATUS status;
+ struct timespec mtime_ts, ctime_ts, atime_ts;
+ int ret = -1;
+
#if defined(DARWINOS)
struct vfs_statvfs_struct statbuf;
ZERO_STRUCT(statbuf);
sys_statvfs(handle->conn->connectpath, &statbuf);
return statbuf.FsCapabilities;
#endif
- return FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+
+ conn->ts_res = TIMESTAMP_SET_SECONDS;
+
+ /* Work out what timestamp resolution we can
+ * use when setting a timestamp. */
+
+ ret = SMB_VFS_STAT(conn, conn->connectpath, &st);
+ if (ret == -1) {
+ return caps;
+ }
+
+ mtime_ts = get_mtimespec(&st);
+ ctime_ts = get_ctimespec(&st);
+ atime_ts = get_atimespec(&st);
+
+ if (mtime_ts.tv_nsec ||
+ atime_ts.tv_nsec ||
+ ctime_ts.tv_nsec) {
+ /* If any of the normal UNIX directory timestamps
+ * have a non-zero tv_nsec component assume
+ * we might be able to set sub-second timestamps.
+ * See what filetime set primitives we have.
+ */
+#if defined(HAVE_UTIMES)
+ /* utimes allows msec timestamps to be set. */
+ conn->ts_res = TIMESTAMP_SET_MSEC;
+#elif defined(HAVE_UTIME)
+ /* utime only allows sec timestamps to be set. */
+ conn->ts_res = TIMESTAMP_SET_SECONDS;
+#endif
+
+ /* TODO. Add a configure test for the Linux
+ * nsec timestamp set system call, and use it
+ * if available....
+ */
+ DEBUG(10,("vfswrap_fs_capabilities: timestamp "
+ "resolution of %s "
+ "available on share %s, directory %s\n",
+ conn->ts_res == TIMESTAMP_SET_MSEC ? "msec" : "sec",
+ lp_servicename(conn->cnum),
+ conn->connectpath ));
+ }
+ return caps;
}
/* Directory operations */
diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c
index e4a0febbeca..10c636d14ba 100644
--- a/source3/modules/vfs_onefs.c
+++ b/source3/modules/vfs_onefs.c
@@ -241,7 +241,9 @@ static uint32_t onefs_fs_capabilities(struct vfs_handle_struct *handle)
result |= FILE_NAMED_STREAMS;
}
- return result | SMB_VFS_NEXT_FS_CAPABILITIES(handle);
+ result |= SMB_VFS_NEXT_FS_CAPABILITIES(handle);
+ conn->ts_res = TIMESTAMP_SET_MSEC;
+ return result;
}
static vfs_op_tuple onefs_ops[] = {