pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Add support for French Windows in the idmapper+misc, 2024-09-20
Posted by Anonymous on Fri 20th Sep 2024 19:04
raw | new post

  1. From f45d343b6d2dec795eee6ad76bcd2b04cb8648aa Mon Sep 17 00:00:00 2001
  2. From: Cedric Blancher <cedric.blancher@gmail.com>
  3. Date: Fri, 20 Sep 2024 19:41:06 +0200
  4. Subject: [PATCH 1/3] cygwin_idmapper.ksh: Add idmapper support for French
  5.  Windows
  6.  
  7. Add idmapper support for French Windows, i.e. for localised
  8. Windows system account names in French.
  9.  
  10. Signed-off-by: Roland Mainz <roland.mainz@nrubsig.org>
  11. ---
  12. cygwin_idmapper.ksh | 70 ++++++++++++++++++++++++++++++++++++++-------
  13.  1 file changed, 60 insertions(+), 10 deletions(-)
  14.  
  15. diff --git a/cygwin_idmapper.ksh b/cygwin_idmapper.ksh
  16. index 930a32e..7e51817 100644
  17. --- a/cygwin_idmapper.ksh
  18. +++ b/cygwin_idmapper.ksh
  19. @@ -5,6 +5,8 @@ typeset IFS=''
  20.  
  21.  export PATH='/bin:/usr/bin'
  22.  
  23. +export LC_ALL='en_US.UTF-8'
  24. +
  25.  #
  26.  # global variables for this script
  27.  # (stored in compound variable so we
  28. @@ -35,23 +37,39 @@ compound c=(
  29.  #
  30.  typeset stdout
  31.  
  32. -# Group "SYSTEM": de_DE: "SYSTEM" ...
  33. +typeset -A localised_usernames
  34. +typeset -A localised_groupnames
  35. +
  36. +# User "SYSTEM": de_DE: "SYSTEM" ...
  37.  stdout="$(getent passwd 'S-1-5-18')"
  38. -typeset -r -A localised_usernames=(['SYSTEM']="${stdout%%:*}")
  39. +localised_usernames['SYSTEM']="${stdout%%:*}"
  40.  
  41. -# Group "None": de_DE: "Kein" ...
  42. +# User "Adminstrator": fr_FR: "Administrateur" ...
  43. +stdout="$(getent passwd 'S-1-5-21-3286904461-661230000-4220857270-500')"
  44. +localised_usernames['Administrator']="${stdout%%:*}"
  45. +
  46. +# Group "None": de_DE: "Kein", fr_FR: "Aucun" ...
  47.  stdout="$(getent group 'S-1-5-21-3286904461-661230000-4220857270-513')"
  48. -typeset -r -A localised_groupnames=(['None']="${stdout%%:*}")
  49. +localised_groupnames['None']="${stdout%%:*}"
  50.  
  51.  compound -A localusers=(
  52. -       ["roland_mainz"]=(
  53. -               localaccountname='roland_mainz'
  54. -               localuid=197608
  55. +       #
  56. +       # System accounts
  57. +       #
  58. +       ["${localised_usernames['Administrator']}"]=(
  59. +               localaccountname="${localised_usernames['Administrator']}"
  60. +               localuid=197108
  61.                 localgid=197121
  62.         )
  63. -       ["siegfried_wulsch"]=(
  64. -               localaccountname='siegfried_wulsch'
  65. -               localuid=197609
  66. +       ['Administrator']=(
  67. +               localaccountname="${localised_usernames['Administrator']}"
  68. +               localuid=197108
  69. +               localgid=197121
  70. +       )
  71. +       # French user "Administrator"
  72. +       ['Administrateur']=(
  73. +               localaccountname="${localised_usernames['Administrator']}"
  74. +               localuid=197108
  75.                 localgid=197121
  76.         )
  77.         ["${localised_usernames['SYSTEM']}"]=(
  78. @@ -64,6 +82,27 @@ compound -A localusers=(
  79.                 localuid=18
  80.                 localgid=18
  81.         )
  82. +       # French user "SYSTEM"
  83. +       # FIXME: This should be $'Syst\u[e8]me', but ksh93 1.0.10
  84. +       # doesn't work
  85. +       [$'Syst\xc3\xa8me']=(
  86. +               localaccountname="${localised_usernames['SYSTEM']}"
  87. +               localuid=18
  88. +               localgid=18
  89. +       )
  90. +       #
  91. +       # Site-specific users
  92. +       #
  93. +       ["roland_mainz"]=(
  94. +               localaccountname='roland_mainz'
  95. +               localuid=197608
  96. +               localgid=197121
  97. +       )
  98. +       ["siegfried_wulsch"]=(
  99. +               localaccountname='siegfried_wulsch'
  100. +               localuid=197609
  101. +               localgid=197121
  102. +       )
  103.         ["rmainz"]=(
  104.                 localaccountname='rmainz'
  105.                 localuid=1616
  106. @@ -87,6 +126,9 @@ compound -A localusers=(
  107.  )
  108.  
  109.  compound -A localgroups=(
  110. +       #
  111. +       # System accounts
  112. +       #
  113.         ["${localised_groupnames['None']}"]=(
  114.                 localgroupname="${localised_groupnames['None']}"
  115.                 localgid=197121
  116. @@ -95,11 +137,19 @@ compound -A localgroups=(
  117.                 localgroupname="${localised_groupnames['None']}"
  118.                 localgid=197121
  119.         )
  120. +       # French Windows localised group name for "None"
  121. +       ['Aucun']=(
  122. +               localgroupname="${localised_groupnames['None']}"
  123. +               localgid=197121
  124. +       )
  125.         # German Windows localised group name for "None"
  126.         ["Kein"]=(
  127.                 localgroupname="${localised_groupnames['None']}"
  128.                 localgid=197121
  129.         )
  130. +       #
  131. +       # Site-specific users
  132. +       #
  133.         ["rmainz"]=(
  134.                 localgroupname='rmainz'
  135.                 localgid=1616
  136. --
  137. 2.45.1
  138.  
  139. From e509c605f164018a1f9bdf80d9ff979ce353c11b Mon Sep 17 00:00:00 2001
  140. From: Roland Mainz <roland.mainz@nrubsig.org>
  141. Date: Fri, 20 Sep 2024 19:45:43 +0200
  142. Subject: [PATCH 2/3] cygwin_idmapper.ksh: Improve idmapper debugging support
  143.  
  144. Improve idmapper debugging support
  145.  
  146. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  147. ---
  148. cygwin_idmapper.ksh | 36 ++++++++++++++++++------------------
  149.  1 file changed, 18 insertions(+), 18 deletions(-)
  150.  
  151. diff --git a/cygwin_idmapper.ksh b/cygwin_idmapper.ksh
  152. index 7e51817..324843c 100644
  153. --- a/cygwin_idmapper.ksh
  154. +++ b/cygwin_idmapper.ksh
  155. @@ -37,48 +37,48 @@ compound c=(
  156.  #
  157.  typeset stdout
  158.  
  159. -typeset -A localised_usernames
  160. -typeset -A localised_groupnames
  161. +typeset -A c.localised_usernames
  162. +typeset -A c.localised_groupnames
  163.  
  164.  # User "SYSTEM": de_DE: "SYSTEM" ...
  165.  stdout="$(getent passwd 'S-1-5-18')"
  166. -localised_usernames['SYSTEM']="${stdout%%:*}"
  167. +c.localised_usernames['SYSTEM']="${stdout%%:*}"
  168.  
  169.  # User "Adminstrator": fr_FR: "Administrateur" ...
  170.  stdout="$(getent passwd 'S-1-5-21-3286904461-661230000-4220857270-500')"
  171. -localised_usernames['Administrator']="${stdout%%:*}"
  172. +c.localised_usernames['Administrator']="${stdout%%:*}"
  173.  
  174.  # Group "None": de_DE: "Kein", fr_FR: "Aucun" ...
  175.  stdout="$(getent group 'S-1-5-21-3286904461-661230000-4220857270-513')"
  176. -localised_groupnames['None']="${stdout%%:*}"
  177. +c.localised_groupnames['None']="${stdout%%:*}"
  178.  
  179.  compound -A localusers=(
  180.         #
  181.         # System accounts
  182.         #
  183. -       ["${localised_usernames['Administrator']}"]=(
  184. -               localaccountname="${localised_usernames['Administrator']}"
  185. +       ["${c.localised_usernames['Administrator']}"]=(
  186. +               localaccountname="${c.localised_usernames['Administrator']}"
  187.                 localuid=197108
  188.                 localgid=197121
  189.         )
  190.         ['Administrator']=(
  191. -               localaccountname="${localised_usernames['Administrator']}"
  192. +               localaccountname="${c.localised_usernames['Administrator']}"
  193.                 localuid=197108
  194.                 localgid=197121
  195.         )
  196.         # French user "Administrator"
  197.         ['Administrateur']=(
  198. -               localaccountname="${localised_usernames['Administrator']}"
  199. +               localaccountname="${c.localised_usernames['Administrator']}"
  200.                 localuid=197108
  201.                 localgid=197121
  202.         )
  203. -       ["${localised_usernames['SYSTEM']}"]=(
  204. -               localaccountname="${localised_usernames['SYSTEM']}"
  205. +       ["${c.localised_usernames['SYSTEM']}"]=(
  206. +               localaccountname="${c.localised_usernames['SYSTEM']}"
  207.                 localuid=18
  208.                 localgid=18
  209.         )
  210.         ["SYSTEM"]=(
  211. -               localaccountname="${localised_usernames['SYSTEM']}"
  212. +               localaccountname="${c.localised_usernames['SYSTEM']}"
  213.                 localuid=18
  214.                 localgid=18
  215.         )
  216. @@ -86,7 +86,7 @@ compound -A localusers=(
  217.         # FIXME: This should be $'Syst\u[e8]me', but ksh93 1.0.10
  218.         # doesn't work
  219.         [$'Syst\xc3\xa8me']=(
  220. -               localaccountname="${localised_usernames['SYSTEM']}"
  221. +               localaccountname="${c.localised_usernames['SYSTEM']}"
  222.                 localuid=18
  223.                 localgid=18
  224.         )
  225. @@ -129,22 +129,22 @@ compound -A localgroups=(
  226.         #
  227.         # System accounts
  228.         #
  229. -       ["${localised_groupnames['None']}"]=(
  230. -               localgroupname="${localised_groupnames['None']}"
  231. +       ["${c.localised_groupnames['None']}"]=(
  232. +               localgroupname="${c.localised_groupnames['None']}"
  233.                 localgid=197121
  234.         )
  235.         ["None"]=(
  236. -               localgroupname="${localised_groupnames['None']}"
  237. +               localgroupname="${c.localised_groupnames['None']}"
  238.                 localgid=197121
  239.         )
  240.         # French Windows localised group name for "None"
  241.         ['Aucun']=(
  242. -               localgroupname="${localised_groupnames['None']}"
  243. +               localgroupname="${c.localised_groupnames['None']}"
  244.                 localgid=197121
  245.         )
  246.         # German Windows localised group name for "None"
  247.         ["Kein"]=(
  248. -               localgroupname="${localised_groupnames['None']}"
  249. +               localgroupname="${c.localised_groupnames['None']}"
  250.                 localgid=197121
  251.         )
  252.         #
  253. --
  254. 2.45.1
  255.  
  256. From 762c7b1d654385a49b97d0c9b29d55f7a6b4d44a Mon Sep 17 00:00:00 2001
  257. From: Roland Mainz <roland.mainz@nrubsig.org>
  258. Date: Fri, 20 Sep 2024 19:51:10 +0200
  259. Subject: [PATCH 3/3] cygwin_idmapper.ksh: Fix error handling for unknown modes
  260.  
  261. Fix error handling for unknown modes.
  262.  
  263. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  264. ---
  265. cygwin_idmapper.ksh | 4 ++--
  266.  1 file changed, 2 insertions(+), 2 deletions(-)
  267.  
  268. diff --git a/cygwin_idmapper.ksh b/cygwin_idmapper.ksh
  269. index 324843c..ab38245 100644
  270. --- a/cygwin_idmapper.ksh
  271. +++ b/cygwin_idmapper.ksh
  272. @@ -14,7 +14,7 @@ export LC_ALL='en_US.UTF-8'
  273.  #
  274.  compound c=(
  275.         mode="$1"
  276. -       name="$2"
  277. +       name="${2-}"
  278.  )
  279.  
  280.  #
  281. @@ -248,7 +248,7 @@ case "${c.mode}" in
  282.                 exit 1
  283.                 ;;
  284.         *)
  285. -               print -u2 "cygwin_idmapper.ksh: Unknown mode %q." "${c.mode}"
  286. +               print -u2 -f "cygwin_idmapper.ksh: Unknown mode %q.\n" "${c.mode}"
  287.                 exit 1
  288.                 ;;
  289.  esac
  290. --
  291. 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