pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


unsupported timestamps
Posted by Anonymous on Wed 10th Apr 2024 16:30
raw | new post
modification of post by Anonymous (view diff)

  1. diff --git a/daemon/getattr.c b/daemon/getattr.c
  2. index 6708702..ef4507e 100644
  3. --- a/daemon/getattr.c
  4. +++ b/daemon/getattr.c
  5. @@ -149,7 +149,7 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  6.  
  7.      switch (args->query_class) {
  8.      case FileBasicInformation:
  9. -        nfs_to_basic_info(&info, &args->basic_info);
  10. +        nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
  11.          args->ctime = info.change;
  12.          break;
  13.      case FileStandardInformation:
  14. @@ -164,7 +164,7 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  15.          args->intr_info.IndexNumber.QuadPart = info.fileid;
  16.          break;
  17.      case FileNetworkOpenInformation:
  18. -        nfs_to_network_openinfo(&info, &args->network_info);
  19. +        nfs_to_network_openinfo(state->file.name.name, &info, &args->network_info);
  20.          break;
  21.      default:
  22.          eprintf("unhandled file query class %d\n", args->query_class);
  23. diff --git a/daemon/name_cache.c b/daemon/name_cache.c
  24. index 6e9f7bc..7ac6050 100644
  25. --- a/daemon/name_cache.c
  26. +++ b/daemon/name_cache.c
  27. @@ -339,14 +339,31 @@ static void copy_attrs(
  28.      OUT nfs41_file_info *dst,
  29.      IN const struct attr_cache_entry *src)
  30.  {
  31. +    dst->attrmask.count = 2;
  32. +    dst->attrmask.arr[0] = FATTR4_WORD0_TYPE | FATTR4_WORD0_CHANGE
  33. +        | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID
  34. +        | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
  35. +    dst->attrmask.arr[1] = FATTR4_WORD1_MODE
  36. +        | FATTR4_WORD1_NUMLINKS
  37. +        | FATTR4_WORD1_SYSTEM;
  38. +
  39.      dst->change = src->change;
  40.      dst->size = src->size;
  41. +    if (!((src->time_access_s == 0) && (src->time_access_ns == 0))) {
  42. +        dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_ACCESS;
  43.      dst->time_access.seconds = src->time_access_s;
  44.      dst->time_access.nseconds = src->time_access_ns;
  45. +    }
  46. +    if (!((src->time_create_s == 0) && (src->time_create_ns == 0))) {
  47. +        dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_CREATE;
  48.      dst->time_create.seconds = src->time_create_s;
  49.      dst->time_create.nseconds = src->time_create_ns;
  50. +    }
  51. +    if (!((src->time_modify_s == 0) && (src->time_modify_ns == 0))) {
  52. +        dst->attrmask.arr[1] |= FATTR4_WORD1_TIME_MODIFY;
  53.      dst->time_modify.seconds = src->time_modify_s;
  54.      dst->time_modify.nseconds = src->time_modify_ns;
  55. +    }
  56.      dst->type = src->type;
  57.      dst->numlinks = src->numlinks;
  58.      dst->mode = src->mode;
  59. @@ -373,14 +390,6 @@ static void copy_attrs(
  60.      dst->system = src->system;
  61.      dst->archive = src->archive;
  62.  
  63. -    dst->attrmask.count = 2;
  64. -    dst->attrmask.arr[0] = FATTR4_WORD0_TYPE | FATTR4_WORD0_CHANGE
  65. -        | FATTR4_WORD0_SIZE | FATTR4_WORD0_FILEID
  66. -        | FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
  67. -    dst->attrmask.arr[1] = FATTR4_WORD1_MODE
  68. -        | FATTR4_WORD1_NUMLINKS | FATTR4_WORD1_TIME_ACCESS
  69. -        | FATTR4_WORD1_TIME_CREATE | FATTR4_WORD1_TIME_MODIFY
  70. -        | FATTR4_WORD1_SYSTEM;
  71.      if (dst->owner)
  72.          dst->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
  73.      if (dst->owner_group)
  74. diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
  75. index 74d6e99..4f9bb65 100644
  76. --- a/daemon/nfs41_ops.c
  77. +++ b/daemon/nfs41_ops.c
  78. @@ -514,7 +514,8 @@ int nfs41_open(
  79.  
  80.      compound_add_op(&compound, OP_OPEN, &open_args, &open_res);
  81.      open_args.seqid = 0;
  82. -#ifdef DISABLE_FILE_DELEGATIONS
  83. +//#ifdef DISABLE_FILE_DELEGATIONS
  84. +#if 1
  85.      open_args.share_access = allow | OPEN4_SHARE_ACCESS_WANT_NO_DELEG;
  86.  #else
  87.      open_args.share_access = allow;
  88. diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
  89. index 90f0e61..1b0abf1 100644
  90. --- a/daemon/nfs41_xdr.c
  91. +++ b/daemon/nfs41_xdr.c
  92. @@ -2344,6 +2344,7 @@ static bool_t decode_readdir_entry(
  93.          xdrmem_create(&fattr_xdr, (char *)attrs.attr_vals, attrs.attr_vals_len, XDR_DECODE);
  94.          if (!(decode_file_attrs(&fattr_xdr, &attrs, &entry->attr_info)))
  95.              entry->attr_info.rdattr_error = NFS4ERR_BADXDR;
  96. +        (void)memcpy(&entry->attr_info.attrmask, &attrs.attrmask, sizeof(bitmap4));
  97.          StringCchCopyA(entry->name, name_len, (STRSAFE_LPCSTR)name);
  98.  
  99.          it->buf_pos += (size_t)entry_len + name_len;
  100. diff --git a/daemon/open.c b/daemon/open.c
  101. index 15c9c28..40d9204 100644
  102. --- a/daemon/open.c
  103. +++ b/daemon/open.c
  104. @@ -745,7 +745,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  105.              status = map_symlink_errors(status);
  106.              goto out_free_state;
  107.          }
  108. -        nfs_to_basic_info(&info, &args->basic_info);
  109. +        nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
  110.          nfs_to_standard_info(&info, &args->std_info);
  111.          args->mode = info.mode;
  112.          args->changeattr = info.change;
  113. @@ -756,7 +756,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  114.              goto out_free_state;
  115.          }
  116.  
  117. -        nfs_to_basic_info(&info, &args->basic_info);
  118. +        nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
  119.          nfs_to_standard_info(&info, &args->std_info);
  120.          args->mode = info.mode;
  121.          args->changeattr = info.change;
  122. @@ -941,7 +941,7 @@ supersede_retry:
  123.              status = nfs_to_windows_error(status, ERROR_FILE_NOT_FOUND);
  124.              goto out_free_state;
  125.          } else {
  126. -            nfs_to_basic_info(&info, &args->basic_info);
  127. +            nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
  128.              nfs_to_standard_info(&info, &args->std_info);
  129.              args->mode = info.mode;
  130.              args->changeattr = info.change;
  131. diff --git a/daemon/readdir.c b/daemon/readdir.c
  132. index 07607ef..fd9cce2 100644
  133. --- a/daemon/readdir.c
  134. +++ b/daemon/readdir.c
  135. @@ -323,15 +323,55 @@ static void readdir_copy_dir_info(
  136.      IN PFILE_DIR_INFO_UNION info)
  137.  {
  138.      info->fdi.FileIndex = (ULONG)entry->attr_info.fileid;
  139. +
  140. +    uint32_t attrmask_arr1 = entry->attr_info.attrmask.arr[1];
  141. +#if 0 /* hack */
  142. +    attrmask_arr1 |= FATTR4_WORD1_TIME_ACCESS
  143. +        | FATTR4_WORD1_TIME_CREATE
  144. +        | FATTR4_WORD1_TIME_MODIFY;
  145. +#endif
  146. +
  147. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_CREATE) {
  148.          nfs_time_to_file_time(&entry->attr_info.time_create,
  149.              &info->fdi.CreationTime);
  150. +    }
  151. +    else {
  152. +        DPRINTF(0, ("readdir_copy_dir_info(entry->name='%s'): "
  153. +            "time_create not set\n", entry->name));
  154. +        info->fdi.CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  155. +    }
  156. +
  157. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_ACCESS) {
  158.          nfs_time_to_file_time(&entry->attr_info.time_access,
  159.              &info->fdi.LastAccessTime);
  160. +    }
  161. +    else {
  162. +        DPRINTF(0, ("readdir_copy_dir_info(entry->name='%s'): "
  163. +            "time_access not set\n", entry->name));
  164. +        info->fdi.LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  165. +    }
  166. +
  167. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_MODIFY) {
  168.          nfs_time_to_file_time(&entry->attr_info.time_modify,
  169.              &info->fdi.LastWriteTime);
  170. +    }
  171. +    else {
  172. +        DPRINTF(0, ("readdir_copy_dir_info(entry->name='%s'): "
  173. +            "time_modify not set\n", entry->name));
  174. +        info->fdi.LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  175. +    }
  176. +
  177.      /* XXX: was using 'change' attr, but that wasn't giving a time */
  178. +    if (attrmask_arr1 & FATTR4_WORD1_TIME_MODIFY) {
  179.          nfs_time_to_file_time(&entry->attr_info.time_modify,
  180.              &info->fdi.ChangeTime);
  181. +    }
  182. +    else {
  183. +        DPRINTF(0, ("readdir_copy_dir_info(entry->name='%s'): "
  184. +            "time_modify2 not set\n", entry->name));
  185. +        info->fdi.ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  186. +    }
  187. +
  188.      info->fdi.EndOfFile.QuadPart =
  189.          info->fdi.AllocationSize.QuadPart =
  190.              entry->attr_info.size;
  191. diff --git a/daemon/util.c b/daemon/util.c
  192. index 382944a..1b92c60 100644
  193. --- a/daemon/util.c
  194. +++ b/daemon/util.c
  195. @@ -164,14 +164,47 @@ ULONG nfs_file_info_to_attributes(
  196.  }
  197.  
  198.  void nfs_to_basic_info(
  199. +    IN const char *name,
  200.      IN const nfs41_file_info *info,
  201.      OUT PFILE_BASIC_INFO basic_out)
  202.  {
  203. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  204.          nfs_time_to_file_time(&info->time_create, &basic_out->CreationTime);
  205. +    }
  206. +    else {
  207. +        DPRINTF(0, ("nfs_to_basic_info(name='%s'): "
  208. +            "time_create not set\n", name));
  209. +        basic_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  210. +    }
  211. +
  212. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
  213.          nfs_time_to_file_time(&info->time_access, &basic_out->LastAccessTime);
  214. +    }
  215. +    else {
  216. +        DPRINTF(0, ("nfs_to_basic_info(name='%s'): "
  217. +            "time_access not set\n", name));
  218. +        basic_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  219. +    }
  220. +
  221. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  222.          nfs_time_to_file_time(&info->time_modify, &basic_out->LastWriteTime);
  223. +    }
  224. +    else {
  225. +        DPRINTF(0, ("nfs_to_basic_info(name='%s'): "
  226. +            "time_modify not set\n", name));
  227. +        basic_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  228. +    }
  229. +
  230.      /* XXX: was using 'change' attr, but that wasn't giving a time */
  231. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  232.          nfs_time_to_file_time(&info->time_modify, &basic_out->ChangeTime);
  233. +    }
  234. +    else {
  235. +        DPRINTF(0, ("nfs_to_basic_info(name='%s'): "
  236. +            "time_modify2 not set\n", name));
  237. +        basic_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  238. +    }
  239. +
  240.      basic_out->FileAttributes = nfs_file_info_to_attributes(info);
  241.  }
  242.  
  243. @@ -190,15 +223,43 @@ void nfs_to_standard_info(
  244.  }
  245.  
  246.  void nfs_to_network_openinfo(
  247. +    IN const char *name,
  248.      IN const nfs41_file_info *info,
  249.      OUT PFILE_NETWORK_OPEN_INFORMATION net_out)
  250.  {
  251. -    
  252. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
  253.          nfs_time_to_file_time(&info->time_create, &net_out->CreationTime);
  254. +    }
  255. +    else {
  256. +        DPRINTF(0, ("nfs_to_network_openinfo(name='%s'): time_create not set\n", name));
  257. +        net_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  258. +    }
  259. +
  260. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
  261.          nfs_time_to_file_time(&info->time_access, &net_out->LastAccessTime);
  262. +    }
  263. +    else {
  264. +        DPRINTF(0, ("nfs_to_network_openinfo(name='%s'): time_access not set\n", name));
  265. +        net_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  266. +    }
  267. +
  268. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  269.          nfs_time_to_file_time(&info->time_modify, &net_out->LastWriteTime);
  270. +    }
  271. +    else {
  272. +        DPRINTF(0, ("nfs_to_network_openinfo(name='%s'): time_modify not set\n", name));
  273. +        net_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  274. +    }
  275. +
  276.      /* XXX: was using 'change' attr, but that wasn't giving a time */
  277. +    if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
  278.          nfs_time_to_file_time(&info->time_modify, &net_out->ChangeTime);
  279. +    }
  280. +    else {
  281. +        DPRINTF(0, ("nfs_to_network_openinfo(name='%s'): time_modify2 not set\n", name));
  282. +        net_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
  283. +    }
  284. +
  285.      net_out->AllocationSize.QuadPart =
  286.          net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
  287.      net_out->FileAttributes = nfs_file_info_to_attributes(info);
  288. diff --git a/daemon/util.h b/daemon/util.h
  289. index bc12f55..952cb19 100644
  290. --- a/daemon/util.h
  291. +++ b/daemon/util.h
  292. @@ -32,6 +32,12 @@ struct __nfs41_session;
  293.  struct __nfs41_write_verf;
  294.  enum stable_how4;
  295.  
  296. +/*
  297. + * LargeInteger.QuadPart value to indicate a time value was not
  298. + * available
  299. + */
  300. +#define FILE_INFO_TIME_NOT_SET (0LL)
  301. +
  302.  int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
  303.  int safe_write(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len);
  304.  int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name);
  305. @@ -100,12 +106,14 @@ static __inline void bitmap_intersect(
  306.  ULONG nfs_file_info_to_attributes(
  307.      IN const nfs41_file_info *info);
  308.  void nfs_to_basic_info(
  309. +    IN const char *name,
  310.      IN const nfs41_file_info *info,
  311.      OUT PFILE_BASIC_INFO basic_out);
  312.  void nfs_to_standard_info(
  313.      IN const nfs41_file_info *info,
  314.      OUT PFILE_STANDARD_INFO std_out);
  315.  void nfs_to_network_openinfo(
  316. +    IN const char *name,
  317.      IN const nfs41_file_info *info,
  318.      OUT PFILE_NETWORK_OPEN_INFORMATION std_out);
  319.  void nfs41_file_info_cpy(

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