- diff --git a/daemon/getattr.c b/daemon/getattr.c
- index 6708702..ef4507e 100644
- --- a/daemon/getattr.c
- +++ b/daemon/getattr.c
- @@ -149,7 +149,7 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- switch (args->query_class) {
- case FileBasicInformation:
- - nfs_to_basic_info(&info, &args->basic_info);
- + nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
- args->ctime = info.change;
- break;
- case FileStandardInformation:
- @@ -164,7 +164,7 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- args->intr_info.IndexNumber.QuadPart = info.fileid;
- break;
- case FileNetworkOpenInformation:
- - nfs_to_network_openinfo(&info, &args->network_info);
- + nfs_to_network_openinfo(state->file.name.name, &info, &args->network_info);
- break;
- default:
- eprintf("unhandled file query class %d\n", args->query_class);
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index 6e9f7bc..7ac6050 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_ops.c b/daemon/nfs41_ops.c
- index 74d6e99..4f9bb65 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -514,7 +514,8 @@ int nfs41_open(
- compound_add_op(&compound, OP_OPEN, &open_args, &open_res);
- open_args.seqid = 0;
- -#ifdef DISABLE_FILE_DELEGATIONS
- +//#ifdef DISABLE_FILE_DELEGATIONS
- +#if 1
- open_args.share_access = allow | OPEN4_SHARE_ACCESS_WANT_NO_DELEG;
- #else
- open_args.share_access = allow;
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 90f0e61..1b0abf1 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/open.c b/daemon/open.c
- index 15c9c28..40d9204 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -745,7 +745,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- status = map_symlink_errors(status);
- goto out_free_state;
- }
- - nfs_to_basic_info(&info, &args->basic_info);
- + nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
- nfs_to_standard_info(&info, &args->std_info);
- args->mode = info.mode;
- args->changeattr = info.change;
- @@ -756,7 +756,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- goto out_free_state;
- }
- - nfs_to_basic_info(&info, &args->basic_info);
- + nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
- nfs_to_standard_info(&info, &args->std_info);
- args->mode = info.mode;
- args->changeattr = info.change;
- @@ -941,7 +941,7 @@ supersede_retry:
- status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
- goto out_free_state;
- } else {
- - nfs_to_basic_info(&info, &args->basic_info);
- + nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
- nfs_to_standard_info(&info, &args->std_info);
- args->mode = info.mode;
- args->changeattr = info.change;
- diff --git a/daemon/readdir.c b/daemon/readdir.c
- index 07607ef..fd9cce2 100644
- --- a/daemon/readdir.c
- +++ b/daemon/readdir.c
- @@ -323,15 +323,55 @@ 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(entry->name='%s'): "
- + "time_create not set\n", entry->name));
- + 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(entry->name='%s'): "
- + "time_access not set\n", entry->name));
- + 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(entry->name='%s'): "
- + "time_modify not set\n", entry->name));
- + 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(entry->name='%s'): "
- + "time_modify2 not set\n", entry->name));
- + 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..1b92c60 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -164,14 +164,47 @@ ULONG nfs_file_info_to_attributes(
- }
- void nfs_to_basic_info(
- + IN const char *name,
- 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(name='%s'): "
- + "time_create not set\n", name));
- + 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(name='%s'): "
- + "time_access not set\n", name));
- + 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(name='%s'): "
- + "time_modify not set\n", name));
- + 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(name='%s'): "
- + "time_modify2 not set\n", name));
- + basic_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- basic_out->FileAttributes = nfs_file_info_to_attributes(info);
- }
- @@ -190,15 +223,43 @@ void nfs_to_standard_info(
- }
- void nfs_to_network_openinfo(
- + IN const char *name,
- 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(name='%s'): time_create not set\n", name));
- + 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(name='%s'): time_access not set\n", name));
- + 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(name='%s'): time_modify not set\n", name));
- + 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(name='%s'): time_modify2 not set\n", name));
- + 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..952cb19 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);
- @@ -100,12 +106,14 @@ static __inline void bitmap_intersect(
- ULONG nfs_file_info_to_attributes(
- IN const nfs41_file_info *info);
- void nfs_to_basic_info(
- + IN const char *name,
- IN const nfs41_file_info *info,
- OUT PFILE_BASIC_INFO basic_out);
- void nfs_to_standard_info(
- IN const nfs41_file_info *info,
- OUT PFILE_STANDARD_INFO std_out);
- void nfs_to_network_openinfo(
- + IN const char *name,
- IN const nfs41_file_info *info,
- OUT PFILE_NETWORK_OPEN_INFORMATION std_out);
- void nfs41_file_info_cpy(
unsupported timestamps
Posted by Anonymous on Wed 10th Apr 2024 16:30
raw | new post
modification of post by Anonymous (view diff)
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.