- From a1228c175c8f6c34a855ba110823b5546760c053 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 10 Dec 2024 11:13:06 +0100
- Subject: [PATCH 1/6] sys: |nfs41_ExtendForCache()| should live with the r/w
- code
- Move |nfs41_ExtendForCache()| to the r/w source code file
- Reported-by: Josh Hurst <joshhurst@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_driver.c | 31 -------------------------------
- sys/nfs41sys_driver.h | 4 ++++
- sys/nfs41sys_readwrite.c | 31 +++++++++++++++++++++++++++++++
- 3 files changed, 35 insertions(+), 31 deletions(-)
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index c43a5c0..e2f8ed7 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -659,37 +659,6 @@ out:
- return status;
- }
- -static ULONG nfs41_ExtendForCache(
- - IN OUT PRX_CONTEXT RxContext,
- - IN PLARGE_INTEGER pNewFileSize,
- - OUT PLARGE_INTEGER pNewAllocationSize)
- -{
- - NTSTATUS status = STATUS_SUCCESS;
- - __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
- -#ifdef DEBUG_CACHE
- - PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
- - DbgEn();
- - print_debug_header(RxContext);
- - DbgP("input: bytecount=0x%lx filesize=0x%llx allocsize=0x%llx\n",
- - (long)LowIoContext->ParamsFor.ReadWrite.ByteCount,
- - (long long)pNewFileSize->QuadPart,
- - (long long)pNewAllocationSize->QuadPart);
- -#endif
- - pNewAllocationSize->QuadPart = pNewFileSize->QuadPart + 8192;
- - nfs41_fcb->StandardInfo.AllocationSize.QuadPart =
- - pNewAllocationSize->QuadPart;
- - nfs41_fcb->StandardInfo.EndOfFile.QuadPart = pNewFileSize->QuadPart;
- -#ifdef DEBUG_CACHE
- - DbgP("newfilesize=0x%llx newallocationsize=0x%llx\n",
- - (long long)pNewFileSize->QuadPart,
- - (long long)pNewAllocationSize->QuadPart);
- -#endif
- -#ifdef DEBUG_CACHE
- - DbgEx();
- -#endif
- - return status;
- -}
- -
- VOID nfs41_remove_fcb_entry(
- PMRX_FCB fcb)
- {
- diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
- index 9d582a6..1c39ab6 100644
- --- a/sys/nfs41sys_driver.h
- +++ b/sys/nfs41sys_driver.h
- @@ -767,6 +767,10 @@ NTSTATUS nfs41_Read(
- IN OUT PRX_CONTEXT RxContext);
- NTSTATUS nfs41_Write(
- IN OUT PRX_CONTEXT RxContext);
- +ULONG nfs41_ExtendForCache(
- + IN OUT PRX_CONTEXT RxContext,
- + IN PLARGE_INTEGER pNewFileSize,
- + OUT PLARGE_INTEGER pNewAllocationSize);
- /* nfs41sys_symlink.c */
- NTSTATUS marshal_nfs41_symlink(
- diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
- index 90d6d07..40ee1ca 100644
- --- a/sys/nfs41sys_readwrite.c
- +++ b/sys/nfs41sys_readwrite.c
- @@ -434,3 +434,34 @@ out:
- #endif
- return status;
- }
- +
- +ULONG nfs41_ExtendForCache(
- + IN OUT PRX_CONTEXT RxContext,
- + IN PLARGE_INTEGER pNewFileSize,
- + OUT PLARGE_INTEGER pNewAllocationSize)
- +{
- + NTSTATUS status = STATUS_SUCCESS;
- + __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
- +#ifdef DEBUG_CACHE
- + PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
- + DbgEn();
- + print_debug_header(RxContext);
- + DbgP("input: bytecount=0x%lx filesize=0x%llx allocsize=0x%llx\n",
- + (long)LowIoContext->ParamsFor.ReadWrite.ByteCount,
- + (long long)pNewFileSize->QuadPart,
- + (long long)pNewAllocationSize->QuadPart);
- +#endif
- + pNewAllocationSize->QuadPart = pNewFileSize->QuadPart + 8192;
- + nfs41_fcb->StandardInfo.AllocationSize.QuadPart =
- + pNewAllocationSize->QuadPart;
- + nfs41_fcb->StandardInfo.EndOfFile.QuadPart = pNewFileSize->QuadPart;
- +#ifdef DEBUG_CACHE
- + DbgP("newfilesize=0x%llx newallocationsize=0x%llx\n",
- + (long long)pNewFileSize->QuadPart,
- + (long long)pNewAllocationSize->QuadPart);
- +#endif
- +#ifdef DEBUG_CACHE
- + DbgEx();
- +#endif
- + return status;
- +}
- --
- 2.45.1
- From 6b5be83b0773eafa10f6dfad2f31c7b9011736aa Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 10 Dec 2024 15:30:30 +0100
- Subject: [PATCH 2/6] cygwin_idmapper.ksh: Lookup local Windows accounts before
- normal accounts
- Lookup local Windows accounts before normal accounts, e.g.
- $ getent passwd "+{username} # / $ getent group "+{groupname} #,
- and then normal (domain) users via via
- $ getent passwd "{username} # / $ getent group "{groupname} #.
- This fixes the reported issue that special machine-local admin
- accounts fail NFS idmapping.
- Reported-by: Dietmar Kuenkler <dietmar.kuenkler@rovema.de>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin_idmapper.ksh | 50 +++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 48 insertions(+), 2 deletions(-)
- diff --git a/cygwin_idmapper.ksh b/cygwin_idmapper.ksh
- index 0a41b1f..be166f8 100644
- --- a/cygwin_idmapper.ksh
- +++ b/cygwin_idmapper.ksh
- @@ -180,6 +180,52 @@ compound -A localgroups=(
- )
- )
- +function getent_local_domain_passwd
- +{
- + integer res
- + typeset passwdname="$1"
- +
- + #
- + # first try local accounts and if getent does
- + # not find anything do a (normal) domain lookup
- + #
- + # Cygwin getent uses '+' prefix to search for local
- + # accounts only
- + #
- + getent passwd "+${passwdname}"
- + (( res=$? ))
- +
- + if (( res == 2 )) ; then
- + getent passwd "${passwdname}"
- + (( res=$? ))
- + fi
- +
- + return $res
- +}
- +
- +function getent_local_domain_group
- +{
- + integer res
- + typeset groupname="$1"
- +
- + #
- + # first try local accounts and if getent does
- + # not find anything do a (normal) domain lookup
- + #
- + # Cygwin getent uses '+' prefix to search for local
- + # accounts only
- + #
- + getent group "+${groupname}"
- + (( res=$? ))
- +
- + if (( res == 2 )) ; then
- + getent group "${groupname}"
- + (( res=$? ))
- + fi
- +
- + return $res
- +}
- +
- if [[ -v c.localised_groupnames['None'] ]] ; then
- localgroups+=(
- ["${c.localised_groupnames['None']}"]=(
- @@ -229,7 +275,7 @@ case "${c.mode}" in
- #
- compound gec # getent compound var
- typeset dummy1 dummy2
- - getent passwd "${c.name}" | \
- + getent_local_domain_passwd "${c.name}" | \
- IFS=':' read gec.localaccountname dummy1 gec.localuid gec.localgid dummy2
- if [[ "${gec.localaccountname-}" != '' ]] ; then
- @@ -268,7 +314,7 @@ case "${c.mode}" in
- #
- compound gec # getent compound var
- typeset dummy1 dummy2
- - getent group "${c.name}" | \
- + getent_local_domain_group "${c.name}" | \
- IFS=':' read gec.localgroupname dummy1 gec.localgid dummy2
- if [[ "${gec.localgroupname-}" != '' ]] ; then
- --
- 2.45.1
- From 6c23aae520a6a12887e9eabc297a8eb0bd19521f Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 10 Dec 2024 15:49:19 +0100
- Subject: [PATCH 3/6] cygwin: cygwinaccount2nfs4account: Lookup local Windows
- accounts before normal accounts
- Lookup local Windows accounts before normal accounts, e.g.
- $ getent passwd "+{username} # / $ getent group "+{groupname} #,
- and then normal (domain) users via via
- $ getent passwd "{username} # / $ getent group "{groupname} #.
- This fixes the reported issue that special machine-local admin
- accounts cannot be handled by cygwinaccount2nfs4account.ksh
- Reported-by: Dietmar Kuenkler <dietmar.kuenkler@rovema.de>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- .../cygwinaccount2nfs4account.ksh | 52 +++++++++++++++++--
- 1 file changed, 49 insertions(+), 3 deletions(-)
- diff --git a/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh b/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- index dbb440f..c26414f 100644
- --- a/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- +++ b/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- @@ -40,6 +40,52 @@ function usage
- return 2
- }
- +function getent_local_domain_passwd
- +{
- + integer res
- + typeset passwdname="$1"
- +
- + #
- + # first try local accounts and if getent does
- + # not find anything do a (normal) domain lookup
- + #
- + # Cygwin getent uses '+' prefix to search for local
- + # accounts only
- + #
- + getent passwd "+${passwdname}"
- + (( res=$? ))
- +
- + if (( res == 2 )) ; then
- + getent passwd "${passwdname}"
- + (( res=$? ))
- + fi
- +
- + return $res
- +}
- +
- +function getent_local_domain_group
- +{
- + integer res
- + typeset groupname="$1"
- +
- + #
- + # first try local accounts and if getent does
- + # not find anything do a (normal) domain lookup
- + #
- + # Cygwin getent uses '+' prefix to search for local
- + # accounts only
- + #
- + getent group "+${groupname}"
- + (( res=$? ))
- +
- + if (( res == 2 )) ; then
- + getent group "${groupname}"
- + (( res=$? ))
- + fi
- +
- + return $res
- +}
- +
- function getent_passwd2compound
- {
- set -o nounset
- @@ -51,7 +97,7 @@ function getent_passwd2compound
- compound out
- # capture getent output
- - out.stderr="${ { out.stdout="${ getent passwd "$username" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
- + out.stderr="${ { out.stdout="${ getent_local_domain_passwd "$username" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
- if [[ "${out.stderr}" != '' ]] || (( out.res != 0 )) ; then
- print -u2 $"%s: getent failed, msg=%q, res=%d\n" \
- @@ -102,7 +148,7 @@ function getent_group2compound
- compound out
- # capture getent output
- - out.stderr="${ { out.stdout="${ getent group "$groupname" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
- + out.stderr="${ { out.stdout="${ getent_local_domain_group "$groupname" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
- if [[ "${out.stderr}" != '' ]] || (( out.res != 0 )) ; then
- print -u2 $"%s: getent failed, msg=%q, res=%d\n" \
- @@ -338,7 +384,7 @@ function main
- # fixme: Need better text layout for $ nfsurlconv --man #
- typeset -r cygwinaccount2nfs4account_usage=$'+
- - [-?\n@(#)\$Id: cygwinaccount2nfs4account (Roland Mainz) 2024-08-01 \$\n]
- + [-?\n@(#)\$Id: cygwinaccount2nfs4account (Roland Mainz) 2024-12-10 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?cygwinaccount2nfs4account - convert Cygwin user/group account
- info to Linux/UNIX NFSv4 server account data]
- --
- 2.45.1
- From 952e2732b17b86092d9a4f1f7d39ccf783a7b44c Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 10 Dec 2024 15:51:50 +0100
- Subject: [PATCH 4/6] cygwin: cygwinaccount2nfs4account: Fix error messages
- Fix error messages in cygwinaccount2nfs4account.ksh
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- .../cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
- diff --git a/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh b/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- index c26414f..5ee474a 100644
- --- a/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- +++ b/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- @@ -100,7 +100,7 @@ function getent_passwd2compound
- out.stderr="${ { out.stdout="${ getent_local_domain_passwd "$username" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
- if [[ "${out.stderr}" != '' ]] || (( out.res != 0 )) ; then
- - print -u2 $"%s: getent failed, msg=%q, res=%d\n" \
- + print -u2 -f $"%s: getent failed, msg=%q, res=%d\n" \
- "$0" "${out.stderr}" out.res
- return 1
- fi
- @@ -151,7 +151,7 @@ function getent_group2compound
- out.stderr="${ { out.stdout="${ getent_local_domain_group "$groupname" ; (( out.res=$? )) ; }" ; } 2>&1 ; }"
- if [[ "${out.stderr}" != '' ]] || (( out.res != 0 )) ; then
- - print -u2 $"%s: getent failed, msg=%q, res=%d\n" \
- + print -u2 -f $"%s: getent failed, msg=%q, res=%d\n" \
- "$0" "${out.stderr}" out.res
- return 1
- fi
- @@ -336,7 +336,7 @@ function convert_givenuser2linuxscript
- (( out.res=$? )) ; }" ; } 2>&1 ; }"
- if [[ "${out.stderr}" != '' ]] || (( out.res != 0 )) ; then
- - print -u2 $"%s: powershell querying groups from DS failed, msg=%q, res=%d\n" \
- + print -u2 -f $"%s: powershell querying groups from DS failed, msg=%q, res=%d\n" \
- "$0" "${out.stderr}" out.res
- return 1
- fi
- --
- 2.45.1
- From cbcbdc6cf7bb3a1e6bfc255f2df94c1d43e05429 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 10 Dec 2024 15:52:40 +0100
- Subject: [PATCH 5/6] cygwin: Fix typo in cygwinaccount2nfs4account
- Fix typo in cygwinaccount2nfs4account.ksh
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- .../cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh b/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- index 5ee474a..f2c99bd 100644
- --- a/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- +++ b/cygwin/utils/cygwinaccount2nfs4account/cygwinaccount2nfs4account.ksh
- @@ -382,7 +382,7 @@ function main
- {
- set -o nounset
- - # fixme: Need better text layout for $ nfsurlconv --man #
- + # fixme: Need better text layout for $ cygwinaccount2nfs4account --man #
- typeset -r cygwinaccount2nfs4account_usage=$'+
- [-?\n@(#)\$Id: cygwinaccount2nfs4account (Roland Mainz) 2024-12-10 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- --
- 2.45.1
- From a9f012af6fbf745f92b4a1d0e27b6efaaa2901f6 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 10 Dec 2024 17:14:46 +0100
- Subject: [PATCH 6/6] sys: |MmMapLockedPagesSpecifyCache()| should not BUGCHECK
- on mapping failure
- |MmMapLockedPagesSpecifyCache()| should not BUGCHECK on mapping failure.
- Reported-by: Hermes Belusca-Maito <hermes.belusca-maito@reactos.org>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_dir.c | 2 +-
- sys/nfs41sys_openclose.c | 2 +-
- sys/nfs41sys_readwrite.c | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
- diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
- index 0031cbf..815904a 100644
- --- a/sys/nfs41sys_dir.c
- +++ b/sys/nfs41sys_dir.c
- @@ -104,7 +104,7 @@ NTSTATUS marshal_nfs41_dirquery(
- __try {
- entry->u.QueryFile.mdl_buf =
- MmMapLockedPagesSpecifyCache(entry->u.QueryFile.mdl,
- - UserMode, MmCached, NULL, TRUE,
- + UserMode, MmCached, NULL, FALSE,
- NormalPagePriority|MdlMappingNoExecute);
- if (entry->u.QueryFile.mdl_buf == NULL) {
- print_error("marshal_nfs41_dirquery: "
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index af0cf10..86473e5 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -163,7 +163,7 @@ NTSTATUS marshal_nfs41_open(
- if (entry->u.Open.EaMdl) {
- entry->u.Open.EaBuffer =
- MmMapLockedPagesSpecifyCache(entry->u.Open.EaMdl,
- - UserMode, MmCached, NULL, TRUE,
- + UserMode, MmCached, NULL, FALSE,
- NormalPagePriority|MdlMappingNoExecute);
- if (entry->u.Open.EaBuffer == NULL) {
- print_error("marshal_nfs41_open: "
- diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
- index 40ee1ca..050819c 100644
- --- a/sys/nfs41sys_readwrite.c
- +++ b/sys/nfs41sys_readwrite.c
- @@ -120,7 +120,7 @@ NTSTATUS marshal_nfs41_rw(
- #pragma warning( pop )
- entry->buf =
- MmMapLockedPagesSpecifyCache(entry->u.ReadWrite.MdlAddress,
- - UserMode, MmCached, NULL, TRUE, NormalPagePriority);
- + UserMode, MmCached, NULL, FALSE, NormalPagePriority);
- if (entry->buf == NULL) {
- print_error("marshal_nfs41_rw: "
- "MmMapLockedPagesSpecifyCache() failed to map pages\n");
- --
- 2.45.1
msnfs41client: Patches for idmapping local Windows accounts, cygwinaccount2nfs4account+misc, 2024-12-10
Posted by Anonymous on Tue 10th Dec 2024 17: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.