pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for Windows 32bit build, nfsurlconv and misc, 2024-02-02
Posted by Anonymous on Fri 2nd Feb 2024 10:28
raw | new post

  1. From 2155b0570e4f455f6adc35a737b6e8f7efad712e Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 31 Jan 2024 17:31:19 +0100
  4. Subject: [PATCH 1/6] mount_sshnfs,sshnfs: Update to upstream 20240130
  5.  
  6. Update { mount_sshnfs.ksh, sshnfs.ksh } to upstream version
  7. 20240130
  8.  
  9. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  10. ---
  11. cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 25 +++++++++++++---------
  12.  cygwin/utils/sshnfs/sshnfs.ksh             |  5 +++++
  13.  2 files changed, 20 insertions(+), 10 deletions(-)
  14.  
  15. diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
  16. index 52c3db0..c1dc4b5 100644
  17. --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
  18. +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
  19. @@ -45,9 +45,9 @@
  20.  
  21.  #
  22.  # For more examples see help and subcommand help:
  23. -# $ mount_sshnfs.ksh --man
  24. -# $ mount_sshnfs.ksh mount --man
  25. -# $ mount_sshnfs.ksh umount --man
  26. +# $ mount_sshnfs --man
  27. +# $ mount_sshnfs mount --man
  28. +# $ mount_sshnfs umount --man
  29.  #
  30.  
  31.  #
  32. @@ -291,6 +291,10 @@ function parse_rfc1738_url
  33.         [[ "${.sh.match[7]-}" != '' ]] && integer data.port="${.sh.match[7]}"
  34.         [[ "${.sh.match[8]-}" != '' ]] && data.uripath="${.sh.match[8]}"
  35.  
  36. +       if [[ -v data.uripath ]] ; then
  37. +               data.path="${ printf "${data.uripath//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}" ; }"
  38. +       fi
  39. +
  40.         return 0
  41.  }
  42.  
  43. @@ -363,7 +367,7 @@ function cmd_mount
  44.  
  45.         # fixme: Need better text layout for $ mount_sshnfs mount --man #
  46.         typeset -r mount_sshnfs_cmdmount_usage=$'+
  47. -       [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-01-29 \$\n]
  48. +       [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-01-31 \$\n]
  49.         [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  50.         [+NAME?mount_sshnfs mount - mount NFSv4 filesystem through ssh
  51.                 tunnel]
  52. @@ -729,7 +733,7 @@ function cmd_umount
  53.         typeset mydebug=false # fixme: should be "bool" for ksh93v
  54.         # fixme: Need better text layout for $ mount_sshnfs mount --man #
  55.         typeset -r mount_sshnfs_cmdumount_usage=$'+
  56. -       [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-01-29 \$\n]
  57. +       [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-01-31 \$\n]
  58.         [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  59.         [+NAME?mount_sshnfs umount - unmount NFSv4 filesystem mounted
  60.                 via mount_sshnfs mount]
  61. @@ -833,7 +837,7 @@ function main
  62.  
  63.         # fixme: Need better text layout for $ mount_sshnfs --man #
  64.         typeset -r mount_sshnfs_usage=$'+
  65. -       [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-01-29 \$\n]
  66. +       [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-01-31 \$\n]
  67.         [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  68.         [+NAME?mount_sshnfs - mount/umount NFSv4 filesystem via ssh
  69.                 tunnel]
  70. @@ -845,18 +849,19 @@ function main
  71.         umount [options]
  72.         status [options]
  73.         restart_forwarding [options]
  74. +       --man
  75.  
  76.         [+EXAMPLES]{
  77.                 [+?Example 1:][+?Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz"]{
  78.  [+\n# mkdir -p /foobarmnt
  79. -# ksh mount_sshnfs.ksh mount ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
  80. -# mount_sshnfs.ksh umount /foobarmnt
  81. +# mount_sshnfs mount ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
  82. +# mount_sshnfs umount /foobarmnt
  83.  ]
  84.  }
  85.                 [+?Example 2:][+?Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz" via SSH jumphost rmainz@10.49.20.131]{
  86.  [+\n# mkdir -p /foobarmnt
  87. -# ksh mount_sshnfs.ksh mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
  88. -# mount_sshnfs.ksh umount /foobarmnt
  89. +# mount_sshnfs mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
  90. +# mount_sshnfs umount /foobarmnt
  91.  ]
  92.                 }
  93.         }
  94. diff --git a/cygwin/utils/sshnfs/sshnfs.ksh b/cygwin/utils/sshnfs/sshnfs.ksh
  95. index 2f2f64e..32b8668 100644
  96. --- a/cygwin/utils/sshnfs/sshnfs.ksh
  97. +++ b/cygwin/utils/sshnfs/sshnfs.ksh
  98. @@ -221,6 +221,7 @@ function netstat_find_next_free_local_tcp_port
  99.         return 1
  100.  }
  101.  
  102. +
  103.  #
  104.  # parse_rfc1738_url - parse RFC 1838 URLs
  105.  #
  106. @@ -272,6 +273,10 @@ function parse_rfc1738_url
  107.         [[ "${.sh.match[7]-}" != '' ]] && integer data.port="${.sh.match[7]}"
  108.         [[ "${.sh.match[8]-}" != '' ]] && data.uripath="${.sh.match[8]}"
  109.  
  110. +       if [[ -v data.uripath ]] ; then
  111. +               data.path="${ printf "${data.uripath//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}" ; }"
  112. +       fi
  113. +
  114.         return 0
  115.  }
  116.  
  117. --
  118. 2.43.0
  119.  
  120. From f3d356bb355c12810082c90e2afa16284909becc Mon Sep 17 00:00:00 2001
  121. From: Roland Mainz <roland.mainz@nrubsig.org>
  122. Date: Wed, 31 Jan 2024 17:41:53 +0100
  123. Subject: [PATCH 2/6] cygwin: Add nfsurlconv.ksh script to convert from/to
  124.  nfs://-URLs
  125.  
  126. Add nfsurlconv.ksh script to convert from/to nfs://-URLs
  127.  
  128. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  129. ---
  130. cygwin/Makefile                        |   2 +
  131.  cygwin/utils/nfsurlconv/nfsurlconv.ksh | 341 +++++++++++++++++++++++++
  132.  2 files changed, 343 insertions(+)
  133.  create mode 100644 cygwin/utils/nfsurlconv/nfsurlconv.ksh
  134.  
  135. diff --git a/cygwin/Makefile b/cygwin/Makefile
  136. index 0374429..71d933c 100644
  137. --- a/cygwin/Makefile
  138. +++ b/cygwin/Makefile
  139. @@ -87,6 +87,8 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
  140.         chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
  141.         cp $(CYGWIN_MAKEFILE_DIR)/utils/sshnfs/sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
  142.         chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
  143. +       cp $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
  144. +       chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
  145.         @ printf "# Package tests\n"
  146.         cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.exe" $(DESTDIR)/cygdrive/c/cygwin64/bin/winfsinfo.exe
  147.         @ printf "# Package ksh93&co (if available) since Cygwin does not ship with it yet\n"
  148. diff --git a/cygwin/utils/nfsurlconv/nfsurlconv.ksh b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
  149. new file mode 100644
  150. index 0000000..97db401
  151. --- /dev/null
  152. +++ b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
  153. @@ -0,0 +1,341 @@
  154. +#!/bin/ksh93
  155. +
  156. +#
  157. +# MIT License
  158. +#
  159. +# Copyright (c) 2024 Roland Mainz <roland.mainz@nrubsig.org>
  160. +#
  161. +# Permission is hereby granted, free of charge, to any person obtaining a copy
  162. +# of this software and associated documentation files (the "Software"), to deal
  163. +# in the Software without restriction, including without limitation the rights
  164. +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  165. +# copies of the Software, and to permit persons to whom the Software is
  166. +# furnished to do so, subject to the following conditions:
  167. +#
  168. +# The above copyright notice and this permission notice shall be included in all
  169. +# copies or substantial portions of the Software.
  170. +#
  171. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  172. +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  173. +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  174. +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  175. +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  176. +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  177. +# SOFTWARE.
  178. +#
  179. +
  180. +#
  181. +# nfsurlconv.ksh - convert host/port/path from/to a nfs://-URL
  182. +
  183. +#
  184. +# Written by Roland Mainz <roland.mainz@nrubsig.org>
  185. +#
  186. +
  187. +function usage
  188. +{
  189. +       (( OPTIND=0 ))
  190. +       getopts -a "${1}" "${2}" OPT '-?'
  191. +       return 2
  192. +}
  193. +
  194. +#
  195. +# parse_rfc1738_url - parse RFC 1838 URLs
  196. +#
  197. +# Output variables are named after RFC 1838 Section 5 ("BNF for
  198. +# specific URL schemes")
  199. +#
  200. +function parse_rfc1738_url
  201. +{
  202. +       set -o nounset
  203. +
  204. +       typeset url="$2"
  205. +       typeset leftover
  206. +       nameref data="$1" # output compound variable
  207. +
  208. +       # ~(E) is POSIX extended regular expression matching (instead
  209. +       # of shell pattern), "x" means "multiline", "l" means "left
  210. +       # anchor", "r" means "right anchor"
  211. +       leftover="${url/~(Elrx)
  212. +               (.+?)                           # scheme
  213. +               :\/\/                           # '://'
  214. +               (                               # login
  215. +                       (?:
  216. +                               (.+?)           # user (optional)
  217. +                               (?::(.+))?      # password (optional)
  218. +                               @
  219. +                       )?
  220. +                       (                       # hostport
  221. +                               (.+?)           # host
  222. +                               (?::([[:digit:]]+))? # port (optional)
  223. +                       )
  224. +               )
  225. +               (?:\/(.*?))?/X}"                # path (optional)
  226. +
  227. +       # All parsed data should be captured via eregex in .sh.match - if
  228. +       # there is anything left (except the 'X') then the input string did
  229. +       # not properly match the eregex
  230. +       [[ "$leftover" == 'X' ]] ||
  231. +               { print -u2 -f $"%s: Parser error, leftover=%q\n" \
  232. +                       "$0" "$leftover" ; return 1 ; }
  233. +
  234. +       data.url="${.sh.match[0]}"
  235. +       data.scheme="${.sh.match[1]}"
  236. +       data.login="${.sh.match[2]}"
  237. +       # FIXME: This should use [[ ! -v .sh.match[3] ]], but ksh93u has bugs
  238. +       [[ "${.sh.match[3]-}" != '' ]] && data.user="${.sh.match[3]}"
  239. +       [[ "${.sh.match[4]-}" != '' ]] && data.password="${.sh.match[4]}"
  240. +       data.hostport="${.sh.match[5]}"
  241. +       data.host="${.sh.match[6]}"
  242. +       [[ "${.sh.match[7]-}" != '' ]] && integer data.port="${.sh.match[7]}"
  243. +       [[ "${.sh.match[8]-}" != '' ]] && data.uripath="${.sh.match[8]}"
  244. +
  245. +       if [[ -v data.uripath ]] ; then
  246. +               data.path="${ printf "${data.uripath//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}" ; }"
  247. +       fi
  248. +
  249. +       return 0
  250. +}
  251. +
  252. +
  253. +function parse_sshnfs_url
  254. +{
  255. +       typeset url="$2"
  256. +       nameref data="$1"
  257. +
  258. +       parse_rfc1738_url data "$url" || return 1
  259. +
  260. +       [[ "${data.scheme}" == ~(Elr)(ssh\+nfs|nfs) ]] || \
  261. +               { print -u2 -f $"%s: Not a nfs:// or ssh+nfs:// url\n" "$0" ; return 1 ; }
  262. +       [[ "${data.host}" != '' ]] || { print -u2 -f $"%s: NFS hostname missing\n" "$0" ; return 1 ; }
  263. +       [[ "${data.uripath}" != '' ]] || { print -u2 -f $"%s: NFS path missing\n" "$0" ; return 1 ; }
  264. +       [[ "${data.uripath}" == /* ]] || { print -u2 -f $"%s: NFS path (%q) must be absolute\n" "$0" "${data.uripath}" ; return 1 ; }
  265. +       [[ "${data.uripath}" != //* ]] || { print -u2 -f $"%s: NFS path (%q) should not start with '//' \n" "$0" "${data.uripath}" ; return 1 ; }
  266. +
  267. +       return 0
  268. +}
  269. +
  270. +
  271. +function urlencodestr
  272. +{
  273. +       set -o nounset
  274. +
  275. +       nameref out_encodedstr=$1
  276. +       typeset in_str="$2"
  277. +       typeset ch ch_hexval dummy
  278. +       integer ch_num
  279. +       typeset url=''
  280. +
  281. +       #
  282. +       # URLs encode non-ASCII characters as UTF-8 on byte-level,
  283. +       # while POSIX shells (ksh93, bash, etc.) operate on
  284. +       # characters (which *MAY* be - like UTF-8 - encoded as
  285. +       # multibyte characters, but may use a different encoding
  286. +       # like ISO8859-1 or GB18030).
  287. +       # The code below solves that by using iconv(1) to
  288. +       # convert everything into UTF-8 bytes, then convert the
  289. +       # bytes via od(1) into pairs of { position, hexadecimal
  290. +       # character value ("hexval") }, and then turn these to
  291. +       # ASCII ("ch") / numeric ASCII ("ch_num") values
  292. +       # (this assumes that the current LC_CTYPE is
  293. +       # ASCII-compatible)
  294. +       #
  295. +       printf '%s' "$in_str" | \
  296. +               iconv -t 'UTF-8' | \
  297. +               od -t x1 -w1 -v | \
  298. +               while read dummy ch_hexval ; do
  299. +               [[ "$ch_hexval" != '' ]] || break
  300. +
  301. +               ch_num="${ printf "%d" "0x$ch_hexval" ; }"
  302. +               if (( ch_num <= 127 )) ; then
  303. +                       typeset ch="${ printf "\x$ch_hexval" ; }"
  304. +               else
  305. +                       #
  306. +                       # character is outside ASCII, shell may
  307. +                       # not be able to represent this
  308. +                       #
  309. +                       [[ -v ch ]] && unset ch
  310. +               fi
  311. +
  312. +               #
  313. +               # From RFC 1738 ("Uniform Resource Locators (URL)"):
  314. +               # unsafe characters in URLS:
  315. +               # "{", "}", "|", "\", "^", "~", "[", "]", and "`"
  316. +               # characters which must always be encoded:
  317. +               # "#", "%"
  318. +               # characters which must be encoded because they have a special meaning:
  319. +               # ";", "/", "?", ":", "@", "=" and "&"
  320. +               # Only alphanumerics, "$-_.+!*'()," and reserved characters
  321. +               # ("/" for nfs://-URLS) are allowed
  322. +               #
  323. +               if (( ch_num > 127 )) || [[ "$ch" != ~(Elr)[/$-_.+!*\'(),[:alnum:]] ]] ; then
  324. +                       url+="%$ch_hexval"
  325. +               else
  326. +                       url+="$ch"
  327. +               fi
  328. +       done
  329. +
  330. +       #printf 'str=%q\n' "$url"
  331. +       out_encodedstr="$url"
  332. +       return 0
  333. +}
  334. +
  335. +
  336. +function hostname_port_path_to_nfsurl
  337. +{
  338. +       set -o nounset
  339. +
  340. +       typeset hostname="$1"
  341. +       integer port="$2"
  342. +       typeset path="$3"
  343. +
  344. +       typeset enc_path
  345. +       typeset enc_hostname
  346. +
  347. +       urlencodestr enc_hostname "$hostname"
  348. +       urlencodestr enc_path "$path"
  349. +       if (( port == 2049 )) ; then
  350. +               printf 'url=nfs://%s/%s\n' "$enc_hostname" "$enc_path"
  351. +       else
  352. +               printf 'url=nfs://%s:%d/%s\n' "$enc_hostname" port "$enc_path"
  353. +       fi
  354. +       return 0
  355. +}
  356. +
  357. +function main
  358. +{
  359. +       set -o nounset
  360. +
  361. +       # fixme: Need better text layout for $ nfsurlconv --man #
  362. +       typeset -r nfsurlconv_usage=$'+
  363. +       [-?\n@(#)\$Id: nfsurlconv (Roland Mainz) 2024-01-31 \$\n]
  364. +       [-author?Roland Mainz <roland.mainz@nrubsig.org>]
  365. +       [+NAME?nfsurlconv - convert hostname,port,path from/to a nfs://-URL]
  366. +       [+DESCRIPTION?\bnfsurlconv\b convert { hostname, port, path } from/to a nfs://-URL.]
  367. +       [D:debug?Enable debugging.]
  368. +
  369. +       hostnameportpath2nfsurl hostname port path
  370. +       hostnamepath2nfsurl hostname path
  371. +       url2hostnameportpath url
  372. +       url2hostportpath url
  373. +       url2compound url
  374. +       --man
  375. +
  376. +       [+EXAMPLES]{
  377. +               [+?Example 1:][+?Convert hostname bbb, port 12049 and path /a/b/c to a nfs://-URL]{
  378. +[+\n$ nfsurlconv hostnameportpath2nfsurl bbb 12049 "/a/b/c"
  379. +url=nfs:://bbb::12049//a/b/c
  380. +]
  381. +}
  382. +               [+?Example 2:][+?Convert URL nfs://bbb:12049//a/b/c to ( hostname=, port=, path= )]{
  383. +[+\n$ nfsurlconv.ksh url2hostnameportpath nfs:://bbb//a/b/c
  384. +hostname=bbb
  385. +port=2049
  386. +path=/a/b/c
  387. +]
  388. +}
  389. +               [+?Example 3:][+?Convert URL nfs://bbb:12049//a/b/c to ( hostport=, path= )]{
  390. +[+\n$ nfsurlconv.ksh url2hostportpath nfs:://bbb//a/b/c
  391. +hostport=bbb
  392. +path=/a/b/c
  393. +]
  394. +}
  395. +       }
  396. +       [+SEE ALSO?\bksh93\b(1),\bssh\b(1),\bmount.nfs\b(8),\bnfs\b(5)]
  397. +       '
  398. +
  399. +       compound c
  400. +       typeset -a c.args
  401. +       integer saved_optind_m1 # saved OPTIND-1
  402. +
  403. +       c.args=( "$@" )
  404. +
  405. +       #
  406. +       # Argument parsing
  407. +       #
  408. +       while getopts -a "${progname}" "${nfsurlconv_usage}" OPT "${c.args[@]}" ; do
  409. +               case "${OPT}" in
  410. +                       'D')
  411. +                               # fixme: Implement debugging option
  412. +                               ;;
  413. +                       *)
  414. +                               usage "${progname}" "${nfsurlconv_usage}"
  415. +                               return $?
  416. +                               ;;
  417. +               esac
  418. +       done
  419. +
  420. +       (( saved_optind_m1=OPTIND-1 ))
  421. +
  422. +       # remove options we just parsed from c.args
  423. +       for ((i=0 ; i < saved_optind_m1 ; i++)) ; do
  424. +               unset c.args[$i]
  425. +       done
  426. +
  427. +       #
  428. +       # c.args mighth be a sparse array (e.g. "([1]=aaa [2]=bbb [4]=ccc)")
  429. +       # right now after we removed processed options/arguments.
  430. +       # For easier processing below we "reflow" the array back to a
  431. +       # normal linear layout (e.g. ([0]=aaa [1]=bbb [2]=ccc)
  432. +       #
  433. +       c.args=( "${c.args[@]}" )
  434. +
  435. +       typeset mode="${c.args[0]-}"
  436. +
  437. +       case "$mode" in
  438. +               # fixme: add "hostportpath2nfsurl"
  439. +               # fixme: add "etcexports2nfsurl"
  440. +               'hostnameportpath2nfsurl')
  441. +                       hostname_port_path_to_nfsurl "${@:2}"
  442. +                       return $?
  443. +                       ;;
  444. +               'hostnamepath2nfsurl')
  445. +                       hostname_port_path_to_nfsurl "${@:2:1}" 2049 "${@:3:1}"
  446. +                       return $?
  447. +                       ;;
  448. +               'url2hostnameportpath')
  449. +                       compound urldata
  450. +
  451. +                       parse_sshnfs_url urldata "${@:2:1}" || return 1
  452. +                       printf 'hostname=%s\n' "${urldata.host}"
  453. +                       printf 'port=%s\n' "${urldata.port-2049}"
  454. +                       printf 'path=%s\n' "${urldata.path-}"
  455. +                       return 0
  456. +                       ;;
  457. +               'url2hostportpath')
  458. +                       compound urldata
  459. +
  460. +                       parse_sshnfs_url urldata "${@:2:1}" || return 1
  461. +                       printf 'hostport=%s\n' "${urldata.hostport}"
  462. +                       printf 'path=%s\n' "${urldata.path-}"
  463. +                       return 0
  464. +                       ;;
  465. +               'url2compound')
  466. +                       compound urldata
  467. +
  468. +                       parse_sshnfs_url urldata "${@:2:1}" || return 1
  469. +                       print -v urldata
  470. +                       return 0
  471. +                       ;;
  472. +               *)
  473. +                       print -u2 -f $"Unknown mode %q\n" "$mode"
  474. +                       usage "${progname}" "${nfsurlconv_usage}"
  475. +                       return 2
  476. +                       ;;
  477. +       esac
  478. +
  479. +       return 2
  480. +}
  481. +
  482. +#
  483. +# main
  484. +#
  485. +builtin cat
  486. +builtin mkdir
  487. +builtin basename
  488. +
  489. +typeset progname="${ basename "${0}" ; }"
  490. +
  491. +main "$@"
  492. +exit $?
  493. +
  494. +# EOF.
  495. --
  496. 2.43.0
  497.  
  498. From 4773de8d49edebd8fcc7a19238ed6b359202ff22 Mon Sep 17 00:00:00 2001
  499. From: Roland Mainz <roland.mainz@nrubsig.org>
  500. Date: Wed, 31 Jan 2024 18:02:57 +0100
  501. Subject: [PATCH 3/6] cygwin: Generate nroff manpages for ksh93 scripts
  502.  
  503. Generate nroff manpages for ksh93 scripts (mount_sshnfs, nfsurlconf)
  504.  
  505. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  506. ---
  507. cygwin/Makefile | 4 ++++
  508.  1 file changed, 4 insertions(+)
  509.  
  510. diff --git a/cygwin/Makefile b/cygwin/Makefile
  511. index 71d933c..bffadaf 100644
  512. --- a/cygwin/Makefile
  513. +++ b/cygwin/Makefile
  514. @@ -63,6 +63,7 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
  515.         mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/lib
  516.         mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/lib/msnfs41client
  517.         mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/usr/src/msnfs41client
  518. +       mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/sbin/usr/share/man/man1
  519.         cp -r $(VS_BUILD_DIR)/nfsd.exe          $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsd_debug.exe
  520.         cp -r $(VS_BUILD_DIR)/nfsd.pdb          $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsd_debug.pdb
  521.         cp -r $(VS_BUILD_DIR)/nfs_mount.*       $(DESTDIR)/cygdrive/c/cygwin64/sbin/.
  522. @@ -85,10 +86,13 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
  523.         @ printf "# Package utilties\n"
  524.         cp $(CYGWIN_MAKEFILE_DIR)/utils/mount_sshnfs/mount_sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
  525.         chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
  526. +       PATH+=":$(DESTDIR)/cygdrive/c/cygwin64/sbin/" \
  527. +               /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
  528.         cp $(CYGWIN_MAKEFILE_DIR)/utils/sshnfs/sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
  529.         chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
  530.         cp $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
  531.         chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
  532. +       /usr/bin/ksh93 $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh --nroff 2>"$(DESTDIR)/cygdrive/c/cygwin64/sbin/usr/share/man/man1/nfsurlconv.1" || true
  533.         @ printf "# Package tests\n"
  534.         cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.exe" $(DESTDIR)/cygdrive/c/cygwin64/bin/winfsinfo.exe
  535.         @ printf "# Package ksh93&co (if available) since Cygwin does not ship with it yet\n"
  536. --
  537. 2.43.0
  538.  
  539. From 8983cf09a157c1fc68ac68a81428d4b6779921cc Mon Sep 17 00:00:00 2001
  540. From: Roland Mainz <roland.mainz@nrubsig.org>
  541. Date: Wed, 31 Jan 2024 18:08:50 +0100
  542. Subject: [PATCH 4/6] bintarball: Update README for nfsurlconv
  543.  
  544. Update README for nfsurlconv+dependicies
  545.  
  546. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  547. ---
  548. cygwin/README.bintarball.txt | 8 ++++++--
  549.  1 file changed, 6 insertions(+), 2 deletions(-)
  550.  
  551. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  552. index 7241d35..b66c34b 100644
  553. --- a/cygwin/README.bintarball.txt
  554. +++ b/cygwin/README.bintarball.txt
  555. @@ -24,8 +24,10 @@ NFSv4.1 client and filesystem driver for Windows 10/11
  556.  - Support for custom ports (NFSv4 defaults to TCP port 2049, this
  557.      client can use different ports per mount)
  558.  
  559. -- Support for nfs://-URL, including custom ports and raw IPv6
  560. -    addresses
  561. +- Support for nfs://-URL
  562. +    - including custom ports and raw IPv6 addresses
  563. +    - nfs://-URL conversion utility (/usr/bin/nfsurlconv) to convert
  564. +        URLs, including non-ASCII/Unicode characters in mount path
  565.  
  566.  - Support ssh forwarding, e.g. mounting NFSv4 filesystems via ssh
  567.      tunnel
  568. @@ -73,6 +75,8 @@ NFSv4.1 client and filesystem driver for Windows 10/11
  569.          grep
  570.          hostname
  571.          less
  572. +        libiconv
  573. +        libiconv2
  574.          pax
  575.          pbzip2
  576.          procps-ng
  577. --
  578. 2.43.0
  579.  
  580. From 1edbbcf26d40ac89d5c595b4ed7e0dd28f7af3bc Mon Sep 17 00:00:00 2001
  581. From: Roland Mainz <roland.mainz@nrubsig.org>
  582. Date: Thu, 1 Feb 2024 13:53:17 +0100
  583. Subject: [PATCH 5/6] sys: Remove |MmIsAddressValid()| from hot codepath
  584.  
  585. Remove |MmIsAddressValid(entry->filename)| from |DEBUG_MARSHAL_HEADER|
  586. codepath and only enable it if |DEBUG_MARSHAL_HEADER_VALID_FILENAME|
  587. is set (off for now), as |MmIsAddressValid()| is expensive and sits
  588. in a always-used codepath.
  589.  
  590. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  591. ---
  592. sys/nfs41_driver.c | 11 +++++++++--
  593.  1 file changed, 9 insertions(+), 2 deletions(-)
  594.  
  595. diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
  596. index 754b704..816dd26 100644
  597. --- a/sys/nfs41_driver.c
  598. +++ b/sys/nfs41_driver.c
  599. @@ -45,6 +45,7 @@
  600.  
  601.  /* debugging printout defines */
  602.  #define DEBUG_MARSHAL_HEADER
  603. +//#define DEBUG_MARSHAL_HEADER_VALID_FILENAME
  604.  #define DEBUG_MARSHAL_DETAIL
  605.  //#define DEBUG_OPEN
  606.  //#define DEBUG_CLOSE
  607. @@ -602,14 +603,20 @@ NTSTATUS marshal_nfs41_header(
  608.      tmp += sizeof(HANDLE);
  609.  
  610.  #ifdef DEBUG_MARSHAL_HEADER
  611. +#ifdef DEBUG_MARSHAL_HEADER_VALID_FILENAME
  612.      if (MmIsAddressValid(entry->filename))
  613. +#endif
  614.          DbgP("[upcall header] xid=%lld opcode='%s' filename='%wZ' version=%d "
  615.              "session=0x%x open_state=0x%x\n", entry->xid,
  616.              ENTRY_OPCODE2STRING(entry), entry->filename,
  617.              entry->version, entry->session, entry->open_state);
  618. -    else
  619. +#ifdef DEBUG_MARSHAL_HEADER_VALID_FILENAME
  620. +    else {
  621. +        DbgP("[upcall header] Invalid filename %p\n", entry);
  622.          status = STATUS_INTERNAL_ERROR;
  623. -#endif
  624. +    }
  625. +#endif /* DEBUG_MARSHAL_HEADER_VALID_FILENAME */
  626. +#endif /* DEBUG_MARSHAL_HEADER */
  627.  out:
  628.      return status;
  629.  }
  630. --
  631. 2.43.0
  632.  
  633. From 8e57787a0343db7257e1bbcbfeb5226c4c677b08 Mon Sep 17 00:00:00 2001
  634. From: Roland Mainz <roland.mainz@nrubsig.org>
  635. Date: Thu, 1 Feb 2024 18:27:51 +0100
  636. Subject: [PATCH 6/6] Fix Windows 32bit build and use |UNICODE|+|_UNICODE|
  637.  consistently
  638.  
  639. Fix Windows 32bit build and use cpp defines |UNICODE|+|_UNICODE|
  640. consistently across all platforms+build configurations.
  641.  
  642. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  643. ---
  644. build.vc19/libtirpc/libtirpc.vcxproj       |  4 ++--
  645.  build.vc19/nfs41_np/nfs41_np.vcxproj       |  4 ++--
  646.  build.vc19/nfs_install/nfs_install.vcxproj |  4 ++--
  647.  build.vc19/nfs_mount/nfs_mount.vcxproj     |  4 ++--
  648.  build.vc19/nfsd/nfsd.vcxproj               |  4 ++--
  649.  daemon/acl.c                               |  4 ++--
  650.  daemon/delegation.c                        |  2 +-
  651.  daemon/ea.c                                |  2 +-
  652.  daemon/idmap.c                             | 10 +++++-----
  653.  daemon/nfs41_daemon.c                      |  8 ++++----
  654.  daemon/nfs41_server.c                      |  9 ++++++++-
  655.  daemon/service.c                           |  3 +++
  656.  daemon/sid.c                               |  4 ++--
  657.  daemon/util.c                              |  4 ++--
  658.  install/nfsreginst.c                       |  2 +-
  659.  libtirpc/src/auth_sspi.c                   |  4 +++-
  660.  mount/options.c                            |  2 +-
  661.  17 files changed, 43 insertions(+), 31 deletions(-)
  662.  
  663. diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
  664. index 37bc712..65b32f8 100644
  665. --- a/build.vc19/libtirpc/libtirpc.vcxproj
  666. +++ b/build.vc19/libtirpc/libtirpc.vcxproj
  667. @@ -108,7 +108,7 @@
  668.        </PrecompiledHeader>
  669.        <WarningLevel>Level3</WarningLevel>
  670.        <Optimization>Disabled</Optimization>
  671. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  672. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  673.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  674.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  675.        <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
  676. @@ -155,7 +155,7 @@
  677.        <Optimization>MaxSpeed</Optimization>
  678.        <FunctionLevelLinking>true</FunctionLevelLinking>
  679.        <IntrinsicFunctions>true</IntrinsicFunctions>
  680. -      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  681. +      <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  682.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  683.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  684.        <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
  685. diff --git a/build.vc19/nfs41_np/nfs41_np.vcxproj b/build.vc19/nfs41_np/nfs41_np.vcxproj
  686. index 3efe8f6..5c4009e 100644
  687. --- a/build.vc19/nfs41_np/nfs41_np.vcxproj
  688. +++ b/build.vc19/nfs41_np/nfs41_np.vcxproj
  689. @@ -104,7 +104,7 @@
  690.        </PrecompiledHeader>
  691.        <WarningLevel>Level3</WarningLevel>
  692.        <Optimization>Disabled</Optimization>
  693. -      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  694. +      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  695.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  696.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  697.        <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
  698. @@ -144,7 +144,7 @@
  699.        <Optimization>MaxSpeed</Optimization>
  700.        <FunctionLevelLinking>true</FunctionLevelLinking>
  701.        <IntrinsicFunctions>true</IntrinsicFunctions>
  702. -      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  703. +      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  704.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  705.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  706.        <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
  707. diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
  708. index 898ba94..47e2ec7 100644
  709. --- a/build.vc19/nfs_install/nfs_install.vcxproj
  710. +++ b/build.vc19/nfs_install/nfs_install.vcxproj
  711. @@ -103,7 +103,7 @@
  712.        </PrecompiledHeader>
  713.        <WarningLevel>Level3</WarningLevel>
  714.        <Optimization>Disabled</Optimization>
  715. -      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  716. +      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  717.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  718.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  719.        <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
  720. @@ -141,7 +141,7 @@
  721.        <Optimization>MaxSpeed</Optimization>
  722.        <FunctionLevelLinking>true</FunctionLevelLinking>
  723.        <IntrinsicFunctions>true</IntrinsicFunctions>
  724. -      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  725. +      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  726.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  727.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  728.        <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
  729. diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
  730. index ea482e2..c4cb8d6 100644
  731. --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
  732. +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
  733. @@ -104,7 +104,7 @@
  734.        </PrecompiledHeader>
  735.        <WarningLevel>Level3</WarningLevel>
  736.        <Optimization>Disabled</Optimization>
  737. -      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  738. +      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  739.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  740.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  741.        <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
  742. @@ -144,7 +144,7 @@
  743.        <Optimization>MaxSpeed</Optimization>
  744.        <FunctionLevelLinking>true</FunctionLevelLinking>
  745.        <IntrinsicFunctions>true</IntrinsicFunctions>
  746. -      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  747. +      <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  748.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  749.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  750.        <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
  751. diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
  752. index d506140..e4517f6 100644
  753. --- a/build.vc19/nfsd/nfsd.vcxproj
  754. +++ b/build.vc19/nfsd/nfsd.vcxproj
  755. @@ -107,7 +107,7 @@
  756.        </PrecompiledHeader>
  757.        <WarningLevel>Level3</WarningLevel>
  758.        <Optimization>Disabled</Optimization>
  759. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  760. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;STANDALONE_NFSD;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  761.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  762.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  763.        <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
  764. @@ -152,7 +152,7 @@
  765.        <Optimization>MaxSpeed</Optimization>
  766.        <FunctionLevelLinking>true</FunctionLevelLinking>
  767.        <IntrinsicFunctions>true</IntrinsicFunctions>
  768. -      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  769. +      <PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  770.        <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  771.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  772.        <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
  773. diff --git a/daemon/acl.c b/daemon/acl.c
  774. index 583f7c6..a9e7e46 100644
  775. --- a/daemon/acl.c
  776. +++ b/daemon/acl.c
  777. @@ -492,7 +492,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  778.              return ERROR_SUCCESS;
  779.      }
  780.  
  781. -    status = LookupAccountSid(NULL, sid, who, &size, tmp_buf,
  782. +    status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
  783.          &tmp_size, &sid_type);
  784.      dprintf(ACLLVL, "map_nfs4ace_who: LookupAccountSid returned %d GetLastError "
  785.              "%d name len %d domain len %d\n", status, GetLastError(),
  786. @@ -510,7 +510,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
  787.      tmp_buf = malloc(tmp_size);
  788.      if (tmp_buf == NULL)
  789.          goto out_free_who;
  790. -    status = LookupAccountSid(NULL, sid, who, &size, tmp_buf,
  791. +    status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
  792.                                  &tmp_size, &sid_type);
  793.      free(tmp_buf);
  794.      if (!status) {
  795. diff --git a/daemon/delegation.c b/daemon/delegation.c
  796. index e26c2af..bd04d68 100644
  797. --- a/daemon/delegation.c
  798. +++ b/daemon/delegation.c
  799. @@ -279,7 +279,7 @@ static int delegation_return(
  800.          uint32_t length;
  801.          dprintf(1, "delegation_return: making a downcall for srv_open=%x\n",
  802.              deleg->srv_open);
  803. -        pipe = CreateFile(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
  804. +        pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
  805.                  FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
  806.          if (pipe == INVALID_HANDLE_VALUE) {
  807.              eprintf("delegation_return: Unable to open downcall pipe %d\n",
  808. diff --git a/daemon/ea.c b/daemon/ea.c
  809. index baeb43a..a988d92 100644
  810. --- a/daemon/ea.c
  811. +++ b/daemon/ea.c
  812. @@ -605,7 +605,7 @@ static int handle_getexattr(void *daemon_context, nfs41_upcall *upcall)
  813.          }
  814.  
  815.          ea->EaNameLength = query->EaNameLength;
  816. -        StringCchCopy(ea->EaName, (size_t)ea->EaNameLength + 1, query->EaName);
  817. +        StringCchCopyA(ea->EaName, (size_t)ea->EaNameLength + 1, query->EaName);
  818.          ea->Flags = 0;
  819.  
  820.          /* read the value from file */
  821. diff --git a/daemon/idmap.c b/daemon/idmap.c
  822. index 169de15..202d852 100644
  823. --- a/daemon/idmap.c
  824. +++ b/daemon/idmap.c
  825. @@ -574,7 +574,7 @@ static int idmap_filter(
  826.          if (FAILED(StringCchPrintfA(filter, filter_len,
  827.                  "(&(objectClass=%s)(%s=%s))",
  828.                  config->classes[lookup->klass],
  829. -                config->attributes[lookup->attr], lookup->value))) {
  830. +                config->attributes[lookup->attr], (const char *)lookup->value))) {
  831.              status = ERROR_BUFFER_OVERFLOW;
  832.              eprintf("ldap filter buffer overflow: '%s=%s'\n",
  833.                  config->attributes[lookup->attr], lookup->value);
  834. @@ -607,7 +607,7 @@ static int idmap_query_attrs(
  835.          goto out;
  836.  
  837.      /* send the ldap query */
  838. -    status = ldap_search_st(context->ldap, config->base,
  839. +    status = ldap_search_stA(context->ldap, config->base,
  840.          LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, &res);
  841.      if (status) {
  842.          eprintf("ldap search for '%s' failed with %d: %s\n",
  843. @@ -628,7 +628,7 @@ static int idmap_query_attrs(
  844.      /* fetch the attributes */
  845.      for (i = 0; i < len; i++) {
  846.          if (ATTR_ISSET(attributes, i)) {
  847. -            values[i] = ldap_get_values(context->ldap,
  848. +            values[i] = ldap_get_valuesA(context->ldap,
  849.                  entry, config->attributes[i]);
  850.  
  851.              /* fail if required attributes are missing */
  852. @@ -801,7 +801,7 @@ static int idmap_lookup_user(
  853.      }
  854.  out_free_values:
  855.      for (i = 0; i < NUM_ATTRIBUTES; i++)
  856. -        ldap_value_free(values[i]);
  857. +        ldap_value_freeA(values[i]);
  858.  out:
  859.      return status;
  860.  }
  861. @@ -902,7 +902,7 @@ static int idmap_lookup_group(
  862.      }
  863.  out_free_values:
  864.      for (i = 0; i < NUM_ATTRIBUTES; i++)
  865. -        ldap_value_free(values[i]);
  866. +        ldap_value_freeA(values[i]);
  867.  out:
  868.      return status;
  869.  }
  870. diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
  871. index 9a06c44..82c337f 100644
  872. --- a/daemon/nfs41_daemon.c
  873. +++ b/daemon/nfs41_daemon.c
  874. @@ -100,7 +100,7 @@ static unsigned int WINAPI thread_main(void *args)
  875.      DWORD inbuf_len = UPCALL_BUF_SIZE, outbuf_len;
  876.      nfs41_upcall upcall;
  877.  
  878. -    pipe = CreateFile(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  879. +    pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  880.          FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  881.          0, NULL);
  882.      if (pipe == INVALID_HANDLE_VALUE)
  883. @@ -313,7 +313,7 @@ static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
  884.                  }
  885.              }
  886.              else
  887. -                fprintf(stderr, "Unrecognized option '%s', disregarding.\n", argv[i]);
  888. +                fprintf(stderr, "Unrecognized option '%S', disregarding.\n", argv[i]);
  889.          }
  890.      }
  891.  
  892. @@ -339,7 +339,7 @@ static void print_getaddrinfo(struct addrinfo *ptr)
  893.              inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr));
  894.          break;
  895.      case AF_INET6:
  896. -        if (WSAAddressToString((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
  897. +        if (WSAAddressToStringA((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
  898.                  NULL, ipstringbuffer, &ipbufferlength))
  899.              dprintf(1, "WSAAddressToString failed with %u\n", WSAGetLastError());
  900.          else    
  901. @@ -561,7 +561,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  902.      NFS41D_VERSION = GetTickCount();
  903.      dprintf(1, "NFS41 Daemon starting: version %d\n", NFS41D_VERSION);
  904.  
  905. -    pipe = CreateFile(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  906. +    pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
  907.          FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  908.          0, NULL);
  909.      if (pipe == INVALID_HANDLE_VALUE)
  910. diff --git a/daemon/nfs41_server.c b/daemon/nfs41_server.c
  911. index 3a09935..844215b 100644
  912. --- a/daemon/nfs41_server.c
  913. +++ b/daemon/nfs41_server.c
  914. @@ -279,7 +279,7 @@ int nfs41_server_resolve(
  915.  {
  916.      int status = ERROR_BAD_NET_NAME;
  917.      char service[16];
  918. -    struct addrinfoexA hints = { 0 }, *res, *info;
  919. +    ADDRINFOEXA hints = { 0 }, *res, *info;
  920.      struct netconfig *nconf;
  921.      struct netbuf addr;
  922.      char *netid, *uaddr;
  923. @@ -368,6 +368,13 @@ retry_getaddrinfoex:
  924.              break;
  925.          }
  926.      }
  927. +/*
  928. + * BUG: WS2tcpip.h somenow mapps FreeAddrInfoExA() to use the wide-char version
  929. + */
  930. +#define WINDOWS_WS2TCPIP_H_BUG 1
  931. +#ifdef WINDOWS_WS2TCPIP_H_BUG
  932. +#undef FreeAddrInfoEx
  933. +#endif
  934.      FreeAddrInfoEx(res);
  935.  out:
  936.      if (status) {
  937. diff --git a/daemon/service.c b/daemon/service.c
  938. index 2b19668..81d9072 100644
  939. --- a/daemon/service.c
  940. +++ b/daemon/service.c
  941. @@ -27,6 +27,9 @@ FUNCTIONS:
  942.  #include <stdlib.h>
  943.  #include <process.h>
  944.  #include <tchar.h>
  945. +#ifdef UNICODE
  946. +#include <shellapi.h>
  947. +#endif
  948.  
  949.  #include "service.h"
  950.  
  951. diff --git a/daemon/sid.c b/daemon/sid.c
  952. index 412b33f..5326994 100644
  953. --- a/daemon/sid.c
  954. +++ b/daemon/sid.c
  955. @@ -351,7 +351,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  956.      }
  957.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  958.  
  959. -    status = LookupAccountName(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
  960. +    status = LookupAccountNameA(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
  961.      dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): LookupAccountName returned %d "
  962.          "GetLastError %d name len %d domain len %d\n",
  963.          query, name, status, GetLastError(), *sid_len, tmp);
  964. @@ -369,7 +369,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  965.          tmp_buf = (LPSTR) malloc(tmp);
  966.          if (tmp_buf == NULL)
  967.              goto out_free_sid;
  968. -        status = LookupAccountName(NULL, name, *sid, sid_len, tmp_buf,
  969. +        status = LookupAccountNameA(NULL, name, *sid, sid_len, tmp_buf,
  970.                                      &tmp, &sid_type);
  971.          free(tmp_buf);
  972.          if (!status) {
  973. diff --git a/daemon/util.c b/daemon/util.c
  974. index 95e0d7f..cae4130 100644
  975. --- a/daemon/util.c
  976. +++ b/daemon/util.c
  977. @@ -443,11 +443,11 @@ int create_silly_rename(
  978.      StringCchCopyNA(name, NFS41_MAX_COMPONENT_LEN+1, silly->name, silly->len);
  979.  
  980.      tmp = (char*)silly->name;
  981. -    StringCchPrintf(tmp, end - tmp, ".%s.", name);
  982. +    StringCchPrintfA(tmp, end - tmp, ".%s.", name);
  983.      tmp += (size_t)silly->len + 2L;
  984.  
  985.      for (i = 0; i < 16; i++, tmp++)
  986. -        StringCchPrintf(tmp, end - tmp, "%x", fhmd5[i]);
  987. +        StringCchPrintfA(tmp, end - tmp, "%x", fhmd5[i]);
  988.  
  989.      path->len = path->len + extra_len;
  990.      silly->len = silly->len + extra_len;
  991. diff --git a/install/nfsreginst.c b/install/nfsreginst.c
  992. index 66e1997..6e1a696 100644
  993. --- a/install/nfsreginst.c
  994. +++ b/install/nfsreginst.c
  995. @@ -102,7 +102,7 @@ BOOL RdrSetProviderOrderString( __in LPTSTR OrderString )
  996.  
  997.      if ( CreateKey( PROVIDER_ORDER_KEY, &hOrderKey ) )
  998.      {
  999. -        ProviderOrderKeyValues[0].dwLength = ( _tcsclen( OrderString ) + 1 ) * sizeof( TCHAR );
  1000. +        ProviderOrderKeyValues[0].dwLength = (DWORD)(( _tcsclen( OrderString ) + 1 ) * sizeof( TCHAR ));
  1001.          ProviderOrderKeyValues[0].pvValue = OrderString;
  1002.          WriteRegistryKeyValues( hOrderKey,
  1003.                                  sizeof(ProviderOrderKeyValues) / sizeof(REGENTRY),
  1004. diff --git a/libtirpc/src/auth_sspi.c b/libtirpc/src/auth_sspi.c
  1005. index c2173fa..72f6720 100644
  1006. --- a/libtirpc/src/auth_sspi.c
  1007. +++ b/libtirpc/src/auth_sspi.c
  1008. @@ -870,7 +870,9 @@ void print_rpc_gss_sec(struct rpc_sspi_sec *ptr)
  1009.         fprintf(fd_out, "     qop: %d\n", ptr->qop);
  1010.         fprintf(fd_out, "     service: %d\n", ptr->svc);
  1011.         fprintf(fd_out, "     cred(%p) = { dwLower=%lld, dwUpper=%lld} \n",
  1012. -               &ptr->cred, ptr->cred.dwLower, ptr->cred.dwUpper);
  1013. +               &ptr->cred,
  1014. +               (long long)ptr->cred.dwLower,
  1015. +               (long long)ptr->cred.dwUpper);
  1016.  }
  1017.  
  1018.  void print_negotiated_attrs(PCtxtHandle ctx)
  1019. diff --git a/mount/options.c b/mount/options.c
  1020. index 11bdca9..df8dd75 100644
  1021. --- a/mount/options.c
  1022. +++ b/mount/options.c
  1023. @@ -164,7 +164,7 @@ static void RecursivePrintEaInformation(
  1024.          TEXT("EaValueLength:       %5u\n")
  1025.          TEXT("EaName:   %16ls\n")
  1026.          TEXT("EaValue:  %16ls\n\n"),
  1027. -        (ULONG_PTR)EA % sizeof(ULONG),
  1028. +        (unsigned long)((ULONG_PTR)EA % sizeof(ULONG)),
  1029.          EA->NextEntryOffset,
  1030.          EA->Flags,
  1031.          EA->EaNameLength,
  1032. --
  1033. 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