- From 8299f6df0331998f366d35d503b44b52cb9f00c4 Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Wed, 18 Jun 2025 11:51:03 +0200
- Subject: [PATCH 1/5] daemon: |duplicate_sparsefile()| should clear all of
- |info|
- |duplicate_sparsefile()| should clear all of struct |info|.
- Found via ReactOS clang compiler warning.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/fsctl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/daemon/fsctl.c b/daemon/fsctl.c
- index 96f616f..5fa19c8 100644
- --- a/daemon/fsctl.c
- +++ b/daemon/fsctl.c
- @@ -492,7 +492,7 @@ int duplicate_sparsefile(nfs41_open_state *src_state,
- stateid_arg src_stateid;
- stateid_arg dst_stateid;
- - (void)memset(info, 0, sizeof(info));
- + (void)memset(info, 0, sizeof(*info));
- DPRINTF(DDLVL,
- ("--> duplicate_sparsefile(src_state->path.path='%s')\n",
- --
- 2.45.1
- From 2568995b4b7e010d8290526490b3a1f485d84371 Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Wed, 18 Jun 2025 11:52:48 +0200
- Subject: [PATCH 2/5] daemon: Fix clang compiler warning in
- |recover_delegation_open()|
- Fix clang compiler warning in |recover_delegation_open()|:
- 'memcpy' call operates on objects of type 'nfs41_delegation_state'
- (aka 'struct __nfs41_delegation_state') while the size is based on
- a different type 'nfs41_delegation_state *' (aka
- 'struct __nfs41_delegation_state *')
- The warning is wrong in this specific case, as a pointer stunt is
- used to create a token value.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/recovery.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
- diff --git a/daemon/recovery.c b/daemon/recovery.c
- index c3dd695..99a2795 100644
- --- a/daemon/recovery.c
- +++ b/daemon/recovery.c
- @@ -418,9 +418,10 @@ static int recover_delegation_open(
- /* construct a temporary open owner by concatenating the time
- * in seconds with the delegation pointer */
- - time((time_t*)owner.owner);
- - memcpy(owner.owner + sizeof(time_t), deleg, sizeof(deleg));
- - owner.owner_len = sizeof(time_t) + sizeof(deleg);
- + void *dp = deleg;
- + (void)time((time_t*)owner.owner);
- + (void)memcpy(owner.owner + sizeof(time_t), dp, sizeof(dp));
- + owner.owner_len = sizeof(time_t) + sizeof(dp);
- if (*grace) {
- status = recover_open_grace(session, &deleg->parent, &deleg->file,
- --
- 2.45.1
- From deaf5ac3f0ec4ccbe78ce10ba203e2af77906775 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 18 Jun 2025 11:56:36 +0200
- Subject: [PATCH 3/5] cygwin: winsg.exe should be usable from
- cmd.exe+powershell.exe
- winsg.exe should be usable from cmd.exe+powershell.exe.
- This didn't work because winsg.exe was created via Cygwin ln -s
- to map it to the correct 32bit/64bit version - but on NTFS Cygwin
- uses <JUNCTION> for POIX symlinks, because <SYMLINK> requires the
- SeCreateSymbolicLinkPrivilege (which by default not even Adminstrators
- have).
- Unfortunately cmd.exe and powershell.exe only follow <SYMLINK> for
- looking up *.exe files, but NOT <JUNCTION>, and therefore winsg.exe
- could not be used from cmd.exe even if C:\cygwin64\bin is in %PATH%.
- As fix/workaround we now use hardlinks to map winsg.exe to map
- it to the correct 32bit+64bit version.
- Reported-by: Aurelien Couderc <aurelien.couderc2002@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/Makefile.install | 27 +++++++++++++++++----------
- 1 file changed, 17 insertions(+), 10 deletions(-)
- diff --git a/cygwin/Makefile.install b/cygwin/Makefile.install
- index e3d8e5a..ba7d0ed 100644
- --- a/cygwin/Makefile.install
- +++ b/cygwin/Makefile.install
- @@ -13,6 +13,12 @@ PROJECT_BASEDIR_DIR := $(shell dirname $(realpath $(CYGWIN_MAKEFILE_DIR)/))
- DESTDIR := $(PROJECT_BASEDIR_DIR)/destdir
- +# link *.exe
- +# We have to use hardlinks here, because cygwin defaults to use <JUNCTION>s,
- +# which neither cmd.exe nor powershell can follow. <SYMLINK>s are not an option,
- +# because it woulld required the "SeCreateSymbolicLinkPrivilege", which by default
- +# not even the Adminstrator has
- +LINKEXE = ln -f
- # install in DESTDIR
- installdest:
- @@ -70,7 +76,8 @@ installdest:
- cp $(PROJECT_BASEDIR_DIR)/ms-nfs41-idmap.conf $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/.
- cp $(CYGWIN_MAKEFILE_DIR)/devel/msnfs41client.bash $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/msnfs41client
- chmod a+x "$(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/msnfs41client"
- - (cd "$(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/" && ln -sf ../lib/msnfs41client/msnfs41client .)
- + # this must be a symlink, so msnfs41client can find it's real location
- + (cd "$(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/" && ln -s -f ../lib/msnfs41client/msnfs41client .)
- cp $(PROJECT_BASEDIR_DIR)/cygwin_idmapper.ksh $(DESTDIR)/$(CYGWIN_BASEPATH)/lib/msnfs41client/.
- @ printf "# Package sources and diffs\n"
- git config --global --add safe.directory "$(PROJECT_BASEDIR_DIR)"
- @@ -100,34 +107,34 @@ installdest:
- cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.x86_64.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/winfsinfo.x86_64.exe
- cp "$(PROJECT_BASEDIR_DIR)/tests/winfsinfo1/winfsinfo.i686.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/winfsinfo.i686.exe
- if [[ "$(CYGWIN_BASEPATH)" == *64* ]] ; then \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf winfsinfo.x86_64.exe winfsinfo.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) winfsinfo.x86_64.exe winfsinfo.exe) \
- else \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf winfsinfo.i686.exe winfsinfo.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) winfsinfo.i686.exe winfsinfo.exe) \
- fi
- cp "$(PROJECT_BASEDIR_DIR)/tests/winclonefile/winclonefile.x86_64.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/winclonefile.x86_64.exe
- cp "$(PROJECT_BASEDIR_DIR)/tests/winclonefile/winclonefile.i686.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/winclonefile.i686.exe
- if [[ "$(CYGWIN_BASEPATH)" == *64* ]] ; then \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf winclonefile.x86_64.exe winclonefile.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) winclonefile.x86_64.exe winclonefile.exe) \
- else \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf winclonefile.i686.exe winclonefile.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) winclonefile.i686.exe winclonefile.exe) \
- fi
- cp "$(PROJECT_BASEDIR_DIR)/tests/lssparse/lssparse.x86_64.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/lssparse.x86_64.exe
- if [[ "$(CYGWIN_BASEPATH)" == *64* ]] ; then \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf lssparse.x86_64.exe lssparse.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) lssparse.x86_64.exe lssparse.exe) \
- fi
- cp "$(PROJECT_BASEDIR_DIR)/tests/winsg/winsg.x86_64.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/winsg.x86_64.exe
- cp "$(PROJECT_BASEDIR_DIR)/tests/winsg/winsg.i686.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/winsg.i686.exe
- if [[ "$(CYGWIN_BASEPATH)" == *64* ]] ; then \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf winsg.x86_64.exe winsg.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) winsg.x86_64.exe winsg.exe) \
- else \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf winsg.i686.exe winsg.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) winsg.i686.exe winsg.exe) \
- fi
- cp "$(PROJECT_BASEDIR_DIR)/tests/ea/nfs_ea.x86_64.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/nfs_ea.x86_64.exe
- cp "$(PROJECT_BASEDIR_DIR)/tests/ea/nfs_ea.i686.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/nfs_ea.i686.exe
- if [[ "$(CYGWIN_BASEPATH)" == *64* ]] ; then \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf nfs_ea.x86_64.exe nfs_ea.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) nfs_ea.x86_64.exe nfs_ea.exe) \
- else \
- - (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && ln -sf nfs_ea.i686.exe nfs_ea.exe) \
- + (cd $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ && $(LINKEXE) nfs_ea.i686.exe nfs_ea.exe) \
- fi
- cp $(PROJECT_BASEDIR_DIR)/tests/nfsbuildtest/nfsbuildtest.ksh93 $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client/tests/misc/nfsbuildtest.ksh93
- cp $(PROJECT_BASEDIR_DIR)/tests/sparsefiles/testsparsefile1.ksh $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client/tests/sparsefiles/testsparsefile1.ksh
- --
- 2.45.1
- From b009ffed0eb2746d061dca99e3490179ff0072ec Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 18 Jun 2025 16:13:11 +0200
- Subject: [PATCH 4/5] daemon: Add UTF-8 versions of |UNLEN| and |GNLEN|
- Add UTF-8 versions of |UNLEN| and |GNLEN|.
- User and group name buffer length constants |UNLEN| and |GNLEN|
- count in codepage characters. Since our code stores these values
- as codepage-independent UTF-8 bytes sequences we need to provide
- constants for such buffers.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/accesstoken.c | 17 ++++++++---------
- daemon/acl.c | 11 +++++------
- daemon/daemon_debug.c | 10 +++++-----
- daemon/nfs41_client.c | 6 ++++--
- daemon/nfs41_daemon.c | 5 ++---
- daemon/sid.c | 10 +++-------
- daemon/sid.h | 13 +++++++++++++
- 7 files changed, 40 insertions(+), 32 deletions(-)
- diff --git a/daemon/accesstoken.c b/daemon/accesstoken.c
- index eae34c6..c082a58 100644
- --- a/daemon/accesstoken.c
- +++ b/daemon/accesstoken.c
- @@ -24,7 +24,6 @@
- #include "sid.h"
- #include "daemon_debug.h"
- #include "nfs41_daemon.h"
- -#include <Lmcons.h>
- #ifndef _NFS41_DRIVER_BUILDFEATURES_
- #error NFS41 build config not included
- @@ -48,8 +47,8 @@ bool get_token_user_name(HANDLE tok, char *out_buffer)
- DWORD tokdatalen;
- PTOKEN_USER ptuser;
- PSID pusid;
- - DWORD namesize = UNLEN+1;
- - char domainbuffer[UNLEN+1];
- + DWORD namesize = UTF8_UNLEN+1;
- + char domainbuffer[UTF8_UNLEN+1];
- DWORD domainbuffer_size = sizeof(domainbuffer);
- SID_NAME_USE name_use;
- @@ -92,8 +91,8 @@ bool get_token_primarygroup_name(HANDLE tok, char *out_buffer)
- DWORD tokdatalen;
- PTOKEN_PRIMARY_GROUP ptpgroup;
- PSID pgsid;
- - DWORD namesize = GNLEN+1;
- - char domainbuffer[UNLEN+1];
- + DWORD namesize = UTF8_GNLEN+1;
- + char domainbuffer[UTF8_UNLEN+1];
- DWORD domainbuffer_size = sizeof(domainbuffer);
- SID_NAME_USE name_use;
- @@ -134,7 +133,7 @@ bool get_token_primarygroup_name(HANDLE tok, char *out_buffer)
- bool fill_auth_unix_aup_gids(HANDLE tok,
- gid_t *aup_gids, int *num_aup_gids)
- {
- - char group_names_buff[RPC_AUTHUNIX_AUP_MAX_NUM_GIDS*(GNLEN+1)];
- + char group_names_buff[RPC_AUTHUNIX_AUP_MAX_NUM_GIDS*(UTF8_GNLEN+1)];
- char *group_names[RPC_AUTHUNIX_AUP_MAX_NUM_GIDS];
- char *s;
- int i;
- @@ -149,7 +148,7 @@ bool fill_auth_unix_aup_gids(HANDLE tok,
- */
- for (s=group_names_buff,i=0 ; i < RPC_AUTHUNIX_AUP_MAX_NUM_GIDS ; i++) {
- group_names[i] = s;
- - s += GNLEN+1;
- + s += UTF8_GNLEN+1;
- }
- if (!get_token_groups_names(tok,
- @@ -186,9 +185,9 @@ bool get_token_groups_names(HANDLE tok,
- {
- DWORD tokdatalen;
- PTOKEN_GROUPS ptgroups;
- - char namebuffer[GNLEN+1];
- + char namebuffer[UTF8_GNLEN+1];
- DWORD namesize;
- - char domainbuffer[UNLEN+1];
- + char domainbuffer[UTF8_UNLEN+1];
- DWORD domainbuffer_size;
- SID_NAME_USE name_use;
- bool retval = false;
- diff --git a/daemon/acl.c b/daemon/acl.c
- index 5861f1e..370f2d3 100644
- --- a/daemon/acl.c
- +++ b/daemon/acl.c
- @@ -25,7 +25,6 @@
- #include <stdio.h>
- #include <strsafe.h>
- #include <sddl.h>
- -#include <Lmcons.h>
- #include "nfs41_ops.h"
- #include "nfs41_build_features.h"
- @@ -930,9 +929,9 @@ int map_sid2nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid,
- {
- int status, lasterr;
- SID_NAME_USE sid_type = 0;
- - /* |(UNLEN+sizeof('\0'))*2| so we have space for user+domain */
- - char who_buf[(UNLEN+1)*2];
- - char domain_buf[UNLEN+1];
- + /* |(UTF8_UNLEN+sizeof('\0'))*2| so we have space for user+domain */
- + char who_buf[(UTF8_UNLEN+1)*2];
- + char domain_buf[UTF8_UNLEN+1];
- DWORD who_size = sizeof(who_buf), domain_size = sizeof(domain_buf);
- LPSTR sidstr = NULL;
- @@ -1035,7 +1034,7 @@ int map_sid2nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid,
- if (unixuser_sid2uid(sid, &unixuser_uid)) {
- if (!nfs41_idmap_uid_to_name(nfs41_dg.idmapper,
- - unixuser_uid, who_out, UNLEN)) {
- + unixuser_uid, who_out, UTF8_UNLEN)) {
- who_size = (DWORD)strlen(who_out);
- sid_type = SidTypeUser;
- status = ERROR_SUCCESS;
- @@ -1056,7 +1055,7 @@ int map_sid2nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid,
- if (unixgroup_sid2gid(sid, &unixgroup_gid)) {
- if (!nfs41_idmap_gid_to_group(nfs41_dg.idmapper,
- - unixgroup_gid, who_out, GNLEN)) {
- + unixgroup_gid, who_out, UTF8_GNLEN)) {
- who_size = (DWORD)strlen(who_out);
- sid_type = SidTypeGroup;
- status = ERROR_SUCCESS;
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index 0d83e99..20fd420 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -24,7 +24,6 @@
- #include <windows.h>
- #include <stdio.h>
- #include <sddl.h>
- -#include <lmcons.h>
- #include <direct.h> /* for |_getcwd()| */
- #include "daemon_debug.h"
- @@ -35,6 +34,7 @@
- #include "rpc/rpc.h"
- #include "rpc/auth_sspi.h"
- #include "accesstoken.h"
- +#include "sid.h"
- int g_debug_level = DEFAULT_DEBUG_LEVEL;
- @@ -107,8 +107,8 @@ void dprintf_out(const char *restrict format, ...)
- va_list args;
- va_start(args, format);
- #ifdef DPRINTF_PRINT_IMPERSONATION_USER
- - char username[UNLEN+1];
- - char groupname[GNLEN+1];
- + char username[UTF8_UNLEN+1];
- + char groupname[UTF8_GNLEN+1];
- HANDLE tok;
- const char *tok_src;
- bool free_tok = false;
- @@ -171,8 +171,8 @@ void logprintf(const char *restrict format, ...)
- #endif /* _MSC_VER */
- {
- SYSTEMTIME stime;
- - char username[UNLEN+1];
- - char groupname[GNLEN+1];
- + char username[UTF8_UNLEN+1];
- + char groupname[UTF8_GNLEN+1];
- HANDLE tok;
- const char *tok_src;
- bool free_tok = false;
- diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c
- index a31d336..92319e7 100644
- --- a/daemon/nfs41_client.c
- +++ b/daemon/nfs41_client.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) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -34,6 +35,7 @@
- #include "daemon_debug.h"
- #include "nfs41_ops.h"
- #include "accesstoken.h"
- +#include "sid.h"
- uint32_t nfs41_exchange_id_flags(
- @@ -374,7 +376,7 @@ int nfs41_client_owner(
- DWORD length;
- const ULONGLONG time_created = GetTickCount64();
- int status;
- - char username[UNLEN+1];
- + char username[UTF8_UNLEN+1];
- HANDLE thrtoken = GetCurrentThreadEffectiveToken();
- #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
- LUID authenticationid;
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index 8e3dcc2..8aba2f6 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -30,7 +30,6 @@
- #include <stdio.h>
- #include <devioctl.h>
- -#include <lmcons.h> /* UNLEN for GetUserName() */
- #include <iphlpapi.h> /* for GetNetworkParam() */
- #include "nfs41_build_features.h"
- #include "nfs41_driver.h" /* for NFS41_USER_DEVICE_NAME_A */
- @@ -76,8 +75,8 @@ typedef struct _nfs41_process_thread {
- static int map_current_user_to_ids(nfs41_idmapper *idmapper,
- HANDLE impersonation_tok, uid_t *puid, gid_t *pgid)
- {
- - char username[UNLEN+1];
- - char pgroupname[GNLEN+1];
- + char username[UTF8_UNLEN+1];
- + char pgroupname[UTF8_GNLEN+1];
- int status = NO_ERROR;
- if (!get_token_user_name(impersonation_tok, username)) {
- diff --git a/daemon/sid.c b/daemon/sid.c
- index 0ce84f8..945f744 100644
- --- a/daemon/sid.c
- +++ b/daemon/sid.c
- @@ -27,7 +27,6 @@
- #include <time.h>
- #include <strsafe.h>
- #include <sddl.h>
- -#include <Lmcons.h>
- #include "nfs41_ops.h"
- #include "nfs41_build_features.h"
- @@ -226,7 +225,7 @@ bool unixgroup_sid2gid(PSID psid, gid_t *pgid)
- typedef struct _sidcache_entry
- {
- -#define SIDCACHE_ENTRY_NAME_SIZE (UNLEN + 1)
- +#define SIDCACHE_ENTRY_NAME_SIZE (UTF8_UNLEN + 1)
- char win32name[SIDCACHE_ENTRY_NAME_SIZE]; /* must fit something like "user@domain" */
- char aliasname[SIDCACHE_ENTRY_NAME_SIZE];
- PSID sid;
- @@ -426,8 +425,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
- int status = ERROR_INTERNAL_ERROR;
- SID_NAME_USE sid_type = 0;
- - char nfsname_buff[UNLEN+1];
- - char domain_buff[UNLEN+1];
- + char nfsname_buff[UTF8_UNLEN+1];
- + char domain_buff[UTF8_UNLEN+1];
- DWORD domain_len = 0;
- #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
- signed long user_uid = -1;
- @@ -747,9 +746,6 @@ out_free_sid:
- }
- -/* Maximum number of bytes required to store one |wchar_t| as UTF-8 */
- -#define MAX_UTF8_BYTES_PER_WCHAR_T (5)
- -
- /*
- * |lookupaccountnameutf8()| - UTF-8 version of |LookupAccountNameA()|
- *
- diff --git a/daemon/sid.h b/daemon/sid.h
- index c19b3d9..3e12c6d 100644
- --- a/daemon/sid.h
- +++ b/daemon/sid.h
- @@ -28,12 +28,25 @@
- #include "nfs41_build_features.h"
- #include "nfs41_daemon.h"
- #include <stdbool.h>
- +#include <Lmcons.h> /* for |UNLEN| and |GNLEN| */
- typedef struct _sidcache sidcache;
- extern sidcache user_sidcache;
- extern sidcache group_sidcache;
- +/* Maximum number of bytes required to store one |wchar_t| as UTF-8 */
- +#define MAX_UTF8_BYTES_PER_WCHAR_T (5)
- +
- +/*
- + * |UNLEN|+|GNLEN| count in codepage characters, but since we store
- + * our user and group names as UTF-8 we need buffer sizes which can
- + * hold the maximum length in UTF-8
- + */
- +#define UTF8_UNLEN (UNLEN*MAX_UTF8_BYTES_PER_WCHAR_T)
- +#define UTF8_GNLEN (GNLEN*MAX_UTF8_BYTES_PER_WCHAR_T)
- +
- +
- /*
- * DECLARE_SID_BUFFER - declare a buffer for a SID value
- * Note that buffers with SID values must be 16byte aligned
- --
- 2.45.1
- From fd75f2aafff2808f5aba7fdf73b787e3c80a9620 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 18 Jun 2025 17:45:07 +0200
- Subject: [PATCH 5/5] daemon,sys: |IOCTL_NFS41_READ| and |IOCTL_NFS41_WRITE|
- should return error codes on failure
- |IOCTL_NFS41_READ| and |IOCTL_NFS41_WRITE| should return error codes on failure.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41_daemon.c | 4 +++-
- sys/nfs41sys_updowncall.c | 25 +++++++------------------
- 2 files changed, 10 insertions(+), 19 deletions(-)
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index 8aba2f6..d8bf867 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -168,7 +168,9 @@ static unsigned int nfsd_worker_thread_main(void *args)
- status = DeviceIoControl(pipe, IOCTL_NFS41_READ, NULL, 0,
- outbuf, UPCALL_BUF_SIZE, (LPDWORD)&outbuf_len, NULL);
- if (!status) {
- - eprintf("IOCTL_NFS41_READ failed %d\n", GetLastError());
- + eprintf("nfsd_worker_thread_main: "
- + "IOCTL_NFS41_READ failed, status=0x%x, lasterr=%d\n",
- + status, (int)GetLastError());
- continue;
- }
- diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
- index 29e7ac5..9ec5382 100644
- --- a/sys/nfs41sys_updowncall.c
- +++ b/sys/nfs41sys_updowncall.c
- @@ -590,13 +590,6 @@ process_upcall:
- RxContext->InformationToReturn = len;
- }
- else {
- -/*
- - * gisburn: |NFSV41_UPCALL_RETRY_WAIT| disabled for now because it
- - * causes nfsd_debug.exe to hang on <CTRL-C>
- - */
- -#ifdef NFSV41_UPCALL_RETRY_WAIT
- -retry_wait:
- -#endif /* NFSV41_UPCALL_RETRY_WAIT */
- status = KeWaitForSingleObject(&upcallEvent, Executive, UserMode, TRUE,
- (PLARGE_INTEGER) NULL);
- print_wait_status(0, "[upcall]", status, NULL, NULL, 0);
- @@ -606,17 +599,9 @@ retry_wait:
- case STATUS_USER_APC:
- case STATUS_ALERTED:
- DbgP("nfs41_upcall: KeWaitForSingleObject() "
- - "returned status(=0x%lx)"
- -#ifdef NFSV41_UPCALL_RETRY_WAIT
- - ", retry waiting"
- -#endif /* NFSV41_UPCALL_RETRY_WAIT */
- - "\n",
- + "returned status(=0x%lx)\n",
- (long)status);
- -#ifdef NFSV41_UPCALL_RETRY_WAIT
- - goto retry_wait;
- -#else
- - /* fall-through */
- -#endif /* NFSV41_UPCALL_RETRY_WAIT */
- + goto out;
- default:
- DbgP("nfs41_upcall: KeWaitForSingleObject() "
- "returned UNEXPECTED status(=0x%lx)\n",
- @@ -652,7 +637,10 @@ NTSTATUS nfs41_downcall(
- tmp = &stacktmp;
- #else
- tmp = nfs41_downcall_allocate_updowncall_entry();
- - if (tmp == NULL) goto out;
- + if (tmp == NULL) {
- + status = STATUS_INSUFFICIENT_RESOURCES;
- + goto out;
- + }
- #endif /* USE_STACK_FOR_DOWNCALL_UPDOWNCALLENTRY_MEM */
- unmarshal_nfs41_header(tmp, &buf);
- @@ -675,6 +663,7 @@ NTSTATUS nfs41_downcall(
- SeStopImpersonatingClient();
- if (!found) {
- print_error("Didn't find xid=%lld entry\n", tmp->xid);
- + status = STATUS_NOT_FOUND;
- goto out_free;
- }
- --
- 2.45.1
msnfs41client: Patches for winsgfromcmd.exe, clangfixes+misc, 2025-06-18
Posted by Anonymous on Wed 18th Jun 2025 17:24
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.