- From 916917a9318f5307d7d7bf477c8232db055a3ffa Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 27 Aug 2025 13:39:08 +0200
- Subject: [PATCH 1/4] tests: Always sign the *.exe files in tests/ with the WDK
- test signature
- Always sign the *.exe files in tests/ with the WDK test signature, to
- allow a (Windows Defender) admin to whitelist the binaries based on
- that signature.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/ea/Makefile | 7 +++++--
- tests/filemmaptests/Makefile | 7 +++++--
- tests/lssparse/Makefile | 7 +++++--
- tests/winclonefile/Makefile | 7 +++++--
- tests/winfsinfo1/Makefile | 7 +++++--
- tests/winoffloadcopyfile/Makefile | 7 +++++--
- tests/winrunassystem/Makefile | 9 ++++++---
- tests/winsg/Makefile | 7 +++++--
- 8 files changed, 41 insertions(+), 17 deletions(-)
- diff --git a/tests/ea/Makefile b/tests/ea/Makefile
- index 4e49afd..e24e0dc 100644
- --- a/tests/ea/Makefile
- +++ b/tests/ea/Makefile
- @@ -3,14 +3,17 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: nfs_ea.i686.exe nfs_ea.x86_64.exe nfs_ea.exe
- nfs_ea.i686.exe: main.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -D_CRT_STDIO_ISO_WIDE_SPECIFIERS=1 -DUNICODE=1 -D_UNICODE=1 -isystem /usr/include/w32api/ddk -I../../include -g main.c -lntdll -o nfs_ea.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -D_CRT_STDIO_ISO_WIDE_SPECIFIERS=1 -DUNICODE=1 -D_UNICODE=1 -isystem /usr/include/w32api/ddk -I../../include -g main.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- nfs_ea.x86_64.exe: main.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -D_CRT_STDIO_ISO_WIDE_SPECIFIERS=1 -DUNICODE=1 -D_UNICODE=1 -isystem /usr/include/w32api/ddk -I../../include -g main.c -lntdll -o nfs_ea.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -D_CRT_STDIO_ISO_WIDE_SPECIFIERS=1 -DUNICODE=1 -D_UNICODE=1 -isystem /usr/include/w32api/ddk -I../../include -g main.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- nfs_ea.exe: nfs_ea.x86_64.exe
- rm -f nfs_ea.exe
- diff --git a/tests/filemmaptests/Makefile b/tests/filemmaptests/Makefile
- index e191725..3b2a9e53 100644
- --- a/tests/filemmaptests/Makefile
- +++ b/tests/filemmaptests/Makefile
- @@ -3,6 +3,7 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: \
- qsortonmmapedfile1.i686.exe \
- @@ -10,10 +11,12 @@ all: \
- qsortonmmapedfile1.exe
- qsortonmmapedfile1.i686.exe: qsortonmmapedfile1.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g -O qsortonmmapedfile1.c -o qsortonmmapedfile1.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g -O qsortonmmapedfile1.c -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- qsortonmmapedfile1.x86_64.exe: qsortonmmapedfile1.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g -O qsortonmmapedfile1.c -o qsortonmmapedfile1.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g -O qsortonmmapedfile1.c -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- qsortonmmapedfile1.exe: qsortonmmapedfile1.x86_64.exe
- ln -s qsortonmmapedfile1.x86_64.exe qsortonmmapedfile1.exe
- diff --git a/tests/lssparse/Makefile b/tests/lssparse/Makefile
- index 6b591ac..0f2a11d 100644
- --- a/tests/lssparse/Makefile
- +++ b/tests/lssparse/Makefile
- @@ -3,15 +3,18 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: lssparse.x86_64.exe lssparse.exe
- # Cygwin 3.6 does not support 32bit builds anymore
- #lssparse.i686.exe: lssparse.c
- -# gcc -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g lssparse.c -lntdll -o lssparse.i686.exe
- +# gcc -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g lssparse.c -lntdll -o $@
- +# bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- lssparse.x86_64.exe: lssparse.c
- - gcc -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g lssparse.c -lntdll -o lssparse.x86_64.exe
- + gcc -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g lssparse.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- lssparse.exe: lssparse.x86_64.exe
- ln -s lssparse.x86_64.exe lssparse.exe
- diff --git a/tests/winclonefile/Makefile b/tests/winclonefile/Makefile
- index d4d14a7..4c00b53 100644
- --- a/tests/winclonefile/Makefile
- +++ b/tests/winclonefile/Makefile
- @@ -3,14 +3,17 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: winclonefile.i686.exe winclonefile.x86_64.exe winclonefile.exe
- winclonefile.i686.exe: winclonefile.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winclonefile.c -lntdll -o winclonefile.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winclonefile.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winclonefile.x86_64.exe: winclonefile.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winclonefile.c -lntdll -o winclonefile.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winclonefile.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winclonefile.exe: winclonefile.x86_64.exe
- ln -s winclonefile.x86_64.exe winclonefile.exe
- diff --git a/tests/winfsinfo1/Makefile b/tests/winfsinfo1/Makefile
- index c927704..262a93f 100644
- --- a/tests/winfsinfo1/Makefile
- +++ b/tests/winfsinfo1/Makefile
- @@ -3,14 +3,17 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: winfsinfo.i686.exe winfsinfo.x86_64.exe winfsinfo.exe
- winfsinfo.i686.exe: winfsinfo.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winfsinfo.c -lmpr -lntdll -o winfsinfo.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winfsinfo.c -lmpr -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winfsinfo.x86_64.exe: winfsinfo.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winfsinfo.c -lmpr -lntdll -o winfsinfo.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winfsinfo.c -lmpr -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winfsinfo.exe: winfsinfo.x86_64.exe
- ln -s winfsinfo.x86_64.exe winfsinfo.exe
- diff --git a/tests/winoffloadcopyfile/Makefile b/tests/winoffloadcopyfile/Makefile
- index a429b44..5330d4f 100644
- --- a/tests/winoffloadcopyfile/Makefile
- +++ b/tests/winoffloadcopyfile/Makefile
- @@ -3,14 +3,17 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: winoffloadcopyfile.i686.exe winoffloadcopyfile.x86_64.exe winoffloadcopyfile.exe
- winoffloadcopyfile.i686.exe: winoffloadcopyfile.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winoffloadcopyfile.c -lntdll -o winoffloadcopyfile.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winoffloadcopyfile.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winoffloadcopyfile.x86_64.exe: winoffloadcopyfile.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winoffloadcopyfile.c -lntdll -o winoffloadcopyfile.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -I../../include -g winoffloadcopyfile.c -lntdll -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winoffloadcopyfile.exe: winoffloadcopyfile.x86_64.exe
- ln -s winoffloadcopyfile.x86_64.exe winoffloadcopyfile.exe
- diff --git a/tests/winrunassystem/Makefile b/tests/winrunassystem/Makefile
- index 9ade5ec..69ce1ab 100644
- --- a/tests/winrunassystem/Makefile
- +++ b/tests/winrunassystem/Makefile
- @@ -3,17 +3,20 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: winrunassystem.i686.exe winrunassystem.x86_64.exe winrunassystem.exe
- winrunassystem.i686.exe: winrunassystem.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winrunassystem.c -lWtsapi32 -o winrunassystem.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winrunassystem.c -lWtsapi32 -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winrunassystem.x86_64.exe: winrunassystem.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winrunassystem.c -lWtsapi32 -o winrunassystem.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winrunassystem.c -lWtsapi32 -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winrunassystem.exe: winrunassystem.x86_64.exe
- - ln -s winrunassystem.x86_64.exe winrunassystem.exe
- + ln -s winrunassystem.x86_64.exe $@
- clean:
- rm -fv \
- diff --git a/tests/winsg/Makefile b/tests/winsg/Makefile
- index 5006dce..345151d 100644
- --- a/tests/winsg/Makefile
- +++ b/tests/winsg/Makefile
- @@ -3,14 +3,17 @@
- #
- # POSIX Makefile
- +SIGNTOOL="/cygdrive/c/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool/signtool.exe"
- all: winsg.i686.exe winsg.x86_64.exe winsg.exe
- winsg.i686.exe: winsg.c
- - clang -target i686-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winsg.c -o winsg.i686.exe
- + clang -target i686-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winsg.c -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winsg.x86_64.exe: winsg.c
- - clang -target x86_64-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winsg.c -o winsg.x86_64.exe
- + clang -target x86_64-pc-windows-gnu -std=gnu17 -municode -Wall -Wextra -DUNICODE=1 -D_UNICODE=1 -g winsg.c -o $@
- + bash -x -c '$(SIGNTOOL) sign /ph /fd "sha256" /sha1 "$${CERTIFICATE_THUMBPRINT%$$(printf "\r")}" $@'
- winsg.exe: winsg.x86_64.exe
- ln -s winsg.x86_64.exe winsg.exe
- --
- 2.45.1
- From 987348fb38b9422cf28f7474a67140e991659767 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 27 Aug 2025 14:15:56 +0200
- Subject: [PATCH 2/4] daemon: CriticalSections used to protect list searches
- should not use a spin count
- CriticalSections used to protect list searches should not use a spin count,
- as this is wasted CPU time in such a case.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/namespace.c | 6 +++++-
- daemon/nfs41_client.c | 6 +++++-
- daemon/nfs41_server.c | 9 +++++++--
- 3 files changed, 17 insertions(+), 4 deletions(-)
- diff --git a/daemon/namespace.c b/daemon/namespace.c
- index 4a2b157..89a0e0b 100644
- --- a/daemon/namespace.c
- +++ b/daemon/namespace.c
- @@ -88,7 +88,11 @@ int nfs41_root_create(
- }
- root->wsize = wsize;
- root->rsize = rsize;
- - InitializeCriticalSection(&root->lock);
- + /*
- + * Disable spin count as |root->lock| is typically used to
- + * protect list searches, which takes a long time
- + */
- + (void)InitializeCriticalSectionAndSpinCount(&root->lock, 0);
- root->ref_count = 1;
- root->sec_flavor = sec_flavor;
- diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c
- index 375d7e9..7510f05 100644
- --- a/daemon/nfs41_client.c
- +++ b/daemon/nfs41_client.c
- @@ -136,7 +136,11 @@ int nfs41_client_create(
- list_init(&client->state.opens);
- list_init(&client->state.delegations);
- - InitializeCriticalSection(&client->state.lock);
- + /*
- + * Disable spin count as |client->state.lock| is typically used to
- + * protect list searches, which takes a long time
- + */
- + (void)InitializeCriticalSectionAndSpinCount(&client->state.lock, 0);
- //initialize a lock used to protect access to client id and client id seq#
- InitializeSRWLock(&client->exid_lock);
- diff --git a/daemon/nfs41_server.c b/daemon/nfs41_server.c
- index 04d3651..7e3295c 100644
- --- a/daemon/nfs41_server.c
- +++ b/daemon/nfs41_server.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2024-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -49,7 +50,11 @@ static struct server_list g_server_list;
- void nfs41_server_list_init()
- {
- list_init(&g_server_list.head);
- - InitializeCriticalSection(&g_server_list.lock);
- + /*
- + * Disable spin count as |g_server_list.lock| is typically used to
- + * protect list searches, which takes a long time
- + */
- + (void)InitializeCriticalSectionAndSpinCount(&g_server_list.lock, 0);
- }
- /* http://tools.ietf.org/html/rfc5661#section-1.6
- --
- 2.45.1
- From 14a65b31124e3385429048aa3c52bc0e5ff29d40 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 27 Aug 2025 14:37:32 +0200
- Subject: [PATCH 3/4] tests: winrunassystem.exe should forward the exit code of
- the child process
- winrunassystem.exe should forward the exit code of the child process.
- Reported-by: Aurelien Couderc <aurelien.couderc2002@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/winrunassystem/winrunassystem.c | 61 ++++++++++++++++++++++++---
- 1 file changed, 56 insertions(+), 5 deletions(-)
- diff --git a/tests/winrunassystem/winrunassystem.c b/tests/winrunassystem/winrunassystem.c
- index 80b9fbc..6ccae1b 100644
- --- a/tests/winrunassystem/winrunassystem.c
- +++ b/tests/winrunassystem/winrunassystem.c
- @@ -505,6 +505,41 @@ done:
- (void)CloseServiceHandle(hSCManager);
- }
- +static
- +bool readfilecontentsintobuffer(const wchar_t *filename,
- + char *buffer,
- + size_t buffersize,
- + size_t *numreadbytes)
- +{
- + HANDLE hFile;
- + bool retval = false;
- + DWORD readfile_numbytesread = 0UL;
- +
- + hFile = CreateFileW(filename,
- + GENERIC_READ,
- + FILE_SHARE_READ,
- + NULL,
- + OPEN_EXISTING,
- + FILE_ATTRIBUTE_TEMPORARY,
- + NULL);
- + if (hFile == INVALID_HANDLE_VALUE) {
- + D((void)wprintf(L"readfilecontentsintobuffer: "
- + L"cannot open status file, lasterr=%d\n",
- + (int)GetLastError()));
- + return false;
- + }
- +
- + retval = ReadFile(hFile, buffer, (DWORD)buffersize,
- + &readfile_numbytesread, NULL)?true:false;
- + *numreadbytes = readfile_numbytesread;
- +
- + if (hFile != INVALID_HANDLE_VALUE) {
- + (void)CloseHandle(hFile);
- + }
- +
- + return retval;
- +}
- +
- static
- void usage(const wchar_t *av0)
- {
- @@ -558,21 +593,37 @@ int wmain(int argc, wchar_t *argv[])
- /* Stop and Uninstall */
- UninstallService();
- + /* Get child stdout+stderr */
- (void)system_fmt("C:\\cygwin64\\bin\\bash.exe -c "
- "'cat \"/cygdrive/c/Windows/Temp/%ls_stderr\" 1>&2'",
- service_name_buffer);
- (void)system_fmt("C:\\cygwin64\\bin\\bash.exe -c "
- "'cat \"/cygdrive/c/Windows/Temp/%ls_stdout\"'",
- service_name_buffer);
- - (void)system_fmt("C:\\cygwin64\\bin\\bash.exe -c "
- - "'printf \"# Child status %%d.\\\\n\" "
- - "\"$( <\"/cygdrive/c/Windows/Temp/%ls_status\" )\" 1>&2'",
- +
- + /* Read child return value */
- + wchar_t statusfilenamebuff[MAX_PATH+1];
- + char statusvalue[256];
- + size_t numbytesread = 0UL;
- + (void)swprintf(statusfilenamebuff, sizeof(statusfilenamebuff),
- + L"C:\\Windows\\Temp\\%ls_status",
- service_name_buffer);
- + if (readfilecontentsintobuffer(statusfilenamebuff,
- + statusvalue, sizeof(statusvalue), &numbytesread)) {
- + statusvalue[numbytesread] = '\0';
- + retval = atoi(statusvalue);
- + }
- + else {
- + (void)fwprintf(stderr,
- + L"%ls: Cannot read child status from file '%ls'\n",
- + argv[0], statusfilenamebuff);
- + retval = EXIT_FAILURE;
- + }
- +
- + /* Delete temporary files */
- (void)remove_fmt("C:\\Windows\\Temp\\%ls_stdout", service_name_buffer);
- (void)remove_fmt("C:\\Windows\\Temp\\%ls_stderr", service_name_buffer);
- (void)remove_fmt("C:\\Windows\\Temp\\%ls_status", service_name_buffer);
- -
- - retval = EXIT_SUCCESS;
- }
- return retval;
- --
- 2.45.1
- From 5352805576ccfdde0adb8a422551f9b9587d6f41 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 27 Aug 2025 15:11:58 +0200
- Subject: [PATCH 4/4] README.md,cygwin,docs: Add /sbin/nfs_globalmount utility
- to manage machine-wide mounts
- Add /sbin/nfs_globalmount utility to manage machine-wide mounts.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- README.md | 5 +++-
- cygwin/Makefile.install | 4 +++
- .../utils/nfs_globalmount/nfs_globalmount.ksh | 30 +++++++++++++++++++
- docs/README.xml | 3 +-
- 4 files changed, 40 insertions(+), 2 deletions(-)
- create mode 100644 cygwin/utils/nfs_globalmount/nfs_globalmount.ksh
- diff --git a/README.md b/README.md
- index efe279c..a9bb25c 100644
- --- a/README.md
- +++ b/README.md
- @@ -640,7 +640,10 @@ List mounted NFSv4.2 filesystems:
- ### Global/System-wide mounts
- Mounts created by user "SYSTEM" are usable by all users in a system.
- -Example usage:
- +Such mounts can be created by the `/sbin/nfs_globalmount` command, or
- +adding an entry in `/etc/fstab.msnfs41client`.
- +
- +Example usage for `/etc/fstab.msnfs41client`:
- # Create a file /etc/fstab.msnfs41client, which list the mounts
- # which should be mounted system-wide at boot
- diff --git a/cygwin/Makefile.install b/cygwin/Makefile.install
- index d0574a4..e9f68df 100644
- --- a/cygwin/Makefile.install
- +++ b/cygwin/Makefile.install
- @@ -86,6 +86,10 @@ installdest:
- git diff -w >"$(DESTDIR)/$(CYGWIN_BASEPATH)/usr/src/msnfs41client/msnfs41client_diff_w.diff"
- git diff >"$(DESTDIR)/$(CYGWIN_BASEPATH)/usr/src/msnfs41client/msnfs41client_diff.diff"
- @ printf "# Package utilties\n"
- + cp $(CYGWIN_MAKEFILE_DIR)/utils/nfs_globalmount/nfs_globalmount.ksh $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/nfs_globalmount
- + chmod a+x $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/nfs_globalmount
- + PATH+=":$(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/" \
- + /usr/bin/ksh93 $(CYGWIN_MAKEFILE_DIR)/utils/nfs_globalmount/nfs_globalmount.ksh --nroff 2>"$(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/man/man1/nfs_globalmount.1" || true
- cp $(CYGWIN_MAKEFILE_DIR)/utils/mountall_msnfs41client/mountall_msnfs41client.ksh $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/mountall_msnfs41client
- chmod a+x $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/mountall_msnfs41client
- PATH+=":$(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/" \
- diff --git a/cygwin/utils/nfs_globalmount/nfs_globalmount.ksh b/cygwin/utils/nfs_globalmount/nfs_globalmount.ksh
- new file mode 100644
- index 0000000..c4edd41
- --- /dev/null
- +++ b/cygwin/utils/nfs_globalmount/nfs_globalmount.ksh
- @@ -0,0 +1,30 @@
- +#!/bin/ksh93
- +
- +# ksh93 scripts using AST getopts(1) support --nroff,
- +# but we do not do that yet
- +[[ "$1" == '--nroff' ]] && exit 1
- +
- +function is_windows_admin_account
- +{
- + #
- + # Test whether we have the Windows permissions to install DLLs
- + # and the kernel module
- + #
- + # Usually Windows Adminstrator rights are indicated by the
- + # membership in group "544(Administratoren)" (Cygwin maps
- + # "SID S-1-5-32-544" to GID 544)
- + #
- + if [[ "$(/bin/id -G)" =~ (^|[[:space:]]+)544([[:space:]]+|$) ]] ; then
- + return 0
- + fi
- + return 1
- +}
- +
- +if ! is_windows_admin_account ; then
- + printf $"%s: Requires Windows Adminstator permissions.\n" "$0"
- + exit 1
- +fi
- +
- +/sbin/winrunassystem "$(cygpath -w '/sbin/nfs_mount.exe')" "$@"
- +exit $?
- +# EOF.
- diff --git a/docs/README.xml b/docs/README.xml
- index a69372a..e32fda4 100644
- --- a/docs/README.xml
- +++ b/docs/README.xml
- @@ -653,7 +653,8 @@ $ net use '\0.49.202.230@2049\nfs4\net_tmpfs2' /delete</programlisting>
- <section xml:id="global-system-wide-mounts">
- <title>Global/System-wide mounts</title>
- - <para>Mounts created by user "SYSTEM" are usable by all users in a system. Example usage:</para>
- + <para>Mounts created by user "SYSTEM" are usable by all users in a system. Such mounts can be created by the <command>/sbin/nfs_globalmount</command> command, or adding an entry in <filename>/etc/fstab.msnfs41client</filename>.</para>
- + <para>Example usage for <filename>/etc/fstab.msnfs41client</filename>:</para>
- <programlisting># Create a file /etc/fstab.msnfs41client, which list the mounts
- # which should be mounted system-wide at boot
- $ cat /etc/fstab.msnfs41client
- --
- 2.45.1
msnfs41client: nfs_globalmount util, winrunassystem improvements, sign all utils+misc, 2025-08-27
Posted by Anonymous on Wed 27th Aug 2025 14:21
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.