- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index 6e9f7bc..39407c4 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -339,14 +339,31 @@ static void copy_attrs(
- OUT nfs41_file_info *dst,
- IN const struct attr_cache_entry *src)
- {
- + dst->attrmask.count = 2;
- + dst->attrmask.arr[0] = FATTR4_WORD0_TYPE | FATTR4_WORD0_CHANGE
- + | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID
- + | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
- + dst->attrmask.arr[1] = FATTR4_WORD1_MODE
- + | FATTR4_WORD1_NUMLINKS
- + | FATTR4_WORD1_SYSTEM;
- +
- dst->change = src->change;
- dst->size = src->size;
- + if (!((src->time_access_s == 0) && (src->time_access_ns == 0))) {
- + dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_ACCESS;
- dst->time_access.seconds = src->time_access_s;
- dst->time_access.nseconds = src->time_access_ns;
- + }
- + if (!((src->time_create_s == 0) && (src->time_create_ns == 0))) {
- + dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_CREATE;
- dst->time_create.seconds = src->time_create_s;
- dst->time_create.nseconds = src->time_create_ns;
- + }
- + if (!((src->time_modify_s == 0) && (src->time_modify_ns == 0))) {
- + dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_MODIFY;
- dst->time_modify.seconds = src->time_modify_s;
- dst->time_modify.nseconds = src->time_modify_ns;
- + }
- dst->type = src->type;
- dst->numlinks = src->numlinks;
- dst->mode = src->mode;
- @@ -373,14 +390,6 @@ static void copy_attrs(
- dst->system = src->system;
- dst->archive = src->archive;
- - dst->attrmask.count = 2;
- - dst->attrmask.arr[0] = FATTR4_WORD0_TYPE | FATTR4_WORD0_CHANGE
- - | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID
- - | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
- - dst->attrmask.arr[1] = FATTR4_WORD1_MODE
- - | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_TIME_ACCESS
- - | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_MODIFY
- - | FATTR4_WORD1_SYSTEM;
- if (dst->owner)
- dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
- if (dst->owner_group)
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 90f0e61..e5b0409 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -2344,6 +2344,7 @@ static bool_t decode_readdir_entry(
- xdrmem_create(&fattr_xdr, (char *)attrs.attr_vals, attrs.attr_vals_len, XDR_DECODE);
- if (!(decode_file_attrs(&fattr_xdr, &attrs, &entry->attr_info)))
- entry->attr_info.rdattr_error = NFS4ERR_BADXDR;
- + (void)memcpy(&entry->attr_info.attrmask, &attrs.attrmask, sizeof(bitmap4));
- StringCchCopyA(entry->name, name_len, (STRSAFE_LPCSTR)name);
- it->buf_pos += (size_t)entry_len + name_len;
- diff --git a/daemon/readdir.c b/daemon/readdir.c
- index 07607ef..65ce323 100644
- --- a/daemon/readdir.c
- +++ b/daemon/readdir.c
- @@ -323,15 +323,51 @@ static void readdir_copy_dir_info(
- IN PFILE_DIR_INFO_UNION info)
- {
- info->fdi.FileIndex = (ULONG)entry->attr_info.fileid;
- +
- + uint32_t attrmask_arr1 = entry->attr_info.attrmask.arr[1];
- +#if 0 /* hack */
- + attrmask_arr1 |= FATTR4_WORD1_TIME_ACCESS
- + | FATTR4_WORD1_TIME_CREATE
- + | FATTR4_WORD1_TIME_MODIFY;
- +#endif
- +
- + if (attrmask_arr1 & FATTR4_WORD1_TIME_CREATE) {
- nfs_time_to_file_time(&entry->attr_info.time_create,
- &info->fdi.CreationTime);
- + }
- + else {
- + DPRINTF(0, ("readdir_copy_dir_info: time_create not set\n"));
- + info->fdi.CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (attrmask_arr1 & FATTR4_WORD1_TIME_ACCESS) {
- nfs_time_to_file_time(&entry->attr_info.time_access,
- &info->fdi.LastAccessTime);
- + }
- + else {
- + DPRINTF(0, ("readdir_copy_dir_info: time_access not set\n"));
- + info->fdi.LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (attrmask_arr1 & FATTR4_WORD1_TIME_MODIFY) {
- nfs_time_to_file_time(&entry->attr_info.time_modify,
- &info->fdi.LastWriteTime);
- + }
- + else {
- + DPRINTF(0, ("readdir_copy_dir_info: time_modify not set\n"));
- + info->fdi.LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (attrmask_arr1 & FATTR4_WORD1_TIME_MODIFY) {
- nfs_time_to_file_time(&entry->attr_info.time_modify,
- &info->fdi.ChangeTime);
- + }
- + else {
- + DPRINTF(0, ("readdir_copy_dir_info: time_modify2 not set\n"));
- + info->fdi.ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- info->fdi.EndOfFile.QuadPart =
- info->fdi.AllocationSize.QuadPart =
- entry->attr_info.size;
- diff --git a/daemon/util.c b/daemon/util.c
- index 382944a..b1a848b 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -167,11 +167,39 @@ void nfs_to_basic_info(
- IN const nfs41_file_info *info,
- OUT PFILE_BASIC_INFO basic_out)
- {
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- nfs_time_to_file_time(&info->time_create, &basic_out->CreationTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_basic_info: time_create not set\n"));
- + basic_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- nfs_time_to_file_time(&info->time_access, &basic_out->LastAccessTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_basic_info: time_access not set\n"));
- + basic_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- nfs_time_to_file_time(&info->time_modify, &basic_out->LastWriteTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_basic_info: time_modify not set\n"));
- + basic_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- nfs_time_to_file_time(&info->time_modify, &basic_out->ChangeTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_basic_info: time_modify2 not set\n"));
- + basic_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- basic_out->FileAttributes = nfs_file_info_to_attributes(info);
- }
- @@ -193,12 +221,39 @@ void nfs_to_network_openinfo(
- IN const nfs41_file_info *info,
- OUT PFILE_NETWORK_OPEN_INFORMATION net_out)
- {
- -
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- nfs_time_to_file_time(&info->time_create, &net_out->CreationTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_network_openinfo: time_create not set\n"));
- + net_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- nfs_time_to_file_time(&info->time_access, &net_out->LastAccessTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_network_openinfo: time_access not set\n"));
- + net_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- nfs_time_to_file_time(&info->time_modify, &net_out->LastWriteTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_network_openinfo: time_modify not set\n"));
- + net_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- nfs_time_to_file_time(&info->time_modify, &net_out->ChangeTime);
- + }
- + else {
- + DPRINTF(0, ("nfs_to_network_openinfo: time_modify2 not set\n"));
- + net_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- net_out->AllocationSize.QuadPart =
- net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- net_out->FileAttributes = nfs_file_info_to_attributes(info);
- diff --git a/daemon/util.h b/daemon/util.h
- index bc12f55..f117894 100644
- --- a/daemon/util.h
- +++ b/daemon/util.h
- @@ -32,6 +32,12 @@ struct __nfs41_session;
- struct __nfs41_write_verf;
- enum stable_how4;
- +/*
- + * LargeInteger.QuadPart value to indicate a time value was not
- + * available
- + */
- +#define FILE_INFO_TIME_NOT_SET (0LL)
- +
- int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
- int safe_write(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
- int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name);
unsupported timestamps
Posted by Anonymous on Wed 10th Apr 2024 00:45
raw | new post
view followups (newest first): unsupported timestamps by Anonymous
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.