pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch to handle localised Windows user/group names, 2024-09-18
Posted by Anonymous on Wed 18th Sep 2024 13:40
raw | new post

  1. From 1ca2a410f8526f41c8cccbeaf60a628f8ef8919c Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 18 Sep 2024 14:21:35 +0200
  4. Subject: [PATCH] cygwin_idmapper.ksh: Handle localised user/group names
  5.  
  6. Windows uses localised user and group names, e.g. on a
  7. German Windows the group "None" is called "Kein" etc,
  8. which poses a challenge for idmapping.
  9.  
  10. To fix this we use Cygwin /usr/bin/getent passwd/group
  11. to lookup users&&groups by their SID to get the localised
  12. user/group name.
  13.  
  14. FIXME: This still means we send a localised group name
  15. to the NFSv4 server, and it needs /etc/group entries for all
  16. localised variations of group "None".
  17. In the future the idmapper should do the mapping in both
  18. directions to avoid this.
  19.  
  20. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  21. ---
  22. cygwin_idmapper.ksh | 43 ++++++++++++++++++++++++++++++++++++++++---
  23.  1 file changed, 40 insertions(+), 3 deletions(-)
  24.  
  25. diff --git a/cygwin_idmapper.ksh b/cygwin_idmapper.ksh
  26. index 588e40b..bcbc871 100644
  27. --- a/cygwin_idmapper.ksh
  28. +++ b/cygwin_idmapper.ksh
  29. @@ -15,6 +15,34 @@ compound c=(
  30.         name="$2"
  31.  )
  32.  
  33. +#
  34. +# Windows uses localised user and group names,
  35. +# e.g. on a German Windows the group "None" is called "Kein" etc.
  36. +#
  37. +# Cygwin allows to lookup users&&groups by their SID with
  38. +# /usr/bin/getent, so we use that to get the localised user/group
  39. +# name.
  40. +# Alternatively powershell can be used like this:
  41. +# ---- snip ----
  42. +# (New-Object System.Security.Principal.SecurityIdentifier \
  43. +#   "S-1-5-21-3286904461-661230000-4220857270-513").Translate( [System.Security.Principal.NTAccount]).Value
  44. +# ---- snip ----
  45. +#
  46. +# FIXME: This still means we send a localised group name
  47. +# to the NFSv4 server, and it needs /etc/group entries for all
  48. +# localised variations of group "None". In the future the idmapper
  49. +# should do the mapping in both directions to avoid this.
  50. +#
  51. +typeset stdout
  52. +
  53. +# Group "SYSTEM": de_DE: "SYSTEM" ...
  54. +stdout="$(getent passwd 'S-1-5-18')"
  55. +typeset -r -A localised_usernames=(['SYSTEM']="${stdout%%:*}")
  56. +
  57. +# Group "None": de_DE: "Kein" ...
  58. +stdout="$(getent group 'S-1-5-21-3286904461-661230000-4220857270-513')"
  59. +typeset -r -A localised_groupnames=(['None']="${stdout%%:*}")
  60. +
  61.  compound -A localusers=(
  62.         ["roland_mainz"]=(
  63.                 localaccoutname='roland_mainz'
  64. @@ -26,8 +54,13 @@ compound -A localusers=(
  65.                 localuid=197609
  66.                 localgid=197121
  67.         )
  68. +       ["${localised_usernames['SYSTEM']}"]=(
  69. +               localaccoutname="${localised_usernames['SYSTEM']}"
  70. +               localuid=18
  71. +               localgid=18
  72. +       )
  73.         ["SYSTEM"]=(
  74. -               localaccoutname='SYSTEM'
  75. +               localaccoutname="${localised_usernames['SYSTEM']}"
  76.                 localuid=18
  77.                 localgid=18
  78.         )
  79. @@ -54,8 +87,12 @@ compound -A localusers=(
  80.  )
  81.  
  82.  compound -A localgroups=(
  83. -       ["Kein"]=(
  84. -               localgroupname='Kein'
  85. +       ["${localised_groupnames['None']}"]=(
  86. +               localgroupname="${localised_groupnames['None']}"
  87. +               localgid=197121
  88. +       )
  89. +       ["None"]=(
  90. +               localgroupname="${localised_groupnames['None']}"
  91.                 localgid=197121
  92.         )
  93.         ["rmainz"]=(
  94. --
  95. 2.45.1

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