pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for rejecting install if service is running, DFS "\IPC$" pipe+misc, 2025-08-14
Posted by Anonymous on Thu 14th Aug 2025 16:08
raw | new post

  1. From d69478f43ad6119a654aa0ef3c1850adb1d35179 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Thu, 14 Aug 2025 11:00:43 +0200
  4. Subject: [PATCH 1/3] cygwin: /sbin/msnfs41client install should not work while
  5.  the ms-nfs41-client servcices are running
  6.  
  7. /sbin/msnfs41client install should not work while the ms-nfs41-client
  8. servcices are running, and provide instructions what to do in this case.
  9.  
  10. Reported-by: Lionel Cons <Lionelcons1972@gmail.com>
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. cygwin/devel/msnfs41client.bash | 44 +++++++++++++++++++++++++++++++++
  14.  1 file changed, 44 insertions(+)
  15.  
  16. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  17. index d00e59e..492921f 100755
  18. --- a/cygwin/devel/msnfs41client.bash
  19. +++ b/cygwin/devel/msnfs41client.bash
  20. @@ -117,6 +117,40 @@ function check_machine_arch
  21.         # not reached
  22.  }
  23.  
  24. +function is_service_stopped
  25. +{
  26. +       typeset service_name="$1"
  27. +       typeset -i res
  28. +       typeset stdout
  29. +
  30. +       stdout="$( sc query "$service_name" )" ; (( res=$? ))
  31. +
  32. +       if (( res != 0 )) ; then
  33. +               printf "%s: sc failed, msg=%q\n" "$0" "$stdout" 1>&2
  34. +               return 1
  35. +       fi
  36. +
  37. +       if [[ "$stdout" == *STOPPED* ]] ; then
  38. +               return 0
  39. +       fi
  40. +
  41. +       return 1
  42. +}
  43. +
  44. +function is_service_installed
  45. +{
  46. +       typeset service_name="$1"
  47. +       typeset -i res
  48. +
  49. +       sc getdisplayname "$service_name" >'/dev/null' 2>&1 ; (( res=$? ))
  50. +
  51. +       if (( res == 0 )) ; then
  52. +               return 0
  53. +       fi
  54. +
  55. +       return 1
  56. +}
  57. +
  58.  function nfsclient_install
  59.  {
  60.         set -o nounset
  61. @@ -127,6 +161,16 @@ function nfsclient_install
  62.  
  63.         typeset use_secureboot=false
  64.  
  65. +       if is_service_installed 'ms-nfs41-client-service' ; then
  66. +               if ! is_service_stopped 'ms-nfs41-client-service' ; then
  67. +                       set -o xtrace # make message below more readable
  68. +                       printf 'ms-nfs41-client-service is still running.\n'
  69. +                       printf 'Please disable the service via $ /sbin/msnfs41client disableautostartservices #,\n'
  70. +                       printf 'reboot and then install the new version of ms-nfs41-client via $ /sbin/msnfs41client install #\n'
  71. +                       return 1
  72. +               fi
  73. +       fi
  74. +
  75.         # switch to the location where this script is installed,
  76.         # because on Cygwin the script will be installed
  77.         # in /cygdrive/c/cygwin/lib/msnfs41client/ (32bit) or
  78. --
  79. 2.45.1
  80.  
  81. From 469bc289f0881bc003d8c36c870deb5eb1d916d3 Mon Sep 17 00:00:00 2001
  82. From: Roland Mainz <roland.mainz@nrubsig.org>
  83. Date: Thu, 14 Aug 2025 11:03:13 +0200
  84. Subject: [PATCH 2/3] cygwin: Replace ksh93-specific print(1) usage with
  85.  printf(1)
  86.  
  87. Replace ksh93-specific print(1) ($ print -u2 ... #) usage with
  88. printf(1) ($ printf ... 1>&2 #).
  89.  
  90. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  91. ---
  92. cygwin/devel/msnfs41client.bash | 4 ++--
  93.  1 file changed, 2 insertions(+), 2 deletions(-)
  94.  
  95. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  96. index 492921f..cc104a6 100755
  97. --- a/cygwin/devel/msnfs41client.bash
  98. +++ b/cygwin/devel/msnfs41client.bash
  99. @@ -840,7 +840,7 @@ function nfsclient_system_mount_globaldirs
  100.         set -o errexit
  101.  
  102.         if ! nfsclient_waitfor_clientdaemon ; then
  103. -               print -u2 -f $"%s: nfsd*.exe not running.\n" "$0"
  104. +               printf $"%s: nfsd*.exe not running.\n" "$0" 1>&2
  105.                 return 1
  106.         fi
  107.  
  108. @@ -862,7 +862,7 @@ function nfsclient_mount_homedir
  109.         set -o errexit
  110.  
  111.         if ! nfsclient_waitfor_clientdaemon ; then
  112. -               print -u2 -f $"%s: nfsd*.exe not running.\n" "$0"
  113. +               printf $"%s: nfsd*.exe not running.\n" "$0" 1>&2
  114.                 return 1
  115.         fi
  116.  
  117. --
  118. 2.45.1
  119.  
  120. From dc3805eb27c8f1859436cb51d074c0ee5c715a29 Mon Sep 17 00:00:00 2001
  121. From: Roland Mainz <roland.mainz@nrubsig.org>
  122. Date: Thu, 14 Aug 2025 14:14:59 +0200
  123. Subject: [PATCH 3/3] sys: Handle |MRxCreateVNetRoot()| \\IPC$ requests by DFS
  124.  
  125. Handle |MRxCreateVNetRoot()| \\IPC$ requests which DFS uses to check whether
  126. this is a DFS path. We do not support DFS, so we return
  127. |STATUS_MORE_PROCESSING_REQUIRED|.
  128.  
  129. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  130. ---
  131. sys/nfs41sys_driver.c |  1 +
  132.  sys/nfs41sys_driver.h |  1 +
  133.  sys/nfs41sys_mount.c  | 32 +++++++++++++++++++++++++++++++-
  134.  3 files changed, 33 insertions(+), 1 deletion(-)
  135.  
  136. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  137. index c312ce2..4de1ab9 100644
  138. --- a/sys/nfs41sys_driver.c
  139. +++ b/sys/nfs41sys_driver.c
  140. @@ -84,6 +84,7 @@ DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5I_NAME, L"krb5i");
  141.  DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5P_NAME, L"krb5p");
  142.  DECLARE_CONST_UNICODE_STRING(SLASH, L"\\");
  143.  DECLARE_CONST_UNICODE_STRING(EMPTY_STRING, L"");
  144. +DECLARE_CONST_UNICODE_STRING(NetRootIpc, L"\\IPC$");
  145.  
  146.  DECLARE_CONST_ANSI_STRING(NfsV3Attributes, EA_NFSV3ATTRIBUTES);
  147.  DECLARE_CONST_ANSI_STRING(NfsSymlinkTargetName, EA_NFSSYMLINKTARGETNAME);
  148. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  149. index 6c6db57..597d207 100644
  150. --- a/sys/nfs41sys_driver.h
  151. +++ b/sys/nfs41sys_driver.h
  152. @@ -117,6 +117,7 @@ DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5I_NAME);
  153.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5P_NAME);
  154.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(SLASH);
  155.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(EMPTY_STRING);
  156. +DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(NetRootIpc);
  157.  
  158.  DECLARE_EXTERN_CONST_ANSI_STRING(NfsV3Attributes);
  159.  DECLARE_EXTERN_CONST_ANSI_STRING(NfsSymlinkTargetName);
  160. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  161. index a1e7f61..069c682 100644
  162. --- a/sys/nfs41sys_mount.c
  163. +++ b/sys/nfs41sys_mount.c
  164. @@ -845,13 +845,43 @@ NTSTATUS nfs41_CreateVNetRoot(
  165.  #endif
  166.      FsRtlEnterFileSystem();
  167.  
  168. -    if (pNetRoot->Type != NET_ROOT_DISK && pNetRoot->Type != NET_ROOT_WILD) {
  169. +    if ((pNetRoot->Type != NET_ROOT_DISK) &&
  170. +        (pNetRoot->Type != NET_ROOT_WILD) &&
  171. +        (pNetRoot->Type != NET_ROOT_PIPE)) {
  172.          print_error("nfs41_CreateVNetRoot: Unsupported NetRoot Type %u\n",
  173.              pNetRoot->Type);
  174.          status = STATUS_NOT_SUPPORTED;
  175.          goto out;
  176.      }
  177.  
  178. +    if (pNetRoot->Type == NET_ROOT_PIPE) {
  179. +        PUNICODE_STRING nrn = pNetRoot->pNetRootName;
  180. +
  181. +        /*
  182. +         * Check whether this is a CreateVNetRoot for a '\IPC$' pipe, and in
  183. +         * that case return |STATUS_MORE_PROCESSING_REQUIRED| so DFS knows
  184. +         * that this is not a DFS path
  185. +         */
  186. +        if (nrn->Length >=
  187. +            (pSrvCall->pSrvCallName->Length + NetRootIpc.Length)) {
  188. +            if (memcmp(&nrn->Buffer[(nrn->Length/sizeof(wchar_t)) -
  189. +                    (NetRootIpc.Length/sizeof(wchar_t))],
  190. +                NetRootIpc.Buffer, NetRootIpc.Length) == 0) {
  191. +                DbgP("nfs41_CreateVNetRoot: "
  192. +                    "CreateVNetRoot for the \\IPC$ pipe!\n");
  193. +                status = STATUS_MORE_PROCESSING_REQUIRED;
  194. +                goto out;
  195. +            }
  196. +            else {
  197. +                DbgP("nfs41_CreateVNetRoot: "
  198. +                    "CreateVNetRoot not for the \\IPC$ pipe\n");
  199. +            }
  200. +        }
  201. +
  202. +        status = STATUS_NOT_SUPPORTED;
  203. +        goto out;
  204. +    }
  205. +
  206.      pVNetRootContext->session = INVALID_HANDLE_VALUE;
  207.  
  208.      /*
  209. --
  210. 2.45.1

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at