pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for FreeBSD nfsd test setup, ACL-on-file-create+misc, 2025-11-13-002
Posted by Anonymous on Thu 13th Nov 2025 22:40
raw | new post

  1. From 8235a08bb38b28da5cb97c2ae0d7b819c179b7c2 Mon Sep 17 00:00:00 2001
  2. From: Aurelien Couderc <aurelien.couderc2002@gmail.com>
  3. Date: Thu, 13 Nov 2025 22:32:40 +0100
  4. Subject: [PATCH 1/4] daemon: Fix a missing newline in EASSERT_MSG()
  5.  
  6. Fix a missing newline in EASSERT_MSG().
  7.  
  8. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  9. ---
  10. daemon/acl.c | 2 +-
  11.  1 file changed, 1 insertion(+), 1 deletion(-)
  12.  
  13. diff --git a/daemon/acl.c b/daemon/acl.c
  14. index 8fece12..d53281e 100644
  15. --- a/daemon/acl.c
  16. +++ b/daemon/acl.c
  17. @@ -178,7 +178,7 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  18.                  curr_nfsace->who, domain?domain:"<null>"));
  19.  
  20.          EASSERT_MSG(!isdigit(curr_nfsace->who[0]),
  21. -            ("convert_nfs4acl_2_dacl: aces[%d]->who='%s' uses numeric id",
  22. +            ("convert_nfs4acl_2_dacl: aces[%d]->who='%s' uses numeric id\n",
  23.              (int)nfs_i, curr_nfsace->who));
  24.  
  25.  #ifdef NFS41_DRIVER_ACLS_SETACL_SKIP_WINNULLSID_ACES
  26. --
  27. 2.51.0
  28.  
  29. From 365708a11337b38b8939357059697aba4fbe6fa8 Mon Sep 17 00:00:00 2001
  30. From: Cedric Blancher <cedric.blancher@gmail.com>
  31. Date: Thu, 13 Nov 2025 22:34:25 +0100
  32. Subject: [PATCH 2/4] tests: Update FreeBSD NFS server setup instructions
  33.  
  34. Update FreeBSD NFS server setup instructions.
  35.  
  36. Signed-off-by: Roland Mainz <roland.mainz@nrubsig.org>
  37. ---
  38. tests/nfs_server_setup.txt | 13 +++++++++----
  39.  1 file changed, 9 insertions(+), 4 deletions(-)
  40.  
  41. diff --git a/tests/nfs_server_setup.txt b/tests/nfs_server_setup.txt
  42. index e802e80..594f04f 100644
  43. --- a/tests/nfs_server_setup.txt
  44. +++ b/tests/nfs_server_setup.txt
  45. @@ -212,9 +212,9 @@ sysrc nfsv4_server_enable=YES
  46.  sysrc nfsuserd_flags="-domain GLOBAL.LOC"
  47.  sysrc nfsuserd_enable=YES
  48.  sysrc nfscbd_enable=YES
  49. -sysctl vfs.nfs.enable_uidtostring=1
  50. -sysctl vfs.nfsd.enable_stringtouid=1
  51. -sysctl vfs.nfsd.issue_delegations=1
  52. +printf 'vfs.nfs.enable_uidtostring=0\n' >>'/etc/sysctl.conf'
  53. +printf 'vfs.nfsd.enable_stringtouid=0\n' >>'/etc/sysctl.conf'
  54. +printf 'vfs.nfsd.issue_delegations=1\n' >>'/etc/sysctl.conf'
  55.  
  56.  mkdir /nfsdata
  57.  chmod a+rwxt /nfsdata
  58. @@ -230,9 +230,14 @@ service nfsd start
  59.  - Add groups entry for group "wheel" if neccesary:
  60.  $ printf 'wheel:S-1-0-0:0:\n' >>'/etc/group'
  61.  
  62. -##### 3. Misc commands:
  63. +##### 3. Misc FreeBSD commands:
  64.  pw groupadd group -n None -g 197121
  65.  pw groupadd group -n ced -g 197608
  66.  pw useradd -n ced -u 197608 -g None -G None,ced -m -s /bin/sh
  67. +# later add more groups, and add user "ced" as member:
  68. +pw groupadd group -n cygwingrp1 -g 197611
  69. +pw groupadd group -n cygwingrp2 -g 197612
  70. +pw groupmod cygwingrp1 -m ced
  71. +pw groupmod cygwingrp2 -m ced
  72.  
  73.  # EOF.
  74. --
  75. 2.51.0
  76.  
  77. From a73322e5f1b21fcccc85cc66371c2a521a0b32f2 Mon Sep 17 00:00:00 2001
  78. From: Roland Mainz <roland.mainz@nrubsig.org>
  79. Date: Thu, 13 Nov 2025 22:38:15 +0100
  80. Subject: [PATCH 3/4] daemon: Cleanup |map_access_2_allowdeny()|
  81.  
  82. Cleanup |map_access_2_allowdeny()|.
  83.  
  84. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  85. ---
  86. daemon/open.c | 99 +++++++++++++++++++++++++++++++++++++--------------
  87.  1 file changed, 72 insertions(+), 27 deletions(-)
  88.  
  89. diff --git a/daemon/open.c b/daemon/open.c
  90. index 93f8b3a..0ac8c28 100644
  91. --- a/daemon/open.c
  92. +++ b/daemon/open.c
  93. @@ -474,47 +474,92 @@ static int map_disposition_2_nfsopen(ULONG disposition, int in_status, bool_t pe
  94.      return status;
  95.  }
  96.  
  97. -static void map_access_2_allowdeny(ULONG access_mask, ULONG access_mode,
  98. -                                   ULONG disposition, uint32_t *allow, uint32_t *deny)
  99. +static void map_access_2_allowdeny(
  100. +    IN ULONG access_mask,
  101. +    IN ULONG access_mode,
  102. +    IN ULONG disposition,
  103. +    OUT uint32_t *restrict allow,
  104. +    OUT uint32_t *restrict deny)
  105.  {
  106. -    if ((access_mask &
  107. -            (FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES)) &&
  108. -            (access_mask & (FILE_READ_DATA | FILE_EXECUTE)))
  109. +    bool access_mask_readaccess;
  110. +    bool access_mask_writeaccess;
  111. +
  112. +    /*
  113. +     * FIXME: Why is |FILE_READ_ATTRIBUTES| missing here, but the test
  114. +     * for |access_mask_writeaccess| includes |FILE_WRITE_ATTRIBUTES| ?
  115. +     */
  116. +    if (access_mask & (FILE_READ_DATA|FILE_EXECUTE)) {
  117. +        access_mask_readaccess = true;
  118. +    }
  119. +    else {
  120. +        access_mask_readaccess = false;
  121. +    }
  122. +    if (access_mask &
  123. +        (FILE_WRITE_DATA|FILE_APPEND_DATA|FILE_WRITE_ATTRIBUTES)) {
  124. +        access_mask_writeaccess = true;
  125. +    }
  126. +    else {
  127. +        access_mask_writeaccess = false;
  128. +    }
  129. +
  130. +    if (access_mask_readaccess && access_mask_writeaccess) {
  131.          *allow = OPEN4_SHARE_ACCESS_BOTH;
  132. -    else if (access_mask & (FILE_READ_DATA | FILE_EXECUTE))
  133. +    }
  134. +    else if (access_mask_readaccess) {
  135.          *allow = OPEN4_SHARE_ACCESS_READ;
  136. -    else if (access_mask &
  137. -                (FILE_WRITE_DATA | FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES))
  138. +    }
  139. +    else if (access_mask_writeaccess) {
  140.          *allow = OPEN4_SHARE_ACCESS_WRITE;
  141. -    /* if we are creating a file and no data access is specified, then
  142. -     * do an open and request no delegations. example open with share access 0
  143. -     * and share deny 0 (ie deny_both).
  144. +    }
  145. +    else {
  146. +        EASSERT_MSG(false,
  147. +            ("map_access_2_allowdeny: "
  148. +            "No access_mask_readaccess&&access_mask_writeaccess, "
  149. +            "access_mask=0x%lx\n",
  150. +            (unsigned long)access_mask));
  151. +        *allow = 0;
  152. +    }
  153. +
  154. +    /*
  155. +     * If we are creating a file and no data access is specified, then
  156. +     * do an open and request no delegations. Example open with share
  157. +     * access 0 and share deny 0 (ie deny_both).
  158.       */
  159. -    if ((disposition == FILE_CREATE || disposition == FILE_OPEN_IF ||
  160. -            disposition == FILE_OVERWRITE_IF || disposition == FILE_SUPERSEDE ||
  161. -            disposition == FILE_OVERWRITE) &&
  162. -            !(access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA |
  163. -            FILE_WRITE_ATTRIBUTES | FILE_READ_DATA | FILE_EXECUTE)))
  164. +    if ((disposition == FILE_CREATE ||
  165. +        disposition == FILE_OPEN_IF ||
  166. +        disposition == FILE_OVERWRITE_IF ||
  167. +        disposition == FILE_SUPERSEDE ||
  168. +        disposition == FILE_OVERWRITE)
  169. +        &&
  170. +        ((access_mask_readaccess == false) &&
  171. +        (access_mask_writeaccess == false))) {
  172.          *allow = OPEN4_SHARE_ACCESS_READ | OPEN4_SHARE_ACCESS_WANT_NO_DELEG;
  173. +    }
  174.  
  175. -#define FIX_ALLOW_DENY_WIN2NFS_CONVERSION
  176. +#define FIX_ALLOW_DENY_WIN2NFS_CONVERSION 1
  177.  #ifdef FIX_ALLOW_DENY_WIN2NFS_CONVERSION
  178. -    if ((access_mode & FILE_SHARE_READ) &&
  179. -            (access_mode & FILE_SHARE_WRITE))
  180. +    if ((access_mode & (FILE_SHARE_READ|FILE_SHARE_WRITE)) ==
  181. +        (FILE_SHARE_READ|FILE_SHARE_WRITE)) {
  182.          *deny = OPEN4_SHARE_DENY_NONE;
  183. -    else if (access_mode & FILE_SHARE_READ)
  184. +    }
  185. +    else if (access_mode & FILE_SHARE_READ) {
  186.          *deny = OPEN4_SHARE_DENY_WRITE;
  187. -    else if (access_mode & FILE_SHARE_WRITE)
  188. +    }
  189. +    else if (access_mode & FILE_SHARE_WRITE) {
  190.          *deny = OPEN4_SHARE_DENY_READ;
  191. -    else
  192. +    }
  193. +    else {
  194.          *deny = OPEN4_SHARE_DENY_BOTH;
  195. +    }
  196.  #else
  197. -    // AGLO: 11/13/2009.
  198. -    // readonly file that is being opened for reading with a
  199. -    // share read mode given above logic translates into deny
  200. -    // write and linux server does not allow it.
  201. +    /*
  202. +     * AGLO: 11/13/2009:
  203. +     * readonly file that is being opened for reading with a
  204. +     * share read mode given above logic translates into deny
  205. +     * write and linux server does not allow it.
  206. +     */
  207.      *deny = OPEN4_SHARE_DENY_NONE;
  208. -#endif
  209. +#endif /* FIX_ALLOW_DENY_WIN2NFS_CONVERSION */
  210.  }
  211.  
  212.  static int check_execute_access(nfs41_open_state *state)
  213. --
  214. 2.51.0
  215.  
  216. From 437caac0ad8e49467708bcec4b673c1cb6f324b7 Mon Sep 17 00:00:00 2001
  217. From: Roland Mainz <roland.mainz@nrubsig.org>
  218. Date: Thu, 13 Nov 2025 23:28:02 +0100
  219. Subject: [PATCH 4/4] README.md,docs: Document create file/dir with ACL issues
  220.  
  221. Document create file/dir with ACL issues.
  222.  
  223. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  224. ---
  225. README.md       | 8 ++++++++
  226.  docs/README.xml | 9 +++++++++
  227.  2 files changed, 17 insertions(+)
  228.  
  229. diff --git a/README.md b/README.md
  230. index a41dca6..8da6e80 100644
  231. --- a/README.md
  232. +++ b/README.md
  233. @@ -792,6 +792,14 @@ Within WSL mount UNC path returned by `/sbin/nfs_mount`
  234.    which require NTFS or ReFS, but should be physically hosted on the NFS
  235.    server.
  236.  
  237. +- Creating a new Win32 file/dir with an ACL only works with NFS servers
  238. +  which support `FATTR4_ACL`/`FATTR4_DACL` for `OPEN`/`CREATE`
  239. +  operations.
  240. +
  241. +  So far FreeBSD 14.3 and the NFS-Ganesha NFS servers are known to
  242. +  support this, while Linux 6.12.\*, Solaris 11.4 and Illumos NFS
  243. +  servers ignore the ACL on `OPEN`/`CREATE` operations.
  244. +
  245.  # Troubleshooting && finding bugs/debugging
  246.  
  247.  - `nfsd_debug.exe` has the `-d` option to set a level for debug output.
  248. diff --git a/docs/README.xml b/docs/README.xml
  249. index a74a903..161ac5d 100644
  250. --- a/docs/README.xml
  251. +++ b/docs/README.xml
  252. @@ -887,6 +887,15 @@ Datei befindet. Versuchen Sie, die Datei woanders zu speichern.</programlisting>
  253.          <command>filedisk /mount 35 'N:\winntfs_filedisk_003.img' S:</command> as global mount
  254.          which require NTFS or ReFS, but should be physically hosted on the NFS server.</para>
  255.        </listitem>
  256. +      <listitem>
  257. +        <para>Creating a new Win32 file/dir with an ACL only works with NFS servers which support
  258. +        <literal>FATTR4_ACL</literal>/<literal>FATTR4_DACL</literal> for
  259. +        <literal>OPEN</literal>/<literal>CREATE</literal>
  260. +        operations.</para>
  261. +        <para>So far FreeBSD 14.3 and the NFS-Ganesha NFS servers are known to support this,
  262. +        while Linux 6.12.*, Solaris 11.4 and Illumos NFS servers ignore the ACL on
  263. +        <literal>OPEN</literal>/<literal>CREATE</literal> operations.</para>
  264. +      </listitem>
  265.      </itemizedlist>
  266.    </section>
  267.  
  268. --
  269. 2.51.0

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