- From 2155b0570e4f455f6adc35a737b6e8f7efad712e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 31 Jan 2024 17:31:19 +0100
- Subject: [PATCH 1/6] mount_sshnfs,sshnfs: Update to upstream 20240130
- Update { mount_sshnfs.ksh, sshnfs.ksh } to upstream version
- 20240130
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/utils/mount_sshnfs/mount_sshnfs.ksh | 25 +++++++++++++---------
- cygwin/utils/sshnfs/sshnfs.ksh | 5 +++++
- 2 files changed, 20 insertions(+), 10 deletions(-)
- diff --git a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- index 52c3db0..c1dc4b5 100644
- --- a/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- +++ b/cygwin/utils/mount_sshnfs/mount_sshnfs.ksh
- @@ -45,9 +45,9 @@
- #
- # For more examples see help and subcommand help:
- -# $ mount_sshnfs.ksh --man
- -# $ mount_sshnfs.ksh mount --man
- -# $ mount_sshnfs.ksh umount --man
- +# $ mount_sshnfs --man
- +# $ mount_sshnfs mount --man
- +# $ mount_sshnfs umount --man
- #
- #
- @@ -291,6 +291,10 @@ function parse_rfc1738_url
- [[ "${.sh.match[7]-}" != '' ]] && integer data.port="${.sh.match[7]}"
- [[ "${.sh.match[8]-}" != '' ]] && data.uripath="${.sh.match[8]}"
- + if [[ -v data.uripath ]] ; then
- + data.path="${ printf "${data.uripath//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}" ; }"
- + fi
- +
- return 0
- }
- @@ -363,7 +367,7 @@ function cmd_mount
- # fixme: Need better text layout for $ mount_sshnfs mount --man #
- typeset -r mount_sshnfs_cmdmount_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-01-29 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs mount (Roland Mainz) 2024-01-31 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs mount - mount NFSv4 filesystem through ssh
- tunnel]
- @@ -729,7 +733,7 @@ function cmd_umount
- typeset mydebug=false # fixme: should be "bool" for ksh93v
- # fixme: Need better text layout for $ mount_sshnfs mount --man #
- typeset -r mount_sshnfs_cmdumount_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-01-29 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs umount (Roland Mainz) 2024-01-31 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs umount - unmount NFSv4 filesystem mounted
- via mount_sshnfs mount]
- @@ -833,7 +837,7 @@ function main
- # fixme: Need better text layout for $ mount_sshnfs --man #
- typeset -r mount_sshnfs_usage=$'+
- - [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-01-29 \$\n]
- + [-?\n@(#)\$Id: mount_sshnfs (Roland Mainz) 2024-01-31 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mount_sshnfs - mount/umount NFSv4 filesystem via ssh
- tunnel]
- @@ -845,18 +849,19 @@ function main
- umount [options]
- status [options]
- restart_forwarding [options]
- + --man
- [+EXAMPLES]{
- [+?Example 1:][+?Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz"]{
- [+\n# mkdir -p /foobarmnt
- -# ksh mount_sshnfs.ksh mount ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- -# mount_sshnfs.ksh umount /foobarmnt
- +# mount_sshnfs mount ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- +# mount_sshnfs umount /foobarmnt
- ]
- }
- [+?Example 2:][+?Mount&&unmount /export/home/rmainz on NFS server "/export/home/rmainz" via SSH jumphost rmainz@10.49.20.131]{
- [+\n# mkdir -p /foobarmnt
- -# ksh mount_sshnfs.ksh mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- -# mount_sshnfs.ksh umount /foobarmnt
- +# mount_sshnfs mount -o ro,mount_sshnfs_jumphost=rmainz@10.49.20.131 ssh+nfs:://rmainz@derfwpc5131//export/home/rmainz /foobarmnt
- +# mount_sshnfs umount /foobarmnt
- ]
- }
- }
- diff --git a/cygwin/utils/sshnfs/sshnfs.ksh b/cygwin/utils/sshnfs/sshnfs.ksh
- index 2f2f64e..32b8668 100644
- --- a/cygwin/utils/sshnfs/sshnfs.ksh
- +++ b/cygwin/utils/sshnfs/sshnfs.ksh
- @@ -221,6 +221,7 @@ function netstat_find_next_free_local_tcp_port
- return 1
- }
- +
- #
- # parse_rfc1738_url - parse RFC 1838 URLs
- #
- @@ -272,6 +273,10 @@ function parse_rfc1738_url
- [[ "${.sh.match[7]-}" != '' ]] && integer data.port="${.sh.match[7]}"
- [[ "${.sh.match[8]-}" != '' ]] && data.uripath="${.sh.match[8]}"
- + if [[ -v data.uripath ]] ; then
- + data.path="${ printf "${data.uripath//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}" ; }"
- + fi
- +
- return 0
- }
- --
- 2.43.0
- From f3d356bb355c12810082c90e2afa16284909becc Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 31 Jan 2024 17:41:53 +0100
- Subject: [PATCH 2/6] cygwin: Add nfsurlconv.ksh script to convert from/to
- nfs://-URLs
- Add nfsurlconv.ksh script to convert from/to nfs://-URLs
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/Makefile | 2 +
- cygwin/utils/nfsurlconv/nfsurlconv.ksh | 341 +++++++++++++++++++++++++
- 2 files changed, 343 insertions(+)
- create mode 100644 cygwin/utils/nfsurlconv/nfsurlconv.ksh
- diff --git a/cygwin/Makefile b/cygwin/Makefile
- index 0374429..71d933c 100644
- --- a/cygwin/Makefile
- +++ b/cygwin/Makefile
- @@ -87,6 +87,8 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
- chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
- cp $(CYGWIN_MAKEFILE_DIR)/utils/sshnfs/sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
- chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
- + cp $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
- + chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
- @ printf "# Package tests\n"
- cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.exe" $(DESTDIR)/cygdrive/c/cygwin64/bin/winfsinfo.exe
- @ printf "# Package ksh93&co (if available) since Cygwin does not ship with it yet\n"
- diff --git a/cygwin/utils/nfsurlconv/nfsurlconv.ksh b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- new file mode 100644
- index 0000000..97db401
- --- /dev/null
- +++ b/cygwin/utils/nfsurlconv/nfsurlconv.ksh
- @@ -0,0 +1,341 @@
- +#!/bin/ksh93
- +
- +#
- +# MIT License
- +#
- +# Copyright (c) 2024 Roland Mainz <roland.mainz@nrubsig.org>
- +#
- +# Permission is hereby granted, free of charge, to any person obtaining a copy
- +# of this software and associated documentation files (the "Software"), to deal
- +# in the Software without restriction, including without limitation the rights
- +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- +# copies of the Software, and to permit persons to whom the Software is
- +# furnished to do so, subject to the following conditions:
- +#
- +# The above copyright notice and this permission notice shall be included in all
- +# copies or substantial portions of the Software.
- +#
- +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- +# SOFTWARE.
- +#
- +
- +#
- +# nfsurlconv.ksh - convert host/port/path from/to a nfs://-URL
- +
- +#
- +# Written by Roland Mainz <roland.mainz@nrubsig.org>
- +#
- +
- +function usage
- +{
- + (( OPTIND=0 ))
- + getopts -a "${1}" "${2}" OPT '-?'
- + return 2
- +}
- +
- +#
- +# parse_rfc1738_url - parse RFC 1838 URLs
- +#
- +# Output variables are named after RFC 1838 Section 5 ("BNF for
- +# specific URL schemes")
- +#
- +function parse_rfc1738_url
- +{
- + set -o nounset
- +
- + typeset url="$2"
- + typeset leftover
- + nameref data="$1" # output compound variable
- +
- + # ~(E) is POSIX extended regular expression matching (instead
- + # of shell pattern), "x" means "multiline", "l" means "left
- + # anchor", "r" means "right anchor"
- + leftover="${url/~(Elrx)
- + (.+?) # scheme
- + :\/\/ # '://'
- + ( # login
- + (?:
- + (.+?) # user (optional)
- + (?::(.+))? # password (optional)
- + @
- + )?
- + ( # hostport
- + (.+?) # host
- + (?::([[:digit:]]+))? # port (optional)
- + )
- + )
- + (?:\/(.*?))?/X}" # path (optional)
- +
- + # All parsed data should be captured via eregex in .sh.match - if
- + # there is anything left (except the 'X') then the input string did
- + # not properly match the eregex
- + [[ "$leftover" == 'X' ]] ||
- + { print -u2 -f $"%s: Parser error, leftover=%q\n" \
- + "$0" "$leftover" ; return 1 ; }
- +
- + data.url="${.sh.match[0]}"
- + data.scheme="${.sh.match[1]}"
- + data.login="${.sh.match[2]}"
- + # FIXME: This should use [[ ! -v .sh.match[3] ]], but ksh93u has bugs
- + [[ "${.sh.match[3]-}" != '' ]] && data.user="${.sh.match[3]}"
- + [[ "${.sh.match[4]-}" != '' ]] && data.password="${.sh.match[4]}"
- + data.hostport="${.sh.match[5]}"
- + data.host="${.sh.match[6]}"
- + [[ "${.sh.match[7]-}" != '' ]] && integer data.port="${.sh.match[7]}"
- + [[ "${.sh.match[8]-}" != '' ]] && data.uripath="${.sh.match[8]}"
- +
- + if [[ -v data.uripath ]] ; then
- + data.path="${ printf "${data.uripath//~(E)(?:%([[:xdigit:]][[:xdigit:]]))/\\x}" ; }"
- + fi
- +
- + return 0
- +}
- +
- +
- +function parse_sshnfs_url
- +{
- + typeset url="$2"
- + nameref data="$1"
- +
- + parse_rfc1738_url data "$url" || return 1
- +
- + [[ "${data.scheme}" == ~(Elr)(ssh\+nfs|nfs) ]] || \
- + { print -u2 -f $"%s: Not a nfs:// or ssh+nfs:// url\n" "$0" ; return 1 ; }
- + [[ "${data.host}" != '' ]] || { print -u2 -f $"%s: NFS hostname missing\n" "$0" ; return 1 ; }
- + [[ "${data.uripath}" != '' ]] || { print -u2 -f $"%s: NFS path missing\n" "$0" ; return 1 ; }
- + [[ "${data.uripath}" == /* ]] || { print -u2 -f $"%s: NFS path (%q) must be absolute\n" "$0" "${data.uripath}" ; return 1 ; }
- + [[ "${data.uripath}" != //* ]] || { print -u2 -f $"%s: NFS path (%q) should not start with '//' \n" "$0" "${data.uripath}" ; return 1 ; }
- +
- + return 0
- +}
- +
- +
- +function urlencodestr
- +{
- + set -o nounset
- +
- + nameref out_encodedstr=$1
- + typeset in_str="$2"
- + typeset ch ch_hexval dummy
- + integer ch_num
- + typeset url=''
- +
- + #
- + # URLs encode non-ASCII characters as UTF-8 on byte-level,
- + # while POSIX shells (ksh93, bash, etc.) operate on
- + # characters (which *MAY* be - like UTF-8 - encoded as
- + # multibyte characters, but may use a different encoding
- + # like ISO8859-1 or GB18030).
- + # The code below solves that by using iconv(1) to
- + # convert everything into UTF-8 bytes, then convert the
- + # bytes via od(1) into pairs of { position, hexadecimal
- + # character value ("hexval") }, and then turn these to
- + # ASCII ("ch") / numeric ASCII ("ch_num") values
- + # (this assumes that the current LC_CTYPE is
- + # ASCII-compatible)
- + #
- + printf '%s' "$in_str" | \
- + iconv -t 'UTF-8' | \
- + od -t x1 -w1 -v | \
- + while read dummy ch_hexval ; do
- + [[ "$ch_hexval" != '' ]] || break
- +
- + ch_num="${ printf "%d" "0x$ch_hexval" ; }"
- + if (( ch_num <= 127 )) ; then
- + typeset ch="${ printf "\x$ch_hexval" ; }"
- + else
- + #
- + # character is outside ASCII, shell may
- + # not be able to represent this
- + #
- + [[ -v ch ]] && unset ch
- + fi
- +
- + #
- + # From RFC 1738 ("Uniform Resource Locators (URL)"):
- + # unsafe characters in URLS:
- + # "{", "}", "|", "\", "^", "~", "[", "]", and "`"
- + # characters which must always be encoded:
- + # "#", "%"
- + # characters which must be encoded because they have a special meaning:
- + # ";", "/", "?", ":", "@", "=" and "&"
- + # Only alphanumerics, "$-_.+!*'()," and reserved characters
- + # ("/" for nfs://-URLS) are allowed
- + #
- + if (( ch_num > 127 )) || [[ "$ch" != ~(Elr)[/$-_.+!*\'(),[:alnum:]] ]] ; then
- + url+="%$ch_hexval"
- + else
- + url+="$ch"
- + fi
- + done
- +
- + #printf 'str=%q\n' "$url"
- + out_encodedstr="$url"
- + return 0
- +}
- +
- +
- +function hostname_port_path_to_nfsurl
- +{
- + set -o nounset
- +
- + typeset hostname="$1"
- + integer port="$2"
- + typeset path="$3"
- +
- + typeset enc_path
- + typeset enc_hostname
- +
- + urlencodestr enc_hostname "$hostname"
- + urlencodestr enc_path "$path"
- + if (( port == 2049 )) ; then
- + printf 'url=nfs://%s/%s\n' "$enc_hostname" "$enc_path"
- + else
- + printf 'url=nfs://%s:%d/%s\n' "$enc_hostname" port "$enc_path"
- + fi
- + return 0
- +}
- +
- +function main
- +{
- + set -o nounset
- +
- + # fixme: Need better text layout for $ nfsurlconv --man #
- + typeset -r nfsurlconv_usage=$'+
- + [-?\n@(#)\$Id: nfsurlconv (Roland Mainz) 2024-01-31 \$\n]
- + [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- + [+NAME?nfsurlconv - convert hostname,port,path from/to a nfs://-URL]
- + [+DESCRIPTION?\bnfsurlconv\b convert { hostname, port, path } from/to a nfs://-URL.]
- + [D:debug?Enable debugging.]
- +
- + hostnameportpath2nfsurl hostname port path
- + hostnamepath2nfsurl hostname path
- + url2hostnameportpath url
- + url2hostportpath url
- + url2compound url
- + --man
- +
- + [+EXAMPLES]{
- + [+?Example 1:][+?Convert hostname bbb, port 12049 and path /a/b/c to a nfs://-URL]{
- +[+\n$ nfsurlconv hostnameportpath2nfsurl bbb 12049 "/a/b/c"
- +url=nfs:://bbb::12049//a/b/c
- +]
- +}
- + [+?Example 2:][+?Convert URL nfs://bbb:12049//a/b/c to ( hostname=, port=, path= )]{
- +[+\n$ nfsurlconv.ksh url2hostnameportpath nfs:://bbb//a/b/c
- +hostname=bbb
- +port=2049
- +path=/a/b/c
- +]
- +}
- + [+?Example 3:][+?Convert URL nfs://bbb:12049//a/b/c to ( hostport=, path= )]{
- +[+\n$ nfsurlconv.ksh url2hostportpath nfs:://bbb//a/b/c
- +hostport=bbb
- +path=/a/b/c
- +]
- +}
- + }
- + [+SEE ALSO?\bksh93\b(1),\bssh\b(1),\bmount.nfs\b(8),\bnfs\b(5)]
- + '
- +
- + compound c
- + typeset -a c.args
- + integer saved_optind_m1 # saved OPTIND-1
- +
- + c.args=( "$@" )
- +
- + #
- + # Argument parsing
- + #
- + while getopts -a "${progname}" "${nfsurlconv_usage}" OPT "${c.args[@]}" ; do
- + case "${OPT}" in
- + 'D')
- + # fixme: Implement debugging option
- + ;;
- + *)
- + usage "${progname}" "${nfsurlconv_usage}"
- + return $?
- + ;;
- + esac
- + done
- +
- + (( saved_optind_m1=OPTIND-1 ))
- +
- + # remove options we just parsed from c.args
- + for ((i=0 ; i < saved_optind_m1 ; i++)) ; do
- + unset c.args[$i]
- + done
- +
- + #
- + # c.args mighth be a sparse array (e.g. "([1]=aaa [2]=bbb [4]=ccc)")
- + # right now after we removed processed options/arguments.
- + # For easier processing below we "reflow" the array back to a
- + # normal linear layout (e.g. ([0]=aaa [1]=bbb [2]=ccc)
- + #
- + c.args=( "${c.args[@]}" )
- +
- + typeset mode="${c.args[0]-}"
- +
- + case "$mode" in
- + # fixme: add "hostportpath2nfsurl"
- + # fixme: add "etcexports2nfsurl"
- + 'hostnameportpath2nfsurl')
- + hostname_port_path_to_nfsurl "${@:2}"
- + return $?
- + ;;
- + 'hostnamepath2nfsurl')
- + hostname_port_path_to_nfsurl "${@:2:1}" 2049 "${@:3:1}"
- + return $?
- + ;;
- + 'url2hostnameportpath')
- + compound urldata
- +
- + parse_sshnfs_url urldata "${@:2:1}" || return 1
- + printf 'hostname=%s\n' "${urldata.host}"
- + printf 'port=%s\n' "${urldata.port-2049}"
- + printf 'path=%s\n' "${urldata.path-}"
- + return 0
- + ;;
- + 'url2hostportpath')
- + compound urldata
- +
- + parse_sshnfs_url urldata "${@:2:1}" || return 1
- + printf 'hostport=%s\n' "${urldata.hostport}"
- + printf 'path=%s\n' "${urldata.path-}"
- + return 0
- + ;;
- + 'url2compound')
- + compound urldata
- +
- + parse_sshnfs_url urldata "${@:2:1}" || return 1
- + print -v urldata
- + return 0
- + ;;
- + *)
- + print -u2 -f $"Unknown mode %q\n" "$mode"
- + usage "${progname}" "${nfsurlconv_usage}"
- + return 2
- + ;;
- + esac
- +
- + return 2
- +}
- +
- +#
- +# main
- +#
- +builtin cat
- +builtin mkdir
- +builtin basename
- +
- +typeset progname="${ basename "${0}" ; }"
- +
- +main "$@"
- +exit $?
- +
- +# EOF.
- --
- 2.43.0
- From 4773de8d49edebd8fcc7a19238ed6b359202ff22 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 31 Jan 2024 18:02:57 +0100
- Subject: [PATCH 3/6] cygwin: Generate nroff manpages for ksh93 scripts
- Generate nroff manpages for ksh93 scripts (mount_sshnfs, nfsurlconf)
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/Makefile | 4 ++++
- 1 file changed, 4 insertions(+)
- diff --git a/cygwin/Makefile b/cygwin/Makefile
- index 71d933c..bffadaf 100644
- --- a/cygwin/Makefile
- +++ b/cygwin/Makefile
- @@ -63,6 +63,7 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
- mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/lib
- mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/lib/msnfs41client
- mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/usr/src/msnfs41client
- + mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/sbin/usr/share/man/man1
- cp -r $(VS_BUILD_DIR)/nfsd.exe $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsd_debug.exe
- cp -r $(VS_BUILD_DIR)/nfsd.pdb $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsd_debug.pdb
- cp -r $(VS_BUILD_DIR)/nfs_mount.* $(DESTDIR)/cygdrive/c/cygwin64/sbin/.
- @@ -85,10 +86,13 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
- @ printf "# Package utilties\n"
- cp $(CYGWIN_MAKEFILE_DIR)/utils/mount_sshnfs/mount_sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
- chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
- + PATH+=":$(DESTDIR)/cygdrive/c/cygwin64/sbin/" \
- + /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
- cp $(CYGWIN_MAKEFILE_DIR)/utils/sshnfs/sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
- chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/sshnfs
- cp $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
- chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsurlconv
- + /usr/bin/ksh93 $(CYGWIN_MAKEFILE_DIR)/utils/nfsurlconv/nfsurlconv.ksh --nroff 2>"$(DESTDIR)/cygdrive/c/cygwin64/sbin/usr/share/man/man1/nfsurlconv.1" || true
- @ printf "# Package tests\n"
- cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.exe" $(DESTDIR)/cygdrive/c/cygwin64/bin/winfsinfo.exe
- @ printf "# Package ksh93&co (if available) since Cygwin does not ship with it yet\n"
- --
- 2.43.0
- From 8983cf09a157c1fc68ac68a81428d4b6779921cc Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 31 Jan 2024 18:08:50 +0100
- Subject: [PATCH 4/6] bintarball: Update README for nfsurlconv
- Update README for nfsurlconv+dependicies
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index 7241d35..b66c34b 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -24,8 +24,10 @@ NFSv4.1 client and filesystem driver for Windows 10/11
- - Support for custom ports (NFSv4 defaults to TCP port 2049, this
- client can use different ports per mount)
- -- Support for nfs://-URL, including custom ports and raw IPv6
- - addresses
- +- Support for nfs://-URL
- + - including custom ports and raw IPv6 addresses
- + - nfs://-URL conversion utility (/usr/bin/nfsurlconv) to convert
- + URLs, including non-ASCII/Unicode characters in mount path
- - Support ssh forwarding, e.g. mounting NFSv4 filesystems via ssh
- tunnel
- @@ -73,6 +75,8 @@ NFSv4.1 client and filesystem driver for Windows 10/11
- grep
- hostname
- less
- + libiconv
- + libiconv2
- pax
- pbzip2
- procps-ng
- --
- 2.43.0
- From 1edbbcf26d40ac89d5c595b4ed7e0dd28f7af3bc Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 1 Feb 2024 13:53:17 +0100
- Subject: [PATCH 5/6] sys: Remove |MmIsAddressValid()| from hot codepath
- Remove |MmIsAddressValid(entry->filename)| from |DEBUG_MARSHAL_HEADER|
- codepath and only enable it if |DEBUG_MARSHAL_HEADER_VALID_FILENAME|
- is set (off for now), as |MmIsAddressValid()| is expensive and sits
- in a always-used codepath.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 11 +++++++++--
- 1 file changed, 9 insertions(+), 2 deletions(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index 754b704..816dd26 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -45,6 +45,7 @@
- /* debugging printout defines */
- #define DEBUG_MARSHAL_HEADER
- +//#define DEBUG_MARSHAL_HEADER_VALID_FILENAME
- #define DEBUG_MARSHAL_DETAIL
- //#define DEBUG_OPEN
- //#define DEBUG_CLOSE
- @@ -602,14 +603,20 @@ NTSTATUS marshal_nfs41_header(
- tmp += sizeof(HANDLE);
- #ifdef DEBUG_MARSHAL_HEADER
- +#ifdef DEBUG_MARSHAL_HEADER_VALID_FILENAME
- if (MmIsAddressValid(entry->filename))
- +#endif
- DbgP("[upcall header] xid=%lld opcode='%s' filename='%wZ' version=%d "
- "session=0x%x open_state=0x%x\n", entry->xid,
- ENTRY_OPCODE2STRING(entry), entry->filename,
- entry->version, entry->session, entry->open_state);
- - else
- +#ifdef DEBUG_MARSHAL_HEADER_VALID_FILENAME
- + else {
- + DbgP("[upcall header] Invalid filename %p\n", entry);
- status = STATUS_INTERNAL_ERROR;
- -#endif
- + }
- +#endif /* DEBUG_MARSHAL_HEADER_VALID_FILENAME */
- +#endif /* DEBUG_MARSHAL_HEADER */
- out:
- return status;
- }
- --
- 2.43.0
- From 8e57787a0343db7257e1bbcbfeb5226c4c677b08 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 1 Feb 2024 18:27:51 +0100
- Subject: [PATCH 6/6] Fix Windows 32bit build and use |UNICODE|+|_UNICODE|
- consistently
- Fix Windows 32bit build and use cpp defines |UNICODE|+|_UNICODE|
- consistently across all platforms+build configurations.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/libtirpc/libtirpc.vcxproj | 4 ++--
- build.vc19/nfs41_np/nfs41_np.vcxproj | 4 ++--
- build.vc19/nfs_install/nfs_install.vcxproj | 4 ++--
- build.vc19/nfs_mount/nfs_mount.vcxproj | 4 ++--
- build.vc19/nfsd/nfsd.vcxproj | 4 ++--
- daemon/acl.c | 4 ++--
- daemon/delegation.c | 2 +-
- daemon/ea.c | 2 +-
- daemon/idmap.c | 10 +++++-----
- daemon/nfs41_daemon.c | 8 ++++----
- daemon/nfs41_server.c | 9 ++++++++-
- daemon/service.c | 3 +++
- daemon/sid.c | 4 ++--
- daemon/util.c | 4 ++--
- install/nfsreginst.c | 2 +-
- libtirpc/src/auth_sspi.c | 4 +++-
- mount/options.c | 2 +-
- 17 files changed, 43 insertions(+), 31 deletions(-)
- diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
- index 37bc712..65b32f8 100644
- --- a/build.vc19/libtirpc/libtirpc.vcxproj
- +++ b/build.vc19/libtirpc/libtirpc.vcxproj
- @@ -108,7 +108,7 @@
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- - <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- @@ -155,7 +155,7 @@
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- - <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>FD_SETSIZE=1024;INET6;NO_CB_4_KRB5P;PORTMAP;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;LIBTIRPC_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- diff --git a/build.vc19/nfs41_np/nfs41_np.vcxproj b/build.vc19/nfs41_np/nfs41_np.vcxproj
- index 3efe8f6..5c4009e 100644
- --- a/build.vc19/nfs41_np/nfs41_np.vcxproj
- +++ b/build.vc19/nfs41_np/nfs41_np.vcxproj
- @@ -104,7 +104,7 @@
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- - <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- @@ -144,7 +144,7 @@
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- - <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_WINDOWS;_USRDLL;NFS41_NP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
- index 898ba94..47e2ec7 100644
- --- a/build.vc19/nfs_install/nfs_install.vcxproj
- +++ b/build.vc19/nfs_install/nfs_install.vcxproj
- @@ -103,7 +103,7 @@
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- - <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- @@ -141,7 +141,7 @@
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- - <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
- index ea482e2..c4cb8d6 100644
- --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
- +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
- @@ -104,7 +104,7 @@
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- - <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- @@ -144,7 +144,7 @@
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- - <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- + <PreprocessorDefinitions>WIN32;UNICODE;_UNICODE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
- index d506140..e4517f6 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj
- +++ b/build.vc19/nfsd/nfsd.vcxproj
- @@ -107,7 +107,7 @@
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- - <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>
- + <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>
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- @@ -152,7 +152,7 @@
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- - <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>
- + <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>
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- diff --git a/daemon/acl.c b/daemon/acl.c
- index 583f7c6..a9e7e46 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -492,7 +492,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- return ERROR_SUCCESS;
- }
- - status = LookupAccountSid(NULL, sid, who, &size, tmp_buf,
- + status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
- &tmp_size, &sid_type);
- dprintf(ACLLVL, "map_nfs4ace_who: LookupAccountSid returned %d GetLastError "
- "%d name len %d domain len %d\n", status, GetLastError(),
- @@ -510,7 +510,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
- tmp_buf = malloc(tmp_size);
- if (tmp_buf == NULL)
- goto out_free_who;
- - status = LookupAccountSid(NULL, sid, who, &size, tmp_buf,
- + status = LookupAccountSidA(NULL, sid, who, &size, tmp_buf,
- &tmp_size, &sid_type);
- free(tmp_buf);
- if (!status) {
- diff --git a/daemon/delegation.c b/daemon/delegation.c
- index e26c2af..bd04d68 100644
- --- a/daemon/delegation.c
- +++ b/daemon/delegation.c
- @@ -279,7 +279,7 @@ static int delegation_return(
- uint32_t length;
- dprintf(1, "delegation_return: making a downcall for srv_open=%x\n",
- deleg->srv_open);
- - pipe = CreateFile(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
- + pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
- if (pipe == INVALID_HANDLE_VALUE) {
- eprintf("delegation_return: Unable to open downcall pipe %d\n",
- diff --git a/daemon/ea.c b/daemon/ea.c
- index baeb43a..a988d92 100644
- --- a/daemon/ea.c
- +++ b/daemon/ea.c
- @@ -605,7 +605,7 @@ static int handle_getexattr(void *daemon_context, nfs41_upcall *upcall)
- }
- ea->EaNameLength = query->EaNameLength;
- - StringCchCopy(ea->EaName, (size_t)ea->EaNameLength + 1, query->EaName);
- + StringCchCopyA(ea->EaName, (size_t)ea->EaNameLength + 1, query->EaName);
- ea->Flags = 0;
- /* read the value from file */
- diff --git a/daemon/idmap.c b/daemon/idmap.c
- index 169de15..202d852 100644
- --- a/daemon/idmap.c
- +++ b/daemon/idmap.c
- @@ -574,7 +574,7 @@ static int idmap_filter(
- if (FAILED(StringCchPrintfA(filter, filter_len,
- "(&(objectClass=%s)(%s=%s))",
- config->classes[lookup->klass],
- - config->attributes[lookup->attr], lookup->value))) {
- + config->attributes[lookup->attr], (const char *)lookup->value))) {
- status = ERROR_BUFFER_OVERFLOW;
- eprintf("ldap filter buffer overflow: '%s=%s'\n",
- config->attributes[lookup->attr], lookup->value);
- @@ -607,7 +607,7 @@ static int idmap_query_attrs(
- goto out;
- /* send the ldap query */
- - status = ldap_search_st(context->ldap, config->base,
- + status = ldap_search_stA(context->ldap, config->base,
- LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, &res);
- if (status) {
- eprintf("ldap search for '%s' failed with %d: %s\n",
- @@ -628,7 +628,7 @@ static int idmap_query_attrs(
- /* fetch the attributes */
- for (i = 0; i < len; i++) {
- if (ATTR_ISSET(attributes, i)) {
- - values[i] = ldap_get_values(context->ldap,
- + values[i] = ldap_get_valuesA(context->ldap,
- entry, config->attributes[i]);
- /* fail if required attributes are missing */
- @@ -801,7 +801,7 @@ static int idmap_lookup_user(
- }
- out_free_values:
- for (i = 0; i < NUM_ATTRIBUTES; i++)
- - ldap_value_free(values[i]);
- + ldap_value_freeA(values[i]);
- out:
- return status;
- }
- @@ -902,7 +902,7 @@ static int idmap_lookup_group(
- }
- out_free_values:
- for (i = 0; i < NUM_ATTRIBUTES; i++)
- - ldap_value_free(values[i]);
- + ldap_value_freeA(values[i]);
- out:
- return status;
- }
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index 9a06c44..82c337f 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -100,7 +100,7 @@ static unsigned int WINAPI thread_main(void *args)
- DWORD inbuf_len = UPCALL_BUF_SIZE, outbuf_len;
- nfs41_upcall upcall;
- - pipe = CreateFile(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
- + pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- 0, NULL);
- if (pipe == INVALID_HANDLE_VALUE)
- @@ -313,7 +313,7 @@ static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
- }
- }
- else
- - fprintf(stderr, "Unrecognized option '%s', disregarding.\n", argv[i]);
- + fprintf(stderr, "Unrecognized option '%S', disregarding.\n", argv[i]);
- }
- }
- @@ -339,7 +339,7 @@ static void print_getaddrinfo(struct addrinfo *ptr)
- inet_ntoa(((struct sockaddr_in *)ptr->ai_addr)->sin_addr));
- break;
- case AF_INET6:
- - if (WSAAddressToString((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
- + if (WSAAddressToStringA((LPSOCKADDR)ptr->ai_addr, (DWORD)ptr->ai_addrlen,
- NULL, ipstringbuffer, &ipbufferlength))
- dprintf(1, "WSAAddressToString failed with %u\n", WSAGetLastError());
- else
- @@ -561,7 +561,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- NFS41D_VERSION = GetTickCount();
- dprintf(1, "NFS41 Daemon starting: version %d\n", NFS41D_VERSION);
- - pipe = CreateFile(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
- + pipe = CreateFileA(NFS41_USER_DEVICE_NAME_A, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
- 0, NULL);
- if (pipe == INVALID_HANDLE_VALUE)
- diff --git a/daemon/nfs41_server.c b/daemon/nfs41_server.c
- index 3a09935..844215b 100644
- --- a/daemon/nfs41_server.c
- +++ b/daemon/nfs41_server.c
- @@ -279,7 +279,7 @@ int nfs41_server_resolve(
- {
- int status = ERROR_BAD_NET_NAME;
- char service[16];
- - struct addrinfoexA hints = { 0 }, *res, *info;
- + ADDRINFOEXA hints = { 0 }, *res, *info;
- struct netconfig *nconf;
- struct netbuf addr;
- char *netid, *uaddr;
- @@ -368,6 +368,13 @@ retry_getaddrinfoex:
- break;
- }
- }
- +/*
- + * BUG: WS2tcpip.h somenow mapps FreeAddrInfoExA() to use the wide-char version
- + */
- +#define WINDOWS_WS2TCPIP_H_BUG 1
- +#ifdef WINDOWS_WS2TCPIP_H_BUG
- +#undef FreeAddrInfoEx
- +#endif
- FreeAddrInfoEx(res);
- out:
- if (status) {
- diff --git a/daemon/service.c b/daemon/service.c
- index 2b19668..81d9072 100644
- --- a/daemon/service.c
- +++ b/daemon/service.c
- @@ -27,6 +27,9 @@ FUNCTIONS:
- #include <stdlib.h>
- #include <process.h>
- #include <tchar.h>
- +#ifdef UNICODE
- +#include <shellapi.h>
- +#endif
- #include "service.h"
- diff --git a/daemon/sid.c b/daemon/sid.c
- index 412b33f..5326994 100644
- --- a/daemon/sid.c
- +++ b/daemon/sid.c
- @@ -351,7 +351,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- }
- #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
- - status = LookupAccountName(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
- + status = LookupAccountNameA(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
- dprintf(ACLLVL, "map_nfs4servername_2_sid(query=%x,name='%s'): LookupAccountName returned %d "
- "GetLastError %d name len %d domain len %d\n",
- query, name, status, GetLastError(), *sid_len, tmp);
- @@ -369,7 +369,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- tmp_buf = (LPSTR) malloc(tmp);
- if (tmp_buf == NULL)
- goto out_free_sid;
- - status = LookupAccountName(NULL, name, *sid, sid_len, tmp_buf,
- + status = LookupAccountNameA(NULL, name, *sid, sid_len, tmp_buf,
- &tmp, &sid_type);
- free(tmp_buf);
- if (!status) {
- diff --git a/daemon/util.c b/daemon/util.c
- index 95e0d7f..cae4130 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -443,11 +443,11 @@ int create_silly_rename(
- StringCchCopyNA(name, NFS41_MAX_COMPONENT_LEN+1, silly->name, silly->len);
- tmp = (char*)silly->name;
- - StringCchPrintf(tmp, end - tmp, ".%s.", name);
- + StringCchPrintfA(tmp, end - tmp, ".%s.", name);
- tmp += (size_t)silly->len + 2L;
- for (i = 0; i < 16; i++, tmp++)
- - StringCchPrintf(tmp, end - tmp, "%x", fhmd5[i]);
- + StringCchPrintfA(tmp, end - tmp, "%x", fhmd5[i]);
- path->len = path->len + extra_len;
- silly->len = silly->len + extra_len;
- diff --git a/install/nfsreginst.c b/install/nfsreginst.c
- index 66e1997..6e1a696 100644
- --- a/install/nfsreginst.c
- +++ b/install/nfsreginst.c
- @@ -102,7 +102,7 @@ BOOL RdrSetProviderOrderString( __in LPTSTR OrderString )
- if ( CreateKey( PROVIDER_ORDER_KEY, &hOrderKey ) )
- {
- - ProviderOrderKeyValues[0].dwLength = ( _tcsclen( OrderString ) + 1 ) * sizeof( TCHAR );
- + ProviderOrderKeyValues[0].dwLength = (DWORD)(( _tcsclen( OrderString ) + 1 ) * sizeof( TCHAR ));
- ProviderOrderKeyValues[0].pvValue = OrderString;
- WriteRegistryKeyValues( hOrderKey,
- sizeof(ProviderOrderKeyValues) / sizeof(REGENTRY),
- diff --git a/libtirpc/src/auth_sspi.c b/libtirpc/src/auth_sspi.c
- index c2173fa..72f6720 100644
- --- a/libtirpc/src/auth_sspi.c
- +++ b/libtirpc/src/auth_sspi.c
- @@ -870,7 +870,9 @@ void print_rpc_gss_sec(struct rpc_sspi_sec *ptr)
- fprintf(fd_out, " qop: %d\n", ptr->qop);
- fprintf(fd_out, " service: %d\n", ptr->svc);
- fprintf(fd_out, " cred(%p) = { dwLower=%lld, dwUpper=%lld} \n",
- - &ptr->cred, ptr->cred.dwLower, ptr->cred.dwUpper);
- + &ptr->cred,
- + (long long)ptr->cred.dwLower,
- + (long long)ptr->cred.dwUpper);
- }
- void print_negotiated_attrs(PCtxtHandle ctx)
- diff --git a/mount/options.c b/mount/options.c
- index 11bdca9..df8dd75 100644
- --- a/mount/options.c
- +++ b/mount/options.c
- @@ -164,7 +164,7 @@ static void RecursivePrintEaInformation(
- TEXT("EaValueLength: %5u\n")
- TEXT("EaName: %16ls\n")
- TEXT("EaValue: %16ls\n\n"),
- - (ULONG_PTR)EA % sizeof(ULONG),
- + (unsigned long)((ULONG_PTR)EA % sizeof(ULONG)),
- EA->NextEntryOffset,
- EA->Flags,
- EA->EaNameLength,
- --
- 2.43.0
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
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.