pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for groupname2sid cache+nfsurlconf path+misc, 2024-02-13
Posted by Anonymous on Tue 13th Feb 2024 17:17
raw | new post

  1. From 8ac4e215bffb2b9d6ca7e6ef8298cfe4a2ba1826 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Tue, 13 Feb 2024 17:16:27 +0100
  4. Subject: [PATCH 1/4] tests: Remove cp -p "Function not implemented"
  5.  workarounds in manual_testing
  6.  
  7. Remove workarounds for $ cp -p ... # failing with "Function not implemented",
  8. this issues have been fixed.
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. tests/manual_testing.txt | 4 ----
  13.  1 file changed, 4 deletions(-)
  14.  
  15. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  16. index 83407a9..3bdb59c 100644
  17. --- a/tests/manual_testing.txt
  18. +++ b/tests/manual_testing.txt
  19. @@ -67,8 +67,6 @@ cd bash/
  20.  # (this is an automake/autoconf issue, they should trust Cygwin and not use
  21.  # ancient workarounds for issues which no longer exists)
  22.  (set -o xtrace ; sed -i "s/as_ln_s='cp -pR'/as_ln_s='ln -s'/g" $(find . -name configure) )
  23. -# workaround for $ cp -p # failing with "Function not implemented"
  24. -(set -o xtrace ; sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2--no-preserve=ownership /g' $(find . -name Makefile -o -name Makefile.in) )
  25.  # run configure
  26.  ./configure --with-curses
  27.  # repeat:
  28. @@ -112,8 +110,6 @@ cd gcc/
  29.  (set -o xtrace ; sed -i "s/as_ln_s='cp -pR'/as_ln_s='ln -s'/g" $(find . -name configure) )
  30.  # run configure
  31.  ./configure
  32. -# workaround for $ cp -p # failing with "Function not implemented"
  33. -(set -o xtrace ; sed -i -r 's/(cp.*)([[:space:]]+-p[[:space:]]+)/\2--no-preserve=ownership /g' $(find . -name Makefile -o -name Makefile.in) )
  34.  # repeat:
  35.  make -j4 clean
  36.  (yes | make -j32 all)
  37. --
  38. 2.43.0
  39.  
  40. From d190ed31bbf8438936d658a361ae48ab14d03316 Mon Sep 17 00:00:00 2001
  41. From: Roland Mainz <roland.mainz@nrubsig.org>
  42. Date: Tue, 13 Feb 2024 17:19:49 +0100
  43. Subject: [PATCH 2/4] daemon: Add groupname2sid cache
  44.  
  45. Add cache for group name to sid translation.
  46.  
  47. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  48. ---
  49. daemon/sid.c | 56 +++++++++++++++++++++++++++++++++++++++++++++-------
  50.  1 file changed, 49 insertions(+), 7 deletions(-)
  51.  
  52. diff --git a/daemon/sid.c b/daemon/sid.c
  53. index f0091af..a145607 100644
  54. --- a/daemon/sid.c
  55. +++ b/daemon/sid.c
  56. @@ -197,12 +197,14 @@ typedef struct _sidcache
  57.  
  58.  /* fixme: need function to deallocate this */
  59.  sidcache user_sidcache = { 0 };
  60. +sidcache group_sidcache = { 0 };
  61.  
  62.  
  63.  void sidcache_init(void)
  64.  {
  65.      DPRINTF(1, ("SID cache init\n"));
  66.      InitializeCriticalSection(&user_sidcache.lock);
  67. +    InitializeCriticalSection(&group_sidcache.lock);
  68.  }
  69.  
  70.  /* copy SID |value| into cache */
  71. @@ -309,7 +311,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  72.      const char *orig_name = name;
  73.  
  74.      int status = ERROR_INTERNAL_ERROR;
  75. -    SID_NAME_USE sid_type;
  76. +    SID_NAME_USE sid_type = 0;
  77.      char name_buff[256+2];
  78.      LPSTR tmp_buf = NULL;
  79.      DWORD tmp = 0;
  80. @@ -327,7 +329,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  81.  #ifdef NFS41_DRIVER_SID_CACHE
  82.          if (*sid = sidcache_getcached(&user_sidcache, name)) {
  83.              *sid_len = GetLengthSid(*sid);
  84. -            DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for '%s'\n", name));
  85. +            DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for user '%s'\n", name));
  86.              return 0;
  87.          }
  88.  #endif /* NFS41_DRIVER_SID_CACHE */
  89. @@ -338,7 +340,36 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  90.          if (!cygwin_getent_passwd(name, name_buff, &udummy, &gdummy)) {
  91.              if (strcmp(name, name_buff)) {
  92.                  DPRINTF(1,
  93. -                    ("map_nfs4servername_2_sid: remap '%s' --> '%s'\n",
  94. +                    ("map_nfs4servername_2_sid: remap user '%s' --> '%s'\n",
  95. +                    name,
  96. +                    name_buff));
  97. +                name = name_buff;
  98. +            }
  99. +        }
  100. +    }
  101. +#endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  102. +
  103. +
  104. +#ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  105. +    /* use our own idmapper script to map nfsv4 owner string to local Windows account */
  106. +    if (query & GROUP_SECURITY_INFORMATION) {
  107. +        gid_t gdummy = -1;
  108. +
  109. +#ifdef NFS41_DRIVER_SID_CACHE
  110. +        if (*sid = sidcache_getcached(&group_sidcache, name)) {
  111. +            *sid_len = GetLengthSid(*sid);
  112. +            DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for group '%s'\n", name));
  113. +            return 0;
  114. +        }
  115. +#endif /* NFS41_DRIVER_SID_CACHE */
  116. +
  117. +#ifndef NFS41_DRIVER_SID_CACHE
  118. +        /* gisburn: fixme: We must cache this, or the performance impact will be devastating!! */
  119. +#endif /* !NFS41_DRIVER_SID_CACHE */
  120. +        if (!cygwin_getent_group(name, name_buff, &gdummy)) {
  121. +            if (strcmp(name, name_buff)) {
  122. +                DPRINTF(1,
  123. +                    ("map_nfs4servername_2_sid: remap group '%s' --> '%s'\n",
  124.                      name,
  125.                      name_buff));
  126.                  name = name_buff;
  127. @@ -441,6 +472,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  128.                      "allocate_unixuser_sid(uid=%ld) success\n",
  129.                      query, name, user_uid));
  130.                  status = ERROR_SUCCESS;
  131. +                sid_type = SidTypeUser;
  132.                  goto out;
  133.              }
  134.  
  135. @@ -457,6 +489,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  136.                      "allocate_unixgroup_sid(gid=%ld) success\n",
  137.                      query, name, group_gid));
  138.                  status = ERROR_SUCCESS;
  139. +                sid_type = SidTypeGroup;
  140.                  goto out;
  141.              }
  142.  
  143. @@ -483,10 +516,19 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  144.      }
  145.  out:
  146.  #ifdef NFS41_DRIVER_SID_CACHE
  147. -    if (*sid) {
  148. -        /* fixme: No other flags in |query| must be set!! */
  149. -        if (query & OWNER_SECURITY_INFORMATION) {
  150. -            sidcache_add(&user_sidcache, orig_name, *sid);
  151. +    if ((status == 0) && *sid) {
  152. +        switch (sid_type) {
  153. +            case SidTypeUser:
  154. +                sidcache_add(&user_sidcache, orig_name, *sid);
  155. +                break;
  156. +            case SidTypeGroup:
  157. +                sidcache_add(&group_sidcache, orig_name, *sid);
  158. +                break;
  159. +            default:
  160. +                eprintf("map_nfs4servername_2_sid(query=%x,name='%s'): "
  161. +                    "Unknown SID_TYPE=%d\n",
  162. +                    query, orig_name, sid_type);
  163. +                break;
  164.          }
  165.      }
  166.  #endif /* NFS41_DRIVER_SID_CACHE */
  167. --
  168. 2.43.0
  169.  
  170. From b265a119a2de39f5f2fa5843d51d33482c3faa0e Mon Sep 17 00:00:00 2001
  171. From: Roland Mainz <roland.mainz@nrubsig.org>
  172. Date: Tue, 13 Feb 2024 17:33:51 +0100
  173. Subject: [PATCH 3/4] Update binary tarball readme for nfs:// workflow and
  174.  install/deinstall
  175.  
  176. Update binary tarball readme about nfs://-URL workflow, nfsurlconv
  177. script, reboots for install and deinstall etc.
  178.  
  179. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  180. ---
  181. cygwin/README.bintarball.txt | 9 +++++++++
  182.  1 file changed, 9 insertions(+)
  183.  
  184. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  185. index b66c34b..54808d3 100644
  186. --- a/cygwin/README.bintarball.txt
  187. +++ b/cygwin/README.bintarball.txt
  188. @@ -25,6 +25,8 @@ NFSv4.1 client and filesystem driver for Windows 10/11
  189.      client can use different ports per mount)
  190.  
  191.  - Support for nfs://-URL
  192. +    * Why ? nfs://-URLs are crossplatform, portable and Character-Encoding
  193. +      independent descriptions of NFSv4 server resources (exports).
  194.      - including custom ports and raw IPv6 addresses
  195.      - nfs://-URL conversion utility (/usr/bin/nfsurlconv) to convert
  196.          URLs, including non-ASCII/Unicode characters in mount path
  197. @@ -99,12 +101,14 @@ $ wget 'http://www.nrubsig.org/people/gisburn/work/msnfs41client/releases/testin
  198.  #
  199.  $ (cd / && tar -xf ~/download/msnfs41client_cygwin_binaries_git148e927_20231214_12h31m.tar.bz2 )
  200.  $ /sbin/msnfs41client install
  201. +<REBOOT>
  202.  
  203.  
  204.  #
  205.  # 6. Deinstallation:
  206.  #
  207.  $ (set -x ; cd / && tar -tf ~/download/msnfs41client_cygwin_binaries_git148e927_20231214_12h31m.tar.bz2 | while read i ; do [[ -f "$i" ]] && rm "$i" ; done)
  208. +<REBOOT>
  209.  
  210.  
  211.  #
  212. @@ -163,6 +167,11 @@ $ /sbin/nfs_mount
  213.    Unix_User+id/Unix_Group+id SIDs, and all others are mapped
  214.    to nobody/nogroup SIDs.
  215.  
  216. +- Workflow for nfs://-URLs:
  217. +  - Create nfs://-URLs with nfsurlconv, read $ nfsurlconv --man # for usage
  218. +  - pass URL to nfs_mount.exe like this:
  219. +    $ nfs_mount -o sec=sys,rw 'L' nfs://derfwnb4966_ipv4//bigdisk #
  220. +
  221.  - Cygwin symlinks are supported, but might require
  222.    $ fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1 #.
  223.    This includes symlinks to UNC paths, e.g. as Admin
  224. --
  225. 2.43.0
  226.  
  227. From 9e3f0b13d0f36740a36421c16eef8d50dec83d4a Mon Sep 17 00:00:00 2001
  228. From: Roland Mainz <roland.mainz@nrubsig.org>
  229. Date: Tue, 13 Feb 2024 17:43:15 +0100
  230. Subject: [PATCH 4/4] cygwin: nfsurlconf should be in /bin, not /sbin
  231.  
  232. nfsurlconf should be installed in /bin, not /sbin
  233.  
  234. Reported-by: Martin Wege <martin.l.wege@gmail.com>
  235. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  236. ---
  237. cygwin/Makefile | 4 ++--
  238.  1 file changed, 2 insertions(+), 2 deletions(-)
  239.  
  240. diff --git a/cygwin/Makefile b/cygwin/Makefile
  241. index bffadaf..e2953c7 100644
  242. --- a/cygwin/Makefile
  243. +++ b/cygwin/Makefile
  244. @@ -90,8 +90,8 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
  245.                 /usr/bin/ksh93 $(CYGWIN_MAKEFILE_DIR)/utils/mount_sshnfs/mount_sshnfs.ksh --nroff 2>"$(DESTDIR)/cygdrive/c/cygwin64/sbin/usr/share/man/man1/mount_sshnfs.1" || true
  246.         cp $(CYGWIN_MAKEFILE_DIR)/utils/sshnfs/sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
  247.         chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
  248. -       cp $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
  249. -       chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
  250. +       cp $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh $(DESTDIR)/cygdrive/c/cygwin64/bin/nfsurlconv
  251. +       chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/bin/nfsurlconv
  252.         /usr/bin/ksh93 $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh --nroff 2>"$(DESTDIR)/cygdrive/c/cygwin64/sbin/usr/share/man/man1/nfsurlconv.1" || true
  253.         @ printf "# Package tests\n"
  254.         cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.exe" $(DESTDIR)/cygdrive/c/cygwin64/bin/winfsinfo.exe
  255. --
  256. 2.43.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