pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


unsupported timestamps
Posted by Anonymous on Wed 10th Apr 2024 00:45
raw | new post
view followups (newest first): unsupported timestamps by Anonymous

  1. diff --git a/daemon/name_cache.c b/daemon/name_cache.c
  2. index 6e9f7bc..39407c4 100644
  3. --- a/daemon/name_cache.c
  4. +++ b/daemon/name_cache.c
  5. @@ -339,14 +339,31 @@ static void copy_attrs(
  6.      OUT nfs41_file_info *dst,
  7.      IN const struct attr_cache_entry *src)
  8.  {
  9. +    dst->attrmask.count = 2;
  10. +    dst->attrmask.arr[0] = FATTR4_WORD0_TYPE | FATTR4_WORD0_CHANGE
  11. +        | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID
  12. +        | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
  13. +    dst->attrmask.arr[1] = FATTR4_WORD1_MODE
  14. +        | FATTR4_WORD1_NUMLINKS
  15. +        | FATTR4_WORD1_SYSTEM;
  16. +
  17.      dst->change = src->change;
  18.      dst->size = src->size;
  19. +    if (!((src->time_access_s == 0) && (src->time_access_ns == 0))) {
  20. +        dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_ACCESS;
  21.          dst->time_access.seconds = src->time_access_s;
  22.          dst->time_access.nseconds = src->time_access_ns;
  23. +    }
  24. +    if (!((src->time_create_s == 0) && (src->time_create_ns == 0))) {
  25. +        dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_CREATE;
  26.          dst->time_create.seconds = src->time_create_s;
  27.          dst->time_create.nseconds = src->time_create_ns;
  28. +    }
  29. +    if (!((src->time_modify_s == 0) && (src->time_modify_ns == 0))) {
  30. +        dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_MODIFY;
  31.          dst->time_modify.seconds = src->time_modify_s;
  32.          dst->time_modify.nseconds = src->time_modify_ns;
  33. +    }
  34.      dst->type = src->type;
  35.      dst->numlinks = src->numlinks;
  36.      dst->mode = src->mode;
  37. @@ -373,14 +390,6 @@ static void copy_attrs(
  38.      dst->system = src->system;
  39.      dst->archive = src->archive;
  40.  
  41. -    dst->attrmask.count = 2;
  42. -    dst->attrmask.arr[0] = FATTR4_WORD0_TYPE | FATTR4_WORD0_CHANGE
  43. -        | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID
  44. -        | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
  45. -    dst->attrmask.arr[1] = FATTR4_WORD1_MODE
  46. -        | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_TIME_ACCESS
  47. -        | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_MODIFY
  48. -        | FATTR4_WORD1_SYSTEM;
  49.      if (dst->owner)
  50.          dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
  51.      if (dst->owner_group)
  52. diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
  53. index 90f0e61..e5b0409 100644
  54. --- a/daemon/nfs41_xdr.c
  55. +++ b/daemon/nfs41_xdr.c
  56. @@ -2344,6 +2344,7 @@ static bool_t decode_readdir_entry(
  57.          xdrmem_create(&fattr_xdr, (char *)attrs.attr_vals, attrs.attr_vals_len, XDR_DECODE);
  58.          if (!(decode_file_attrs(&fattr_xdr, &attrs, &entry->attr_info)))
  59.              entry->attr_info.rdattr_error = NFS4ERR_BADXDR;
  60. +        (void)memcpy(&entry->attr_info.attrmask, &attrs.attrmask, sizeof(bitmap4));
  61.          StringCchCopyA(entry->name, name_len, (STRSAFE_LPCSTR)name);
  62.  
  63.          it->buf_pos += (size_t)entry_len + name_len;
  64. diff --git a/daemon/readdir.c b/daemon/readdir.c
  65. index 07607ef..65ce323 100644
  66. --- a/daemon/readdir.c
  67. +++ b/daemon/readdir.c
  68. @@ -323,15 +323,51 @@ static void readdir_copy_dir_info(
  69.      IN PFILE_DIR_INFO_UNION info)
  70.  {
  71.      info->fdi.FileIndex = (ULONG)entry->attr_info.fileid;
  72. +
  73. +    uint32_t attrmask_arr1 = entry->attr_info.attrmask.arr[1];
  74. +#if 0 /* hack */
  75. +    attrmask_arr1 |= FATTR4_WORD1_TIME_ACCESS
  76. +        | FATTR4_WORD1_TIME_CREATE
  77. +        | FATTR4_WORD1_TIME_MODIFY;
  78. +#endif
  79. +
  80. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_CREATE) {
  81.          nfs_time_to_file_time(&entry->attr_info.time_create,
  82.              &info->fdi.CreationTime);
  83. +    }
  84. +    else {
  85. +        DPRINTF(0, ("readdir_copy_dir_info: time_create not set\n"));
  86. +        info->fdi.CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  87. +    }
  88. +
  89. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_ACCESS) {
  90.          nfs_time_to_file_time(&entry->attr_info.time_access,
  91.              &info->fdi.LastAccessTime);
  92. +    }
  93. +    else {
  94. +        DPRINTF(0, ("readdir_copy_dir_info: time_access not set\n"));
  95. +        info->fdi.LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  96. +    }
  97. +
  98. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_MODIFY) {
  99.          nfs_time_to_file_time(&entry->attr_info.time_modify,
  100.              &info->fdi.LastWriteTime);
  101. +    }
  102. +    else {
  103. +        DPRINTF(0, ("readdir_copy_dir_info: time_modify not set\n"));
  104. +        info->fdi.LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  105. +    }
  106. +
  107.      /* XXX: was using 'change' attr, but that wasn't giving a time */
  108. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_MODIFY) {
  109.          nfs_time_to_file_time(&entry->attr_info.time_modify,
  110.              &info->fdi.ChangeTime);
  111. +    }
  112. +    else {
  113. +        DPRINTF(0, ("readdir_copy_dir_info: time_modify2 not set\n"));
  114. +        info->fdi.ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  115. +    }
  116. +
  117.      info->fdi.EndOfFile.QuadPart =
  118.          info->fdi.AllocationSize.QuadPart =
  119.              entry->attr_info.size;
  120. diff --git a/daemon/util.c b/daemon/util.c
  121. index 382944a..b1a848b 100644
  122. --- a/daemon/util.c
  123. +++ b/daemon/util.c
  124. @@ -167,11 +167,39 @@ void nfs_to_basic_info(
  125.      IN const nfs41_file_info *info,
  126.      OUT PFILE_BASIC_INFO basic_out)
  127.  {
  128. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  129.          nfs_time_to_file_time(&info->time_create, &basic_out->CreationTime);
  130. +    }
  131. +    else {
  132. +        DPRINTF(0, ("nfs_to_basic_info: time_create not set\n"));
  133. +        basic_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  134. +    }
  135. +
  136. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
  137.          nfs_time_to_file_time(&info->time_access, &basic_out->LastAccessTime);
  138. +    }
  139. +    else {
  140. +        DPRINTF(0, ("nfs_to_basic_info: time_access not set\n"));
  141. +        basic_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  142. +    }
  143. +
  144. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  145.          nfs_time_to_file_time(&info->time_modify, &basic_out->LastWriteTime);
  146. +    }
  147. +    else {
  148. +        DPRINTF(0, ("nfs_to_basic_info: time_modify not set\n"));
  149. +        basic_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  150. +    }
  151. +
  152.      /* XXX: was using 'change' attr, but that wasn't giving a time */
  153. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  154.          nfs_time_to_file_time(&info->time_modify, &basic_out->ChangeTime);
  155. +    }
  156. +    else {
  157. +        DPRINTF(0, ("nfs_to_basic_info: time_modify2 not set\n"));
  158. +        basic_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  159. +    }
  160. +
  161.      basic_out->FileAttributes = nfs_file_info_to_attributes(info);
  162.  }
  163.  
  164. @@ -193,12 +221,39 @@ void nfs_to_network_openinfo(
  165.      IN const nfs41_file_info *info,
  166.      OUT PFILE_NETWORK_OPEN_INFORMATION net_out)
  167.  {
  168. -    
  169. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  170.          nfs_time_to_file_time(&info->time_create, &net_out->CreationTime);
  171. +    }
  172. +    else {
  173. +        DPRINTF(0, ("nfs_to_network_openinfo: time_create not set\n"));
  174. +        net_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  175. +    }
  176. +
  177. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
  178.          nfs_time_to_file_time(&info->time_access, &net_out->LastAccessTime);
  179. +    }
  180. +    else {
  181. +        DPRINTF(0, ("nfs_to_network_openinfo: time_access not set\n"));
  182. +        net_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  183. +    }
  184. +
  185. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  186.          nfs_time_to_file_time(&info->time_modify, &net_out->LastWriteTime);
  187. +    }
  188. +    else {
  189. +        DPRINTF(0, ("nfs_to_network_openinfo: time_modify not set\n"));
  190. +        net_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  191. +    }
  192. +
  193.      /* XXX: was using 'change' attr, but that wasn't giving a time */
  194. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  195.          nfs_time_to_file_time(&info->time_modify, &net_out->ChangeTime);
  196. +    }
  197. +    else {
  198. +        DPRINTF(0, ("nfs_to_network_openinfo: time_modify2 not set\n"));
  199. +        net_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  200. +    }
  201. +
  202.      net_out->AllocationSize.QuadPart =
  203.          net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
  204.      net_out->FileAttributes = nfs_file_info_to_attributes(info);
  205. diff --git a/daemon/util.h b/daemon/util.h
  206. index bc12f55..f117894 100644
  207. --- a/daemon/util.h
  208. +++ b/daemon/util.h
  209. @@ -32,6 +32,12 @@ struct __nfs41_session;
  210.  struct __nfs41_write_verf;
  211.  enum stable_how4;
  212.  
  213. +/*
  214. + * LargeInteger.QuadPart value to indicate a time value was not
  215. + * available
  216. + */
  217. +#define FILE_INFO_TIME_NOT_SET (0LL)
  218. +
  219.  int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
  220.  int safe_write(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
  221.  int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name);

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at