From: Jeremy Allison Date: Wed, 12 Aug 2009 20:00:54 +0000 (-0700) Subject: Add "store create time" parameter (docs to follow) X-Git-Tag: tevent-0.9.8~410 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=d6270df748dcfd8d5a02c328518c2332da8fbed5 Add "store create time" parameter (docs to follow) that stores the create time in the user.DosTimestamps EA. Jeremy. --- diff --git a/source3/include/proto.h b/source3/include/proto.h index 8b3e029d3f5..963e6df0c80 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4187,6 +4187,7 @@ bool lp_administrative_share(int ); bool lp_print_ok(int ); bool lp_map_hidden(int ); bool lp_map_archive(int ); +bool lp_store_create_time(int ); bool lp_store_dos_attributes(int ); bool lp_dmapi_support(int ); bool lp_locking(const struct share_params *p ); @@ -6266,10 +6267,17 @@ bool set_sticky_write_time_fsp(struct files_struct *fsp, struct timespec mtime); bool update_write_time(struct files_struct *fsp); -struct timespec get_create_timespec(struct files_struct *fsp, +NTSTATUS set_create_timespec_ea(connection_struct *conn, + struct files_struct *fsp, + const struct smb_filename *smb_fname, + struct timespec create_time); + +struct timespec get_create_timespec(connection_struct *conn, + struct files_struct *fsp, const struct smb_filename *smb_fname); -struct timespec get_change_timespec(struct files_struct *fsp, +struct timespec get_change_timespec(connection_struct *conn, + struct files_struct *fsp, const struct smb_filename *smb_fname); /* The following definitions come from smbd/error.c */ diff --git a/source3/include/smb.h b/source3/include/smb.h index fb01a921130..28bd60a670f 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1859,6 +1859,8 @@ struct ea_list { #define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" /* Prefix for DosStreams in the vfs_streams_xattr module */ #define SAMBA_XATTR_DOSSTREAM_PREFIX "user.DosStream." +/* Prefix for DOS timestamps. */ +#define SAMBA_XATTR_DOSTIMESTAMPS "user.DosTimestamps" #define UUID_SIZE 16 diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 2ee2fd12499..a793b337a84 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -817,6 +817,15 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, errno = ENOSYS; result = -1; #endif + + if (!null_timespec(ft->create_time) && + lp_store_create_time(SNUM(handle->conn))) { + set_create_timespec_ea(handle->conn, + NULL, + smb_fname, + ft->create_time); + } + out: END_PROFILE(syscall_ntimes); return result; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index dbbd6e327da..35984716a26 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -446,6 +446,7 @@ struct service { bool bMap_system; bool bMap_hidden; bool bMap_archive; + bool bStoreCreateTime; bool bStoreDosAttributes; bool bDmapiSupport; bool bLocking; @@ -589,6 +590,7 @@ static struct service sDefault = { False, /* bMap_system */ False, /* bMap_hidden */ True, /* bMap_archive */ + False, /* bStoreCreateTime */ False, /* bStoreDosAttributes */ False, /* bDmapiSupport */ True, /* bLocking */ @@ -3065,6 +3067,15 @@ static struct parm_struct parm_table[] = { .enum_list = NULL, .flags = FLAG_ADVANCED, }, + { + .label = "store create time", + .type = P_BOOL, + .p_class = P_LOCAL, + .ptr = &sDefault.bStoreCreateTime, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL, + }, { .label = "store dos attributes", .type = P_BOOL, @@ -5564,6 +5575,7 @@ FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share) FN_LOCAL_BOOL(lp_print_ok, bPrint_ok) FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden) FN_LOCAL_BOOL(lp_map_archive, bMap_archive) +FN_LOCAL_BOOL(lp_store_create_time, bStoreCreateTime) FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes) FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport) FN_LOCAL_PARM_BOOL(lp_locking, bLocking) diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index e3871132d2d..3fcfa4d60db 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -243,6 +243,7 @@ cat >$SERVERCONFFILE<