pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


ACL support in name cache
Posted by Anonymous on Wed 25th Jun 2025 18:30
raw | new post
modification of post by Anonymous (view diff)

  1. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  2. index 4a391dd..8c7bfa4 100755
  3. --- a/cygwin/devel/msnfs41client.bash
  4. +++ b/cygwin/devel/msnfs41client.bash
  5. @@ -467,7 +467,7 @@ function nfsclient_rundeamon
  6.                         "${nfsd_args[@]}"
  7.                 )
  8.                 "${nfsd_args[@]}"
  9. -       elif false ; then
  10. +       elif true ; then
  11.                 export _NT_ALT_SYMBOL_PATH="$(cygpath -w "$PWD");srv*https://msdl.microsoft.com/download/symbols"
  12.                 #
  13.                 # Useful cdb cmds:
  14. @@ -601,7 +601,7 @@ function nfsclient_system_rundeamon
  15.                 )
  16.  
  17.                 "${nfsd_args[@]}"
  18. -       elif false ; then
  19. +       elif true ; then
  20.                 export _NT_ALT_SYMBOL_PATH="$(cygpath -w "$PWD");srv*https://msdl.microsoft.com/download/symbols"
  21.                 # - heap tests (eats lots of memory):
  22.                 # '-c' '!gflag +full;g' for heap tests
  23. diff --git a/daemon/acl.c b/daemon/acl.c
  24. index 370f2d3..c655b3f 100644
  25. --- a/daemon/acl.c
  26. +++ b/daemon/acl.c
  27. @@ -326,62 +326,49 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  28.      PSID osid = NULL, gsid = NULL;
  29.      DWORD sid_len;
  30.      char owner[NFS4_FATTR4_OWNER_LIMIT+1], group[NFS4_FATTR4_OWNER_LIMIT+1];
  31. +    bitmap4 owner_group_acl_bitmap = {
  32. +        .count = 2,
  33. +        .arr[0] = 0,
  34. +        .arr[1] = FATTR4_WORD1_OWNER|FATTR4_WORD1_OWNER_GROUP
  35. +    };
  36.      nfsacl41 acl = { 0 };
  37.  
  38.      DPRINTF(ACLLVL1, ("--> handle_getacl(state->path.path='%s')\n",
  39.          state->path.path));
  40.  
  41.      if (args->query & DACL_SECURITY_INFORMATION) {
  42. -use_nfs41_getattr:
  43. -        bitmap4 attr_request = { 0 };
  44. -        (void)memset(&info, 0, sizeof(nfs41_file_info));
  45. -        info.owner = owner;
  46. -        info.owner_group = group;
  47. -
  48. -        attr_request.count = 2;
  49. -        attr_request.arr[0] = FATTR4_WORD0_ACL;
  50. -        attr_request.arr[1] = FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
  51. -        info.acl = &acl;
  52. -        status = nfs41_getattr(state->session, &state->file, &attr_request, &info);
  53. -        if (status) {
  54. -            eprintf("handle_getacl: nfs41_getattr() failed with %d\n",
  55. -                status);
  56. -            goto out;
  57. -        }
  58. +        owner_group_acl_bitmap.arr[0] |= FATTR4_WORD0_ACL;
  59.      }
  60. -    else {
  61. -        (void)memset(&info, 0, sizeof(nfs41_file_info));
  62. -        info.owner = owner;
  63. -        info.owner_group = group;
  64.  
  65. -        status = nfs41_cached_getattr(state->session, &state->file, &info);
  66. -        if (status) {
  67. -            eprintf("handle_getacl: nfs41_cached_getattr() failed with %d\n",
  68. -                status);
  69. -            goto out;
  70. -        }
  71. +    (void)memset(&info, 0, sizeof(nfs41_file_info));
  72. +    info.owner = owner;
  73. +    info.owner_group = group;
  74. +    info.acl = &acl;
  75.  
  76. -        EASSERT(info.attrmask.count > 1);
  77. -
  78. -        /*
  79. -         * In rare cases owner/owner_group are not in the cache
  80. -         * (usually for new files). In this case do a full
  81. -         * roundtrip to the NFS server to get the data...
  82. -         */
  83. -        if ((bitmap_isset(&info.attrmask, 1,
  84. -                FATTR4_WORD1_OWNER) == false) ||
  85. -            (bitmap_isset(&info.attrmask, 1,
  86. -                FATTR4_WORD1_OWNER_GROUP) == false)) {
  87. -            DPRINTF(ACLLVL2, ("handle_getattr: owner/owner_group not in cache, doing full lookup...\n"));
  88. -            goto use_nfs41_getattr;
  89. -        }
  90. +    /*
  91. +     * |nfs41_cached_getattr()| will first try to get all information from
  92. +     * the cache. But if bits are missing (e.g. |FATTR4_WORD0_ACL|, because
  93. +     * either not cached in the name cache, or name cache entry for ACLs
  94. +     * expired...), then this will do a server roundtrip to get the missing
  95. +     * data
  96. +     */
  97. +    status = nfs41_cached_getattr(state->session,
  98. +        &state->file, &owner_group_acl_bitmap, &info);
  99. +    if (status) {
  100. +        eprintf("handle_getacl: nfs41_cached_getattr() failed with %d\n",
  101. +            status);
  102. +        goto out;
  103.      }
  104.  
  105.      EASSERT(info.attrmask.count > 1);
  106. -    EASSERT(bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_OWNER) &&
  107. -        bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_OWNER_GROUP));
  108.      if (args->query & DACL_SECURITY_INFORMATION) {
  109. -        EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_ACL));
  110. +        EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_ACL) == true);
  111. +    }
  112. +    if (args->query & OWNER_SECURITY_INFORMATION) {
  113. +        EASSERT(bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_OWNER) == true);
  114. +    }
  115. +    if (args->query & GROUP_SECURITY_INFORMATION) {
  116. +        EASSERT(bitmap_isset(&info.attrmask, 1, FATTR4_WORD1_OWNER_GROUP) == true);
  117.      }
  118.  
  119.      status = InitializeSecurityDescriptor(&sec_desc,
  120. @@ -433,6 +420,7 @@ use_nfs41_getattr:
  121.              goto out;
  122.          }
  123.      }
  124. +
  125.      if (args->query & DACL_SECURITY_INFORMATION) {
  126.          DPRINTF(ACLLVL2, ("handle_getacl: DACL_SECURITY_INFORMATION\n"));
  127.          status = convert_nfs4acl_2_dacl(nfs41dg,
  128. diff --git a/daemon/getattr.c b/daemon/getattr.c
  129. index 7c8b2d1..fb7a738 100644
  130. --- a/daemon/getattr.c
  131. +++ b/daemon/getattr.c
  132. @@ -37,18 +37,39 @@
  133.  int nfs41_cached_getattr(
  134.      IN nfs41_session *session,
  135.      IN nfs41_path_fh *file,
  136. +    IN OPTIONAL bitmap4 *extra_attr_request,
  137.      OUT nfs41_file_info *info)
  138.  {
  139.      int status;
  140. +    bool bits_missing = false;
  141.  
  142.      /* first look for cached attributes */
  143.      status = nfs41_attr_cache_lookup(session_name_cache(session),
  144.          file->fh.fileid, info);
  145. -
  146. -    if (status) {
  147. +
  148. +    if ((status == 0) && extra_attr_request) {
  149. +        uint32_t i;
  150. +
  151. +        /* Check if bits are missing... */
  152. +        for (i=0 ; i < extra_attr_request->count ; i++) {
  153. +            if ((extra_attr_request->arr[i] != 0) &&
  154. +                ((((i < info->attrmask.count)?(info->attrmask.arr[i]):0) &
  155. +                    extra_attr_request->arr[i]) == 0)) {
  156. +                bits_missing = true;
  157. +                DPRINTF(1, ("nfs41_cached_getattr: bits missing %d\n", i));
  158. +                break;
  159. +            }
  160. +        }
  161. +    }
  162. +
  163. +    if (status || bits_missing) {
  164.          /* fetch attributes from the server */
  165.          bitmap4 attr_request;
  166. -        nfs41_superblock_getattr_mask(file->fh.superblock, &attr_request);
  167. +        nfs41_superblock_getattr_mask(file->fh.superblock, &attr_request);
  168. +
  169. +        if (extra_attr_request) {
  170. +            bitmap_or(&attr_request, extra_attr_request);
  171. +        }
  172.  
  173.          status = nfs41_getattr(session, file, &attr_request, info);
  174.          if (status) {
  175. @@ -88,7 +109,7 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  176.      nfs41_open_state *state = upcall->state_ref;
  177.      nfs41_file_info info = { 0 };
  178.  
  179. -    status = nfs41_cached_getattr(state->session, &state->file, &info);
  180. +    status = nfs41_cached_getattr(state->session, &state->file, NULL, &info);
  181.      if (status) {
  182.          eprintf("handle_getattr(state->path.path='%s'): "
  183.              "nfs41_cached_getattr() failed with %d\n",
  184. @@ -98,7 +119,7 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  185.      }
  186.  
  187.      if (info.type == NF4LNK) {
  188. -        nfs41_file_info target_info;
  189. +        nfs41_file_info target_info = { 0 };
  190.          int target_status = nfs41_symlink_follow(upcall->root_ref,
  191.              state->session, &state->file, &target_info);
  192.          if (target_status == NO_ERROR) {
  193. diff --git a/daemon/name_cache.c b/daemon/name_cache.c
  194. index 950c188..2c9d90d 100644
  195. --- a/daemon/name_cache.c
  196. +++ b/daemon/name_cache.c
  197. @@ -31,6 +31,7 @@
  198.  #include "util.h"
  199.  #include "tree.h"
  200.  #include "daemon_debug.h"
  201. +#include "nfs41_driver.h" /* for |NFS41_ACL_CACHE_EXPIRATION| */
  202.  
  203.  
  204.  /* dprintf levels for name cache logging */
  205. @@ -41,6 +42,7 @@ enum {
  206.  
  207.  
  208.  #define NAME_CACHE_EXPIRATION 30 /* TODO: get from configuration */
  209. +#define NAME_CACHE_ACL_EXPIRATION NFS41_ACL_CACHE_EXPIRATION
  210.  
  211.  /* allow up to 32M of memory for name and attribute cache entries */
  212.  #define NAME_CACHE_MAX_SIZE (32*1024*1024L)
  213. @@ -87,11 +89,12 @@ static __inline bool_t is_delegation(
  214.  #define NC_ATTR_NUMLINKS    (1 <<  8)
  215.  #define NC_ATTR_OWNER       (1 <<  9)
  216.  #define NC_ATTR_OWNER_GROUP (1 << 10)
  217. -#define NC_ATTR_TIME_ACCESS (1 << 11)
  218. -#define NC_ATTR_TIME_CREATE (1 << 12)
  219. -#define NC_ATTR_TIME_MODIFY (1 << 13)
  220. -#define NC_ATTR_SYSTEM      (1 << 14)
  221. -#define NC_ATTR_CLONE_BLKSIZE (1 << 15)
  222. +#define NC_ATTR_ACL         (1 << 11)
  223. +#define NC_ATTR_TIME_ACCESS (1 << 12)
  224. +#define NC_ATTR_TIME_CREATE (1 << 13)
  225. +#define NC_ATTR_TIME_MODIFY (1 << 14)
  226. +#define NC_ATTR_SYSTEM      (1 << 15)
  227. +#define NC_ATTR_CLONE_BLKSIZE (1 << 16)
  228.  
  229.  /* attribute cache */
  230.  struct attr_cache_entry {
  231. @@ -123,6 +126,8 @@ struct attr_cache_entry {
  232.      unsigned                delegated : 1;
  233.      char                    owner[NFS4_FATTR4_OWNER_LIMIT+1];
  234.      char                    owner_group[NFS4_FATTR4_OWNER_LIMIT+1];
  235. +    util_reltimestamp       acl_expiration;
  236. +    nfsacl41                acl;
  237.  };
  238.  #define ATTR_ENTRY_SIZE sizeof(struct attr_cache_entry)
  239.  
  240. @@ -169,6 +174,7 @@ static int attr_cache_entry_create(
  241.      entry->fsid_minor = 0ULL;
  242.      entry->invalidated = FALSE;
  243.      entry->delegated = FALSE;
  244. +    (void)memset(&entry->acl, 0, sizeof(nfsacl41));
  245.      *entry_out = entry;
  246.  out:
  247.      return status;
  248. @@ -180,6 +186,12 @@ static __inline void attr_cache_entry_free(
  249.  {
  250.      DPRINTF(NCLVL1, ("attr_cache_entry_free(%llu)\n", entry->fileid));
  251.      RB_REMOVE(attr_tree, &cache->head, entry);
  252. +
  253. +    if (entry->acl.aces) {
  254. +        free(entry->acl.aces);
  255. +        entry->acl.aces = NULL;
  256. +    }
  257. +
  258.      /* add it back to free_entries */
  259.      list_add_tail(&cache->free_entries, &entry->free_entry);
  260.  }
  261. @@ -344,6 +356,22 @@ static void attr_cache_update(
  262.              entry->nc_attrs |= NC_ATTR_ARCHIVE;
  263.              entry->archive = info->archive;
  264.          }
  265. +        if (info->attrmask.arr[0] & FATTR4_WORD0_ACL) {
  266. +            if (entry->acl.aces) {
  267. +                free(entry->acl.aces);
  268. +                entry->acl.aces = NULL;
  269. +            }
  270. +
  271. +            entry->nc_attrs &= ~NC_ATTR_ACL;
  272. +
  273. +            if (info->acl) {
  274. +                entry->acl_expiration = UTIL_GETRELTIME() +
  275. +                    NAME_CACHE_ACL_EXPIRATION;
  276. +                entry->nc_attrs |= NC_ATTR_ACL;
  277. +                (void)dup_nfsacl41aces(&entry->acl, info->acl);
  278. +                EASSERT(entry->acl.aces != NULL);
  279. +            }
  280. +        }
  281.      }
  282.      if (info->attrmask.count > 1) {
  283.          if (info->attrmask.arr[1] & FATTR4_WORD1_MODE) {
  284. @@ -463,6 +491,22 @@ static void copy_attrs(
  285.          /* this should only happen for newly created files/dirs */
  286.          dst->owner_group = NULL;
  287.      }
  288. +    if (src->nc_attrs & NC_ATTR_ACL) {
  289. +        /*
  290. +         * 1. Only copy attribute if |dst| provides a pointer to an ACL struct
  291. +         * This implicitly solves the issue who will free |dst->acl.aces|,
  292. +         * because only who provides a |dst->acl| will get ACL/ACE data,
  293. +         * but then also has to free the |dst->acl.aces| data.
  294. +         * 2. Only copy data and |FATTR4_WORD0_ACL| if |acl_expiration| did
  295. +         * not indicate expiration. This has a subtle interaction with
  296. +         * |handle_getacl()|, where |nfs41_cached_getattr()| will fall-back
  297. +         * to do a server lookup if the |FATTR4_WORD0_ACL| bit is missing.
  298. +         */
  299. +        if (dst->acl && (UTIL_GETRELTIME() <= src->acl_expiration)) {
  300. +            dst->attrmask.arr[0] |= FATTR4_WORD0_ACL;
  301. +            (void)dup_nfsacl41aces(dst->acl, &src->acl);
  302. +        }
  303. +    }
  304.      if (src->nc_attrs & NC_ATTR_FSID) {
  305.          dst->attrmask.arr[0] |= FATTR4_WORD0_FSID;
  306.          dst->fsid.major = src->fsid_major;
  307. diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
  308. index 862ce0e..b5cda90 100644
  309. --- a/daemon/nfs41_ops.c
  310. +++ b/daemon/nfs41_ops.c
  311. @@ -1478,28 +1478,30 @@ int nfs41_setattr(
  312.  
  313.      nfs41_superblock_getattr_mask(file->fh.superblock, &attr_request);
  314.  
  315. -    if (info->attrmask.count >= 2) {
  316. -        /*
  317. -         * If we set owner and/or owner_group make sure we ask
  318. -         * the server to send the values back for two reasons:
  319. -         * 1, Handle cases like "all_squash" (e.g. nfsd turns
  320. -         * owner/owner_group always into "nobody"/"nogroup")
  321. -         * 2. Make sure we update the name cache with the new
  322. -         * owner/owner_group
  323. -         *
  324. -         * Note that this can be a bit tricky as we might pass
  325. -         * a "name@domain" string to the server, but get a numeric
  326. -         * uid/gid as strings back, which means the name cache
  327. -         * might have both representations.
  328. -         */
  329. -        if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER) {
  330. -            attr_request.count = 2;
  331. -            attr_request.arr[1] |= FATTR4_WORD1_OWNER;
  332. -        }
  333. -        if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
  334. -            attr_request.count = 2;
  335. -            attr_request.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
  336. -        }
  337. +    /*
  338. +     * If we set owner, owner_group and/or ACLs make sure we ask
  339. +     * the server to send the values back for two reasons:
  340. +     * 1, Handle cases like "all_squash" (e.g. nfsd turns
  341. +     * owner/owner_group always into "nobody"/"nogroup")
  342. +     * 2. Make sure we update the name cache with the new
  343. +     * owner/owner_group/ACLs
  344. +     *
  345. +     * Note that this can be a bit tricky as we might pass
  346. +     * a "name@domain" string to the server, but get a numeric
  347. +     * uid/gid as strings back, which means the name cache
  348. +     * might have both representations.
  349. +     */
  350. +    if (bitmap_isset(&info->attrmask, 0, FATTR4_WORD0_ACL)) {
  351. +        attr_request.count = __max(attr_request.count, 1);
  352. +        attr_request.arr[0] |= FATTR4_WORD0_ACL;
  353. +    }
  354. +    if (bitmap_isset(&info->attrmask, 1, FATTR4_WORD1_OWNER)) {
  355. +        attr_request.count = __max(attr_request.count, 2);
  356. +        attr_request.arr[1] |= FATTR4_WORD1_OWNER;
  357. +    }
  358. +    if (bitmap_isset(&info->attrmask, 1, FATTR4_WORD1_OWNER_GROUP)) {
  359. +        attr_request.count = __max(attr_request.count, 2);
  360. +        attr_request.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
  361.      }
  362.  
  363.      compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
  364. diff --git a/daemon/nfs41_ops.h b/daemon/nfs41_ops.h
  365. index f57f8dc..91cb766 100644
  366. --- a/daemon/nfs41_ops.h
  367. +++ b/daemon/nfs41_ops.h
  368. @@ -1331,6 +1331,7 @@ int nfs41_superblock_getattr(
  369.  int nfs41_cached_getattr(
  370.      IN nfs41_session *session,
  371.      IN nfs41_path_fh *file,
  372. +    IN OPTIONAL bitmap4 *extra_attr_request,
  373.      OUT nfs41_file_info *info);
  374.  
  375.  int nfs41_remove(
  376. diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
  377. index 4ccbeaa..d9e3629 100644
  378. --- a/daemon/nfs41_xdr.c
  379. +++ b/daemon/nfs41_xdr.c
  380. @@ -1779,6 +1779,9 @@ static bool_t decode_file_attrs(
  381.          }
  382.          if (attrs->attrmask.arr[0] & FATTR4_WORD0_ACL) {
  383.              nfsacl41 *acl = info->acl;
  384. +
  385. +            EASSERT(acl != NULL);
  386. +
  387.              if (!xdr_array(xdr, (char**)&acl->aces, &acl->count,
  388.                  NFS41_ACL_MAX_ACE_ENTRIES, sizeof(nfsace4),
  389.                  (xdrproc_t)xdr_nfsace4))
  390. diff --git a/daemon/open.c b/daemon/open.c
  391. index aeaae11..2ba788a 100644
  392. --- a/daemon/open.c
  393. +++ b/daemon/open.c
  394. @@ -867,7 +867,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  395.              if (args->create_opts & FILE_OPEN_REPARSE_POINT) {
  396.                  /* continue and open the symlink itself, but we need to
  397.                   * know if the target is a regular file or directory */
  398. -                nfs41_file_info target_info;
  399. +                nfs41_file_info target_info = { 0 };
  400.                  int target_status = nfs41_symlink_follow(upcall->root_ref,
  401.                      state->session, &state->file, &target_info);
  402.                  if (target_status == NO_ERROR) {
  403. diff --git a/daemon/readdir.c b/daemon/readdir.c
  404. index f3564bf..a754197 100644
  405. --- a/daemon/readdir.c
  406. +++ b/daemon/readdir.c
  407. @@ -515,7 +515,7 @@ static int lookup_symlink(
  408.  {
  409.      nfs41_abs_path path;
  410.      nfs41_path_fh file;
  411. -    nfs41_file_info info;
  412. +    nfs41_file_info info = { 0 };
  413.      int status;
  414.  
  415.      status = format_abs_path(parent->path, name, &path);
  416. @@ -686,7 +686,7 @@ static int readdir_add_dots(
  417.          ZeroMemory(&entry->attr_info, sizeof(nfs41_file_info));
  418.  
  419.          status = nfs41_cached_getattr(state->session,
  420. -            &state->file, &entry->attr_info);
  421. +            &state->file, NULL, &entry->attr_info);
  422.          if (status) {
  423.              DPRINTF(0, ("readdir_add_dots: failed to add '.' entry.\n"));
  424.              goto out;
  425. @@ -719,7 +719,7 @@ static int readdir_add_dots(
  426.          ZeroMemory(&entry->attr_info, sizeof(nfs41_file_info));
  427.  
  428.          status = nfs41_cached_getattr(state->session,
  429. -            &state->parent, &entry->attr_info);
  430. +            &state->parent, NULL, &entry->attr_info);
  431.          if (status) {
  432.              status = ERROR_FILE_NOT_FOUND;
  433.              DPRINTF(0, ("readdir_add_dots: failed to add '..' entry.\n"));
  434. diff --git a/daemon/setattr.c b/daemon/setattr.c
  435. index 1e2bfdd..a994548 100644
  436. --- a/daemon/setattr.c
  437. +++ b/daemon/setattr.c
  438. @@ -71,7 +71,7 @@ static int handle_nfs41_setattr_basicinfo(void *daemon_context, setattr_upcall_a
  439.      (void)memset(&old_info, 0, sizeof(old_info));
  440.  
  441.      getattr_status = nfs41_cached_getattr(state->session,
  442. -        &state->file, &old_info);
  443. +        &state->file, NULL, &old_info);
  444.      if (getattr_status) {
  445.          DPRINTF(0, ("handle_nfs41_setattr_basicinfo(args->path='%s'): "
  446.              "nfs41_cached_getattr() failed with error %d.\n",
  447. diff --git a/daemon/util.c b/daemon/util.c
  448. index 3a56b7c..535bad7 100644
  449. --- a/daemon/util.c
  450. +++ b/daemon/util.c
  451. @@ -638,3 +638,21 @@ bool getwinntversionnnumbers(
  452.      return false;
  453.  #endif /* _WIN64 */
  454.  }
  455. +
  456. +bool dup_nfsacl41aces(
  457. +    nfsacl41 *restrict out_acl,
  458. +    const nfsacl41 *restrict in_acl)
  459. +{
  460. +    size_t acemem_size = in_acl->count * sizeof(nfsace4);
  461. +
  462. +    out_acl->aces = wintirpc_mem_alloc(acemem_size);
  463. +    if (out_acl->aces == NULL) {
  464. +        return false;
  465. +    }
  466. +
  467. +    out_acl->count = in_acl->count;
  468. +    out_acl->flag = in_acl->flag;
  469. +    (void)memcpy(out_acl->aces, in_acl->aces, acemem_size);
  470. +
  471. +    return true;
  472. +}
  473. diff --git a/daemon/util.h b/daemon/util.h
  474. index 6938372..9c558af 100644
  475. --- a/daemon/util.h
  476. +++ b/daemon/util.h
  477. @@ -376,4 +376,6 @@ bool_t waitcriticalsection(LPCRITICAL_SECTION cs);
  478.  
  479.  bool getwinntversionnnumbers(DWORD *MajorVersionPtr, DWORD *MinorVersionPtr, DWORD *BuildNumberPtr);
  480.  
  481. +bool dup_nfsacl41aces(nfsacl41 *restrict out_acl, const nfsacl41 *restrict in_acl);
  482. +
  483.  #endif /* !__NFS41_DAEMON_UTIL_H__ */
  484. diff --git a/include/nfs41_driver.h b/include/nfs41_driver.h
  485. index e11ebf5..06e8cfa 100644
  486. --- a/include/nfs41_driver.h
  487. +++ b/include/nfs41_driver.h
  488. @@ -127,6 +127,8 @@ typedef enum _nfs41_start_driver_state {
  489.  
  490.  #define NFS_VERSION_AUTONEGOTIATION (0xFFFF)
  491.  
  492. +/* Cache NFSv4.1 ACLs for max. 20 seconds */
  493. +#define NFS41_ACL_CACHE_EXPIRATION (20)
  494.  /*
  495.   * LargeInteger.QuadPart value to indicate a time value was not
  496.   * available
  497. diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
  498. index c468433..f7437a4 100644
  499. --- a/sys/nfs41sys_acl.c
  500. +++ b/sys/nfs41sys_acl.c
  501. @@ -235,7 +235,8 @@ NTSTATUS nfs41_QuerySecurityInformation(
  502.              (long long)current_time.QuadPart,
  503.              (long long)nfs41_fobx->time.QuadPart);
  504.  #endif
  505. -        if (current_time.QuadPart - nfs41_fobx->time.QuadPart <= 20*1000) {
  506. +        if ((current_time.QuadPart - nfs41_fobx->time.QuadPart) <=
  507. +            (NFS41_ACL_CACHE_EXPIRATION*1000)) {
  508.              PSECURITY_DESCRIPTOR sec_desc = (PSECURITY_DESCRIPTOR)
  509.                  RxContext->CurrentIrp->UserBuffer;
  510.              RtlCopyMemory(sec_desc, nfs41_fobx->acl, nfs41_fobx->acl_len);

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