pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for SID performance, libtirpc wrappers, tests, docs+misc, 2024-02-26
Posted by Anonymous on Mon 26th Feb 2024 18:07
raw | new post

  1. From ea570996cf91e0fa18fa8182cf58fb5d354434c8 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Mon, 26 Feb 2024 13:11:07 +0100
  4. Subject: [PATCH 1/8] libtirpc: Add more wintirpc wrappers+|wintirpc_ssize_t|
  5.  
  6. Add more wintirpc wrappers, e.g. |recv()|, |recvfrom()|,
  7. |getsockname()|, add our own version of |ssize_t| for
  8. portabilty, use them in function prototypes and add asserts
  9. in case of type overflows.
  10.  
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. libtirpc/src/auth_time.c    |  4 ++--
  14.  libtirpc/src/bindresvport.c |  6 +++---
  15.  libtirpc/src/clnt_dg.c      |  2 +-
  16.  libtirpc/src/clnt_vc.c      |  4 ++--
  17.  libtirpc/src/rpc_generic.c  |  4 ++--
  18.  libtirpc/src/rtime.c        |  6 +++---
  19.  libtirpc/src/svc_dg.c       |  4 ++--
  20.  libtirpc/src/svc_vc.c       | 14 +++++++++-----
  21.  libtirpc/src/wintirpc.c     | 36 +++++++++++++++++++++++++++++++-----
  22.  libtirpc/tirpc/wintirpc.h   | 18 ++++++++++++++++--
  23.  10 files changed, 71 insertions(+), 27 deletions(-)
  24.  
  25. diff --git a/libtirpc/src/auth_time.c b/libtirpc/src/auth_time.c
  26. index 0079f12..2794534 100644
  27. --- a/libtirpc/src/auth_time.c
  28. +++ b/libtirpc/src/auth_time.c
  29. @@ -408,7 +408,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
  30.                         if (res == SOCKET_ERROR)
  31.                                 goto error;
  32.                         len = sizeof(from);
  33. -                       res = recvfrom(_get_osfhandle(s), (char *)&thetime, sizeof(thetime), 0,
  34. +                       res = (int)wintirpc_recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
  35.                                         (struct sockaddr *)&from, &len);
  36.                         if (res == SOCKET_ERROR) {
  37.                                 msg("recvfrom failed on udp transport.");
  38. @@ -435,7 +435,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
  39.                                 goto error;
  40.                         }
  41.  //                     res = read(_get_osfhandle(s), (char *)&thetime, sizeof(thetime));
  42. -                       res = recv(_get_osfhandle(s), (char *)&thetime, sizeof(thetime), 0);
  43. +                       res = (int)wintirpc_recv(s, (char *)&thetime, sizeof(thetime), 0);
  44.                         if (res != sizeof(thetime)) {
  45.                                 if (saw_alarm)
  46.                                         msg("timed out TCP call.");
  47. diff --git a/libtirpc/src/bindresvport.c b/libtirpc/src/bindresvport.c
  48. index fc325fc..874a589 100644
  49. --- a/libtirpc/src/bindresvport.c
  50. +++ b/libtirpc/src/bindresvport.c
  51. @@ -87,7 +87,7 @@ bindresvport_sa(sd, sa)
  52.                  salen = sizeof(myaddr);
  53.                  sa = (struct sockaddr *)&myaddr;
  54.  
  55. -                if (getsockname(_get_osfhandle(sd), (struct sockaddr *)&myaddr, &salen) == -1)
  56. +                if (wintirpc_getsockname(sd, (struct sockaddr *)&myaddr, &salen) == -1)
  57.                          return -1;      /* errno is correctly set */
  58.  
  59.                  af = myaddr.ss_family;
  60. @@ -191,7 +191,7 @@ bindresvport_sa(sd, sa)
  61.                 }
  62.                 af = proto_info.iAddressFamily;
  63.  #else
  64. -               if (getsockname(_get_osfhandle(sd), sa, &salen) == -1)
  65. +               if (wintirpc_getsockname(sd, sa, &salen) == -1)
  66.                         return -1;      /* errno is correctly set */
  67.  
  68.                 af = sa->sa_family;
  69. @@ -260,7 +260,7 @@ bindresvport_sa(sd, sa)
  70.  
  71.                 if (sa != (struct sockaddr *)&myaddr) {
  72.                         /* Hmm, what did the kernel assign? */
  73. -                       if (getsockname(_get_osfhandle(sd), sa, &salen) < 0)
  74. +                       if (wintirpc_getsockname(sd, sa, &salen) < 0)
  75.                                 errno = saved_errno;
  76.                         return (error);
  77.                 }
  78. diff --git a/libtirpc/src/clnt_dg.c b/libtirpc/src/clnt_dg.c
  79. index 56492ee..9798a8c 100644
  80. --- a/libtirpc/src/clnt_dg.c
  81. +++ b/libtirpc/src/clnt_dg.c
  82. @@ -502,7 +502,7 @@ get_reply:
  83.  
  84.         /* We have some data now */
  85.         do {
  86. -               recvlen = recvfrom(_get_osfhandle(cu->cu_fd), cu->cu_inbuf,
  87. +               recvlen = wintirpc_recvfrom(cu->cu_fd, cu->cu_inbuf,
  88.                     cu->cu_recvsz, 0, NULL, NULL);
  89.                 errno = WSAGetLastError();
  90.         } while (recvlen == SOCKET_ERROR && errno == WSAEINTR);
  91. diff --git a/libtirpc/src/clnt_vc.c b/libtirpc/src/clnt_vc.c
  92. index ed488ab..45d82a6 100644
  93. --- a/libtirpc/src/clnt_vc.c
  94. +++ b/libtirpc/src/clnt_vc.c
  95. @@ -993,7 +993,7 @@ read_vc(ctp, buf, len)
  96.                 break;
  97.         }
  98.  
  99. -       len = recv(_get_osfhandle(ct->ct_fd), buf, (size_t)len, 0);
  100. +       len = (int)wintirpc_recv(ct->ct_fd, buf, (size_t)len, 0);
  101.         errno = WSAGetLastError();
  102.  
  103.         switch (len) {
  104. @@ -1022,7 +1022,7 @@ write_vc(ctp, buf, len)
  105.         int i = 0, cnt;
  106.  
  107.         for (cnt = len; cnt > 0; cnt -= i, buf += i) {
  108. -           if ((i = wintirpc_send(ct->ct_fd, buf, (size_t)cnt, 0)) == SOCKET_ERROR) {
  109. +           if ((i = (int)wintirpc_send(ct->ct_fd, buf, (size_t)cnt, 0)) == SOCKET_ERROR) {
  110.                 ct->ct_error.re_errno = WSAGetLastError();
  111.                 ct->ct_error.re_status = RPC_CANTSEND;
  112.                 return (-1);
  113. diff --git a/libtirpc/src/rpc_generic.c b/libtirpc/src/rpc_generic.c
  114. index 5837020..9491761 100644
  115. --- a/libtirpc/src/rpc_generic.c
  116. +++ b/libtirpc/src/rpc_generic.c
  117. @@ -498,7 +498,7 @@ __rpc_fd2sockinfo(int fd, struct __rpc_sockinfo *sip)
  118.         ss.ss_family = (ADDRESS_FAMILY)proto_info.iAddressFamily;
  119.  #else
  120.         len = sizeof ss;
  121. -       if (getsockname(_get_osfhandle(fd), (struct sockaddr *)&ss, &len) == SOCKET_ERROR) {
  122. +       if (wintirpc_getsockname(fd, (struct sockaddr *)&ss, &len) == SOCKET_ERROR) {
  123.                 return 0;
  124.         }
  125.  #endif
  126. @@ -892,7 +892,7 @@ __rpc_sockisbound(int fd)
  127.         socklen_t slen;
  128.  
  129.         slen = sizeof (struct sockaddr_storage);
  130. -       if (getsockname(_get_osfhandle(fd), (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR)
  131. +       if (wintirpc_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR)
  132.                 return 0;
  133.  
  134.         switch (ss.ss_family) {
  135. diff --git a/libtirpc/src/rtime.c b/libtirpc/src/rtime.c
  136. index 2203b30..d6856b6 100644
  137. --- a/libtirpc/src/rtime.c
  138. +++ b/libtirpc/src/rtime.c
  139. @@ -96,7 +96,7 @@ rtime(addrp, timep, timeout)
  140.         addrp->sin_port = serv->s_port;
  141.  
  142.         if (type == SOCK_DGRAM) {
  143. -               res = wintirpc_sendto(s, (char *)&thetime, sizeof(thetime), 0,
  144. +               res = (int)wintirpc_sendto(s, (char *)&thetime, sizeof(thetime), 0,
  145.                              (struct sockaddr *)addrp, sizeof(*addrp));
  146.                 if (res == SOCKET_ERROR) {
  147.                         do_close(s);
  148. @@ -116,7 +116,7 @@ rtime(addrp, timep, timeout)
  149.                         return(-1);    
  150.                 }
  151.                 fromlen = sizeof(from);
  152. -               res = recvfrom(_get_osfhandle(s), (char *)&thetime, sizeof(thetime), 0,
  153. +               res = (int)wintirpc_recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
  154.                                (struct sockaddr *)&from, &fromlen);
  155.                 do_close(s);
  156.                 if (res == SOCKET_ERROR) {
  157. @@ -127,7 +127,7 @@ rtime(addrp, timep, timeout)
  158.                         do_close(s);
  159.                         return(-1);
  160.                 }
  161. -               res = recv(_get_osfhandle(s), (char *)&thetime, sizeof(thetime), 0);
  162. +               res = (int)wintirpc_recv(s, (char *)&thetime, sizeof(thetime), 0);
  163.                 do_close(s);
  164.                 if (res == SOCKET_ERROR) {
  165.                         return(-1);
  166. diff --git a/libtirpc/src/svc_dg.c b/libtirpc/src/svc_dg.c
  167. index 3369394..b02eb26 100644
  168. --- a/libtirpc/src/svc_dg.c
  169. +++ b/libtirpc/src/svc_dg.c
  170. @@ -139,7 +139,7 @@ svc_dg_create(fd, sendsize, recvsize)
  171.         xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
  172.  
  173.         slen = sizeof ss;
  174. -       if (getsockname(_get_osfhandle(fd), (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR)
  175. +       if (wintirpc_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR)
  176.                 goto freedata;
  177.         __rpc_set_netbuf(&xprt->xp_ltaddr, &ss, slen);
  178.  
  179. @@ -179,7 +179,7 @@ svc_dg_recv(xprt, msg)
  180.  again:
  181.         alen = sizeof (struct sockaddr_storage);
  182.         assert(su->su_iosz < UINT_MAX);
  183. -       rlen = recvfrom(_get_osfhandle(xprt->xp_fd), rpc_buffer(xprt), (u_int)su->su_iosz, 0,
  184. +       rlen = wintirpc_recvfrom(xprt->xp_fd, rpc_buffer(xprt), (u_int)su->su_iosz, 0,
  185.             (struct sockaddr *)(void *)&ss, &alen);
  186.         if (rlen == -1 && errno == EINTR)
  187.                 goto again;
  188. diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
  189. index 5fa8ee4..5345d4a 100644
  190. --- a/libtirpc/src/svc_vc.c
  191. +++ b/libtirpc/src/svc_vc.c
  192. @@ -181,7 +181,7 @@ svc_vc_create(fd, sendsize, recvsize)
  193.         xprt->xp_fd = fd;
  194.  
  195.         slen = sizeof (struct sockaddr_storage);
  196. -       if (getsockname(_get_osfhandle(fd), (struct sockaddr *)(void *)&sslocal, &slen) == SOCKET_ERROR) {
  197. +       if (wintirpc_getsockname(fd, (struct sockaddr *)(void *)&sslocal, &slen) == SOCKET_ERROR) {
  198.                 warnx("svc_vc_create: could not retrieve local addr");
  199.                 goto cleanup_svc_vc_create;
  200.         }
  201. @@ -219,7 +219,7 @@ svc_fd_create(fd, sendsize, recvsize)
  202.                 return NULL;
  203.  
  204.         slen = sizeof (struct sockaddr_storage);
  205. -       if (getsockname(_get_osfhandle(fd), (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR) {
  206. +       if (wintirpc_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) == SOCKET_ERROR) {
  207.                 warnx("svc_fd_create: could not retrieve local addr");
  208.                 goto freedata;
  209.         }
  210. @@ -501,7 +501,7 @@ read_vc(xprtp, buf, len)
  211.  
  212.         if (cfp->nonblock) {
  213.  #ifdef _WIN32
  214. -               len = recv(_get_osfhandle(sock), buf, (size_t)len, 0);
  215. +               len = (int)wintirpc_recv(sock, buf, (size_t)len, 0);
  216.  #else
  217.                 len = read(sock, buf, (size_t)len);
  218.  #endif
  219. @@ -517,7 +517,11 @@ read_vc(xprtp, buf, len)
  220.         }
  221.  
  222.         do {
  223. +#ifdef _WIN32
  224.                 pollfd.fd = _get_osfhandle(sock);
  225. +#else
  226. +               pollfd.fd = sock;
  227. +#endif
  228.                 pollfd.events = POLLIN;
  229.                 pollfd.revents = 0;
  230.                 switch (poll(&pollfd, 1, milliseconds)) {
  231. @@ -534,7 +538,7 @@ read_vc(xprtp, buf, len)
  232.         } while ((pollfd.revents & POLLIN) == 0);
  233.  
  234.  #ifdef _WIN32
  235. -       if ((len = recv(_get_osfhandle(sock), buf, (size_t)len, 0)) > 0) {
  236. +       if ((len = (int)wintirpc_recv(sock, buf, (size_t)len, 0)) > 0) {
  237.  #else
  238.         if ((len = read(sock, buf, (size_t)len)) > 0) {
  239.  #endif
  240. @@ -572,7 +576,7 @@ write_vc(xprtp, buf, len)
  241.        
  242.         for (cnt = len; cnt > 0; cnt -= i, buf += i) {
  243.  #ifdef _WIN32
  244. -               i = wintirpc_send(xprt->xp_fd, buf, (size_t)cnt, 0);
  245. +               i = (int)wintirpc_send(xprt->xp_fd, buf, (size_t)cnt, 0);
  246.  #else
  247.                 i = write(xprt->xp_fd, buf, (size_t)cnt);
  248.  #endif
  249. diff --git a/libtirpc/src/wintirpc.c b/libtirpc/src/wintirpc.c
  250. index dba1873..53f6eab 100644
  251. --- a/libtirpc/src/wintirpc.c
  252. +++ b/libtirpc/src/wintirpc.c
  253. @@ -335,15 +335,41 @@ int wintirpc_accept(int in_s_fd, struct sockaddr *addr, int *addrlen)
  254.         return out_s_fd;
  255.  }
  256.  
  257. -int wintirpc_send(int s, const char *buf, int len, int flags)
  258. +wintirpc_ssize_t wintirpc_send(int s, const char *buf, size_t len, int flags)
  259.  {
  260. -       return send(_get_osfhandle(s), buf, len, flags);
  261. +       /* handle type overflow |size_t| ---> |int| */
  262. +       assert(len < INT_MAX);
  263. +       return send(_get_osfhandle(s), buf, (int)len, flags);
  264.  }
  265.  
  266. -int wintirpc_sendto(int s, const char *buf, int len, int flags,
  267. -       const struct sockaddr *to, int tolen)
  268. +wintirpc_ssize_t wintirpc_sendto(int s, const char *buf, size_t len, int flags,
  269. +       const struct sockaddr *to, socklen_t tolen)
  270.  {
  271. -       return(sendto(_get_osfhandle(s), buf, len, flags, to, tolen));
  272. +       /* handle type overflow |size_t| ---> |int| */
  273. +       assert(len < INT_MAX);
  274. +       return(sendto(_get_osfhandle(s), buf, (int)len, flags, to, tolen));
  275. +}
  276. +
  277. +wintirpc_ssize_t wintirpc_recv(int socket, void *buffer, size_t length, int flags)
  278. +{
  279. +       /* handle type overflow |size_t| ---> |int| */
  280. +       assert(length < INT_MAX);
  281. +       return recv(_get_osfhandle(socket), buffer, (int)length, flags);
  282. +}
  283. +
  284. +wintirpc_ssize_t wintirpc_recvfrom(int socket, void *restrict buffer, size_t length,
  285. +           int flags, struct sockaddr *restrict address,
  286. +           socklen_t *restrict address_len)
  287. +{
  288. +       /* handle type overflow |size_t| ---> |int| */
  289. +       assert(length < INT_MAX);
  290. +       return recvfrom(_get_osfhandle(socket), buffer, (int)length,
  291. +               flags, address, address_len);
  292. +}
  293. +
  294. +int wintirpc_getsockname(int s, struct sockaddr *name, int *namelen)
  295. +{
  296. +       return getsockname(_get_osfhandle(s), name, namelen);
  297.  }
  298.  
  299.  void wintirpc_syslog(int prio, const char *format, ...)
  300. diff --git a/libtirpc/tirpc/wintirpc.h b/libtirpc/tirpc/wintirpc.h
  301. index ab23923..4cb145f 100644
  302. --- a/libtirpc/tirpc/wintirpc.h
  303. +++ b/libtirpc/tirpc/wintirpc.h
  304. @@ -129,14 +129,28 @@ struct sockaddr_un {
  305.  /* XXX Should this return size_t or unsigned int ?? */
  306.  #define SUN_LEN(ptr) ((unsigned int)(sizeof(int) + strlen ((ptr)->sun_path)))
  307.  
  308. +/*
  309. + * Define our own version of signed |size_t| because Win32 does not
  310. + * have |ssize_t|
  311. + */
  312. +typedef SSIZE_T wintirpc_ssize_t;
  313. +
  314.  /* Prototypes */
  315.  int wintirpc_socket(int af,int type, int protocol);
  316.  int wintirpc_closesocket(int in_fd);
  317.  int wintirpc_close(int in_fd);
  318.  int wintirpc_listen(int in_s, int backlog);
  319.  int wintirpc_accept(int s_fd, struct sockaddr *addr, int *addrlen);
  320. -int wintirpc_send(int s, const char *buf, int len, int flags);
  321. -int wintirpc_sendto(int s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen);
  322. +wintirpc_ssize_t wintirpc_send(int s, const char *buf, size_t len,
  323. +    int flags);
  324. +wintirpc_ssize_t wintirpc_sendto(int s, const char *buf, size_t len,
  325. +    int flags, const struct sockaddr *to, socklen_t tolen);
  326. +wintirpc_ssize_t wintirpc_recv(int socket, void *buffer, size_t length,
  327. +    int flags);
  328. +wintirpc_ssize_t wintirpc_recvfrom(int socket, void *restrict buffer,
  329. +    size_t length, int flags, struct sockaddr *restrict address,
  330. +    socklen_t *restrict address_len);
  331. +int wintirpc_getsockname(int s, struct sockaddr *name, int *namelen);
  332.  void wintirpc_syslog(int prio, const char *format, ...);
  333.  void wintirpc_warnx(const char *format, ...);
  334.  void wintirpc_register_osfhandle_fd(SOCKET handle, int fd);
  335. --
  336. 2.43.0
  337.  
  338. From 7eed173da18ec9d56a52c3cff8682f5b5a98daa9 Mon Sep 17 00:00:00 2001
  339. From: Roland Mainz <roland.mainz@nrubsig.org>
  340. Date: Mon, 26 Feb 2024 13:55:33 +0100
  341. Subject: [PATCH 2/8] daemon: Avoid |malloc()| in sidcache by using
  342.  |SECURITY_MAX_SID_SIZE|
  343.  
  344. Avoid memory allocations in sidcache by using per-entry buffer and
  345. rely on |SECURITY_MAX_SID_SIZE|.
  346.  
  347. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  348. ---
  349. daemon/sid.c | 25 ++++++++++++-------------
  350.  1 file changed, 12 insertions(+), 13 deletions(-)
  351.  
  352. diff --git a/daemon/sid.c b/daemon/sid.c
  353. index 881b638..8ca42b4 100644
  354. --- a/daemon/sid.c
  355. +++ b/daemon/sid.c
  356. @@ -182,9 +182,11 @@ BOOL allocate_unixgroup_sid(unsigned long gid, PSID *pSid)
  357.  
  358.  typedef struct _sidcache_entry
  359.  {
  360. -    char    name[128]; /* must fit something like "user@domain" */
  361. +#define SIDCACHE_ENTRY_NAME_SIZE (128)
  362. +    char    name[SIDCACHE_ENTRY_NAME_SIZE]; /* must fit something like "user@domain" */
  363.      PSID    sid;
  364.      DWORD   sid_len;
  365. +    char    sid_buffer[SECURITY_MAX_SID_SIZE+1];
  366.      time_t  timestamp;
  367.  } sidcache_entry;
  368.  
  369. @@ -223,9 +225,9 @@ void sidcache_add(sidcache *cache, const char* name, PSID value)
  370.  
  371.          if ((e->sid != NULL) &&
  372.              (e->timestamp < (currentTimestamp - SIDCACHE_TTL))) {
  373. -            free(e->sid);
  374.              e->sid = NULL;
  375.              e->name[0] = '\0';
  376. +            e->sid_len = 0;
  377.          }
  378.      }
  379.  
  380. @@ -244,22 +246,19 @@ void sidcache_add(sidcache *cache, const char* name, PSID value)
  381.      }
  382.  
  383.      /* Replace the cache entry */
  384. +    sidcache_entry *e = &cache->entries[freeEntryIndex];
  385.      DWORD sid_len = GetLengthSid(value);
  386. -    PSID malloced_sid = malloc(sid_len);
  387. -    if (!malloced_sid)
  388. -        goto done;
  389. -    if (!CopySid(sid_len, malloced_sid, value)) {
  390. -        free(malloced_sid);
  391. +    EASSERT(sid_len <= SECURITY_MAX_SID_SIZE);
  392. +    e->sid = (PSID)e->sid_buffer;
  393. +    if (!CopySid(sid_len, e->sid, value)) {
  394. +        e->sid = NULL;
  395. +        e->name[0] = '\0';
  396. +        e->sid_len = 0;
  397.          goto done;
  398.      }
  399.  
  400. -    sidcache_entry *e = &cache->entries[freeEntryIndex];
  401. -
  402.      e->sid_len = sid_len;
  403. -    if (e->sid)
  404. -        free(e->sid);
  405. -    e->sid = malloced_sid;
  406. -    (void)strcpy_s(e->name, sizeof(e->name), name);
  407. +    (void)strcpy_s(e->name, SIDCACHE_ENTRY_NAME_SIZE, name);
  408.      e->timestamp = currentTimestamp;
  409.  
  410.      cache->cacheIndex = (cache->cacheIndex + 1) % SIDCACHE_SIZE;
  411. --
  412. 2.43.0
  413.  
  414. From e10c731089bc22b5fcc219618e3fdf5ff03eeb48 Mon Sep 17 00:00:00 2001
  415. From: Roland Mainz <roland.mainz@nrubsig.org>
  416. Date: Mon, 26 Feb 2024 15:30:58 +0100
  417. Subject: [PATCH 3/8] daemon: |map_nfs4servername_2_sid()| should use
  418.  |SECURITY_MAX_SID_SIZE|
  419.  
  420. |map_nfs4servername_2_sid()| should use |SECURITY_MAX_SID_SIZE| to
  421. improve performance.
  422.  
  423. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  424. ---
  425. daemon/sid.c | 83 +++++++++++++++++++++++++---------------------------
  426.  1 file changed, 40 insertions(+), 43 deletions(-)
  427.  
  428. diff --git a/daemon/sid.c b/daemon/sid.c
  429. index 8ca42b4..7d64639 100644
  430. --- a/daemon/sid.c
  431. +++ b/daemon/sid.c
  432. @@ -312,8 +312,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  433.      int status = ERROR_INTERNAL_ERROR;
  434.      SID_NAME_USE sid_type = 0;
  435.      char name_buff[256+2];
  436. -    LPSTR tmp_buf = NULL;
  437. -    DWORD tmp = 0;
  438. +    char domain_buff[256+2];
  439. +    DWORD domain_len = 0;
  440.  #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  441.      signed long user_uid = -1;
  442.      signed long group_gid = -1;
  443. @@ -377,52 +377,49 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  444.      }
  445.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  446.  
  447. -    status = LookupAccountNameA(NULL, name, NULL, sid_len, NULL, &tmp, &sid_type);
  448. +    *sid = malloc(SECURITY_MAX_SID_SIZE+1);
  449. +    if (*sid == NULL) {
  450. +        status = GetLastError();
  451. +        goto out;
  452. +    }
  453. +    *sid_len = SECURITY_MAX_SID_SIZE;
  454. +    domain_len = sizeof(domain_buff);
  455. +
  456. +    status = LookupAccountNameA(NULL, name, *sid, sid_len,
  457. +        domain_buff, &domain_len, &sid_type);
  458. +
  459. +    if (status) {
  460. +        /* |LookupAccountNameA()| success */
  461. +
  462. +        DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  463. +            "LookupAccountNameA() returned status=%d "
  464. +            "GetLastError=%d *sid_len=%d domain_buff='%s' domain_len=%d\n",
  465. +            query, name, status, GetLastError(), *sid_len, domain_buff,
  466. +            domain_len));
  467. +
  468. +        status = 0;
  469. +        *sid_len = GetLengthSid(*sid);
  470. +        goto out;
  471. +    }
  472. +
  473. +    /* |LookupAccountNameA()| failed... */
  474.      DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  475. -        "LookupAccountName returned %d "
  476. -        "GetLastError %d name len %d domain len %d\n",
  477. -        query, name, status, GetLastError(), *sid_len, tmp));
  478. -    if (status)
  479. -        return ERROR_INTERNAL_ERROR;
  480. +        "LookupAccountNameA() returned status=%d "
  481. +        "GetLastError=%d\n",
  482. +        query, name, status, GetLastError()));
  483.  
  484.      status = GetLastError();
  485.      switch(status) {
  486.      case ERROR_INSUFFICIENT_BUFFER:
  487. -        *sid = malloc(*sid_len);
  488. -        if (*sid == NULL) {
  489. -            status = GetLastError();
  490. -            goto out;
  491. -        }
  492. -        tmp_buf = (LPSTR) malloc(tmp);
  493. -        if (tmp_buf == NULL)
  494. -            goto out_free_sid;
  495. -        status = LookupAccountNameA(NULL, name, *sid, sid_len, tmp_buf,
  496. -                                    &tmp, &sid_type);
  497. -        free(tmp_buf);
  498. -        if (!status) {
  499. -            eprintf("map_nfs4servername_2_sid(query=%x,name='%s'): LookupAccountName failed "
  500. -                    "with %d\n", query, name, GetLastError());
  501. -            goto out_free_sid;
  502. -        } else {
  503. -#ifdef DEBUG_ACLS
  504. -            LPSTR ssid = NULL;
  505. -            if (IsValidSid(*sid))
  506. -                if (ConvertSidToStringSidA(*sid, &ssid)) {
  507. -                    DPRINTF(1, ("map_nfs4servername_2_sid: sid_type = %d SID '%s'\n",
  508. -                        sid_type, ssid));
  509. -                }
  510. -                else {
  511. -                    DPRINTF(1, ("map_nfs4servername_2_sid: ConvertSidToStringSidA failed "
  512. -                        "with %d\n", GetLastError()));
  513. -                }
  514. -            else {
  515. -                DPRINTF(1, ("map_nfs4servername_2_sid: Invalid Sid ?\n"));
  516. -            }
  517. -            if (ssid)
  518. -                LocalFree(ssid);
  519. -#endif
  520. -        }
  521. -        status = ERROR_SUCCESS;
  522. +        /*
  523. +         * This should never happen, as |SECURITY_MAX_SID_SIZE| is
  524. +         * the largest possible SID buffer size for Windows
  525. +         */
  526. +        eprintf("map_nfs4servername_2_sid(query=%x,name='%s'): "
  527. +                "LookupAccountName failed with "
  528. +                "ERROR_INSUFFICIENT_BUFFER\n", query, name);
  529. +
  530. +        return ERROR_INTERNAL_ERROR;
  531.          break;
  532.      case ERROR_NONE_MAPPED:
  533.  #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  534. --
  535. 2.43.0
  536.  
  537. From 0bdf31b60d5d583bc80c648ed773f1c23816dd68 Mon Sep 17 00:00:00 2001
  538. From: Roland Mainz <roland.mainz@nrubsig.org>
  539. Date: Mon, 26 Feb 2024 16:30:33 +0100
  540. Subject: [PATCH 4/8] daemon: Improve debug output of
  541.  |map_nfs4servername_2_sid()|
  542.  
  543. Improve debug output of |map_nfs4servername_2_sid()|, add start/end
  544. tags ("-->", "<--"), print more info, print SID string on success.
  545.  
  546. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  547. ---
  548. daemon/sid.c | 52 ++++++++++++++++++++++++++++++++++++++++++----------
  549.  1 file changed, 42 insertions(+), 10 deletions(-)
  550.  
  551. diff --git a/daemon/sid.c b/daemon/sid.c
  552. index 7d64639..c12f54f 100644
  553. --- a/daemon/sid.c
  554. +++ b/daemon/sid.c
  555. @@ -37,7 +37,6 @@
  556.  #include "idmap.h"
  557.  #include "sid.h"
  558.  
  559. -//#define DEBUG_ACLS
  560.  #define ACLLVL 2 /* dprintf level for acl logging */
  561.  
  562.  
  563. @@ -319,6 +318,9 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  564.      signed long group_gid = -1;
  565.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  566.  
  567. +    DPRINTF(ACLLVL, ("--> map_nfs4servername_2_sid(query=%x,name='%s')\n",
  568. +        query, name));
  569. +
  570.  #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  571.      /* use our own idmapper script to map nfsv4 owner string to local Windows account */
  572.      if (query & OWNER_SECURITY_INFORMATION) {
  573. @@ -329,7 +331,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  574.          if (*sid = sidcache_getcached(&user_sidcache, name)) {
  575.              *sid_len = GetLengthSid(*sid);
  576.              DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for user '%s'\n", name));
  577. -            return 0;
  578. +            status = 0;
  579. +            goto out;
  580.          }
  581.  #endif /* NFS41_DRIVER_SID_CACHE */
  582.  
  583. @@ -358,7 +361,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  584.          if (*sid = sidcache_getcached(&group_sidcache, name)) {
  585.              *sid_len = GetLengthSid(*sid);
  586.              DPRINTF(1, ("map_nfs4servername_2_sid: returning cached sid for group '%s'\n", name));
  587. -            return 0;
  588. +            status = 0;
  589. +            goto out;
  590.          }
  591.  #endif /* NFS41_DRIVER_SID_CACHE */
  592.  
  593. @@ -399,7 +403,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  594.  
  595.          status = 0;
  596.          *sid_len = GetLengthSid(*sid);
  597. -        goto out;
  598. +        goto out_cache;
  599.      }
  600.  
  601.      /* |LookupAccountNameA()| failed... */
  602. @@ -419,7 +423,8 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  603.                  "LookupAccountName failed with "
  604.                  "ERROR_INSUFFICIENT_BUFFER\n", query, name);
  605.  
  606. -        return ERROR_INTERNAL_ERROR;
  607. +        status = ERROR_INTERNAL_ERROR;
  608. +        goto out;
  609.          break;
  610.      case ERROR_NONE_MAPPED:
  611.  #ifdef NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID
  612. @@ -469,14 +474,14 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  613.                      query, name, user_uid));
  614.                  status = ERROR_SUCCESS;
  615.                  sid_type = SidTypeUser;
  616. -                goto out;
  617. +                goto out_cache;
  618.              }
  619.  
  620.              status = GetLastError();
  621.              DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  622.                  "allocate_unixuser_sid(uid=%ld) failed, error=%d\n",
  623.                  query, name, user_uid, status));
  624. -            return status;
  625. +            goto out;
  626.          }
  627.  
  628.          if (group_gid != -1) {
  629. @@ -486,14 +491,14 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  630.                      query, name, group_gid));
  631.                  status = ERROR_SUCCESS;
  632.                  sid_type = SidTypeGroup;
  633. -                goto out;
  634. +                goto out_cache;
  635.              }
  636.  
  637.              status = GetLastError();
  638.              DPRINTF(ACLLVL, ("map_nfs4servername_2_sid(query=%x,name='%s'): "
  639.                  "allocate_unixgroup_sid(gid=%ld) failed, error=%d\n",
  640.                  query, name, group_gid, status));
  641. -            return status;
  642. +            goto out;
  643.          }
  644.  #endif /* NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID */
  645.  
  646. @@ -510,7 +515,7 @@ int map_nfs4servername_2_sid(nfs41_daemon_globals *nfs41dg, int query, DWORD *si
  647.              query, name, GetLastError()));
  648.          break;
  649.      }
  650. -out:
  651. +out_cache:
  652.  #ifdef NFS41_DRIVER_SID_CACHE
  653.      if ((status == 0) && *sid) {
  654.          if ((query & GROUP_SECURITY_INFORMATION) &&
  655. @@ -547,7 +552,34 @@ out:
  656.      }
  657.  #endif /* NFS41_DRIVER_SID_CACHE */
  658.  
  659. +out:
  660. +    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  661. +        if (status) {
  662. +            dprintf_out("<-- map_nfs4servername_2_sid(query=%x,name='%s'): "
  663. +                "status=%d\n", query, name, status);
  664. +        }
  665. +        else {
  666. +            PSTR sidstr = NULL;
  667. +            char errsidstrbuf[128];
  668. +
  669. +            if (!ConvertSidToStringSidA(*sid, &sidstr)) {
  670. +                (void)snprintf(errsidstrbuf, sizeof(errsidstrbuf),
  671. +                    "<ConvertSidToStringSidA() failed, "
  672. +                    "GetLastError()=%d>", (int)GetLastError());
  673. +                sidstr = errsidstrbuf;
  674. +            }
  675. +
  676. +            dprintf_out("<-- map_nfs4servername_2_sid(query=%x,name='%s'): "
  677. +                "status=%d sidstr='%s' *sid_len=%d\n",
  678. +                query, name, status, sidstr, *sid_len);
  679. +
  680. +            if (sidstr && (sidstr != errsidstrbuf))
  681. +                LocalFree(sidstr);
  682. +        }
  683. +    }
  684. +
  685.      return status;
  686. +
  687.  out_free_sid:
  688.      status = GetLastError();
  689.      free(*sid);
  690. --
  691. 2.43.0
  692.  
  693. From 1e4baf4ce15cbdbfa38234e43c8b56ae061cc8e1 Mon Sep 17 00:00:00 2001
  694. From: Roland Mainz <roland.mainz@nrubsig.org>
  695. Date: Mon, 26 Feb 2024 16:32:58 +0100
  696. Subject: [PATCH 5/8] cygwin: README.bintarball.txt: Update package list
  697.  
  698. Update package list for README.bintarball.txt and add
  699. "recommended" packages.
  700.  
  701. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  702. ---
  703. cygwin/README.bintarball.txt | 7 ++++++-
  704.  1 file changed, 6 insertions(+), 1 deletion(-)
  705.  
  706. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  707. index 54808d3..4c52ec8 100644
  708. --- a/cygwin/README.bintarball.txt
  709. +++ b/cygwin/README.bintarball.txt
  710. @@ -63,7 +63,7 @@ NFSv4.1 client and filesystem driver for Windows 10/11
  711.  #
  712.  - Windows 10 or Windows 11
  713.  - Cygwin 3.5.0
  714. -    - Packages:
  715. +    - Packages (required):
  716.          cygwin
  717.          cygwin-devel
  718.          cygrunsrv
  719. @@ -87,7 +87,12 @@ NFSv4.1 client and filesystem driver for Windows 10/11
  720.          time
  721.          util-linux
  722.          wget
  723. +    - Packages (recommended):
  724. +        make
  725. +        git
  726. +        dos2unix
  727.  
  728. +#
  729.  #
  730.  # 4. Download:
  731.  #
  732. --
  733. 2.43.0
  734.  
  735. From 01a25d296f6f9ba214de23f6dfea4ae5e16ad16c Mon Sep 17 00:00:00 2001
  736. From: Roland Mainz <roland.mainz@nrubsig.org>
  737. Date: Mon, 26 Feb 2024 16:34:17 +0100
  738. Subject: [PATCH 6/8] tests: Update manual_testing.txt
  739.  
  740. Update "manual_testing.txt":
  741. - add required packages
  742. - add info about timeserver
  743. - add instructions how to add groups to Windows client+Linux server
  744. - add info benchmarking vs. Windows virus scanner
  745.  
  746. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  747. ---
  748. tests/manual_testing.txt | 79 +++++++++++++++++++++++++++++++++++++---
  749.  1 file changed, 73 insertions(+), 6 deletions(-)
  750.  
  751. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  752. index 3bdb59c..a0c9408 100644
  753. --- a/tests/manual_testing.txt
  754. +++ b/tests/manual_testing.txt
  755. @@ -1,15 +1,50 @@
  756.  #
  757. -# ms-nfs41-client manual testing sequence, 2024-02-12
  758. +# ms-nfs41-client manual testing sequence, 2024-02-26
  759.  #
  760.  # Draft version, needs to be turned into automated tests
  761.  # if possible
  762.  #
  763.  
  764. -# start cygserver as admin before running tests
  765. -# so SysV shared memory works:
  766. -# cygserver-config
  767. -# net start cygserver
  768. -# sc query cygserver
  769. +#
  770. +# Notes:
  771. +# - The following Cygwin packages must be installed for running the tests:
  772. +#   ---- snip ----
  773. +#   make
  774. +#   git
  775. +#   netpbm
  776. +#   subversion
  777. +#   dos2unix
  778. +#   ncurses-devel
  779. +#   libgmp-devel
  780. +#   libmpfr-devel
  781. +#   libmpc-devel
  782. +#   libintl-devel
  783. +#   flex
  784. +#   bison
  785. +#   ---- snip ----
  786. +#
  787. +# - Benchmarking/profiling should be done with the realtime virus checker
  788. +#   disabled, e.g. disable it like this from an "Adminstrator" terminal:
  789. +#   $ powershell -Command 'Set-MpPreference -DisableRealtimeMonitoring 1' #
  790. +#
  791. +# - A timeserver shoud be running on both Windows (NFSv4.1 client and
  792. +#   NFSv4.1 server).
  793. +#   For example on Windows add timeserver 10.49.0.6 like this:
  794. +#   ---- snip ----
  795. +#   net start w32time
  796. +#   w32tm /config /update /manualpeerlist:10.49.0.6
  797. +#   ---- snip ----
  798. +#   (see https://stackoverflow.com/questions/22862236/how-to-sync-windows-time-from-a-ntp-time-server-in-command)
  799. +#   On Linux use xntpd or timesyncd (/etc/systemd/timesyncd.conf)
  800. +#
  801. +# - Start cygserver as admin before running tests
  802. +#   so SysV shared memory works:
  803. +#   ---- snip ----
  804. +#   cygserver-config
  805. +#   net start cygserver
  806. +#   sc query cygserver
  807. +#   ---- snip ----
  808. +#
  809.  
  810.  #
  811.  # Tests for cp -p/mv/chmod/chgrp
  812. @@ -26,6 +61,38 @@ ksh93 -c 'builtin id ; rm -f x ; touch x ; chgrp "$(id -g -n)" x && print OK'
  813.  ---- snip ----
  814.  
  815.  
  816. +#
  817. +# Tests for groups
  818. +# (Add groups "cygwingrp1" and "cygwingrp2" to both Linux NFSv4 server
  819. +# and Windows machine, after that $ chgrp cygwingrp2 # should work)
  820. +#
  821. +---- snip ----
  822. +# "WINHOST1" is the Windows machine,
  823. +# "DERFWNB4966" is the Linux NFSv4 server:
  824. +
  825. +# create two groups on the Windows machine
  826. +WINHOST1:~$ net localgroup cygwingrp1 /add
  827. +WINHOST1:~$ net localgroup cygwingrp2 /add
  828. +
  829. +# add user "roland_mainz" to both new groups
  830. +WINHOST1:~$ net localgroup cygwingrp1 roland_mainz /add
  831. +WINHOST1:~$ net localgroup cygwingrp2 roland_mainz /add
  832. +
  833. +# get gid from both groups
  834. +WINHOST1:~$ getent group cygwingrp1
  835. +cygwingrp1:S-1-5-21-3286904461-661230000-4220857270-1003:197611:
  836. +WINHOST1:~$ getent group cygwingrp2
  837. +cygwingrp2:S-1-5-21-3286904461-661230000-4220857270-1004:197612:
  838. +
  839. +# add the two groups to the Linux NFSv4 server, including the gids
  840. +("197611" and "197612"):
  841. +root@DERFWNB4966:~# groupadd -g 197611 cygwingrp1
  842. +root@DERFWNB4966:~# groupadd -g 197612 cygwingrp2
  843. +root@DERFWNB4966:~# usermod -a -G cygwingrp1 roland_mainz
  844. +root@DERFWNB4966:~# usermod -a -G cygwingrp2 roland_mainz
  845. +---- snip ---
  846. +
  847. +
  848.  #
  849.  # Compile each of the following package
  850.  # on a NFSv4.1 share, and run each build in parallel/sequence
  851. --
  852. 2.43.0
  853.  
  854. From e61da3e9371e673c15c0e3cc4e7b37e6ff367be0 Mon Sep 17 00:00:00 2001
  855. From: Roland Mainz <roland.mainz@nrubsig.org>
  856. Date: Mon, 26 Feb 2024 17:32:56 +0100
  857. Subject: [PATCH 7/8] daemon: Add another stabilty hack to |parse_getattr()|
  858.  
  859. Add another stabilty hack to |parse_getattr()| to weed out
  860. invalid |state_ref| pointers
  861.  
  862. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  863. ---
  864. daemon/getattr.c | 21 +++++++++++++++++++++
  865.  1 file changed, 21 insertions(+)
  866.  
  867. diff --git a/daemon/getattr.c b/daemon/getattr.c
  868. index 2f0f758..3690c33 100644
  869. --- a/daemon/getattr.c
  870. +++ b/daemon/getattr.c
  871. @@ -60,18 +60,39 @@ int nfs41_cached_getattr(
  872.  static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  873.  {
  874.      int status;
  875. +
  876.  #ifdef NFS41_DRIVER_STABILITY_HACKS
  877.      EASSERT(length > 4);
  878.      if (length <= 4) {
  879.          status = ERROR_INVALID_PARAMETER;
  880.          goto out;
  881.      }
  882. +
  883.      EASSERT_IS_VALID_NON_NULL_PTR(upcall->state_ref);
  884.      if (!DEBUG_IS_VALID_NON_NULL_PTR(upcall->state_ref)) {
  885.          status = ERROR_INVALID_PARAMETER;
  886.          goto out;
  887.      }
  888. +
  889. +    /*
  890. +     * If |upcall->state_ref| is garbage, then this should trigger
  891. +     * an exception
  892. +     */
  893. +    volatile int ok = 0;
  894. +    __try {
  895. +        if (upcall->state_ref->session->client->server != NULL)
  896. +            ok++;
  897. +    }
  898. +    __except(EXCEPTION_EXECUTE_HANDLER) {
  899. +        eprintf("parse_getattr: Exception accessing upcall->state_ref->session->client->server\n");
  900. +    }
  901. +    if (ok != 1) {
  902. +        status = ERROR_INVALID_PARAMETER;
  903. +        goto out;
  904. +    }
  905. +    EASSERT(upcall->state_ref->ref_count > 0);
  906.  #endif /* NFS41_DRIVER_STABILITY_HACKS */
  907. +
  908.      getattr_upcall_args *args = &upcall->args.getattr;
  909.      status = safe_read(&buffer, &length, &args->query_class, sizeof(args->query_class));
  910.      if (status) goto out;
  911. --
  912. 2.43.0
  913.  
  914. From a22613dd8d3405c90ea107b0773542bbe0b95ab4 Mon Sep 17 00:00:00 2001
  915. From: Roland Mainz <roland.mainz@nrubsig.org>
  916. Date: Mon, 26 Feb 2024 18:57:03 +0100
  917. Subject: [PATCH 8/8] cygwin: msnfs41client.bash run_daemon subcmd should print
  918.  uname -a+admin status
  919.  
  920. msnfs41client.bash run_daemon sub-command should print $ uname -a #
  921. and info whether the current account is an admin account, so users
  922. can see in the logs which machine was generating the logs.
  923.  
  924. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  925. ---
  926. cygwin/devel/msnfs41client.bash | 8 ++++++++
  927.  1 file changed, 8 insertions(+)
  928.  
  929. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  930. index 8474264..066a4fa 100644
  931. --- a/cygwin/devel/msnfs41client.bash
  932. +++ b/cygwin/devel/msnfs41client.bash
  933. @@ -138,6 +138,10 @@ function nfsclient_rundeamon
  934.         set -o xtrace
  935.         set -o nounset
  936.  
  937. +       printf '# uname='%s' isadmin=%d\n' \
  938. +               "$(uname -a)" \
  939. +               "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))"
  940. +
  941.         typeset -a nfsd_args=(
  942.                 'nfsd_debug.exe'
  943.                 '-d' '0'
  944. @@ -225,6 +229,10 @@ function nfsclient_system_rundeamon
  945.         set -o xtrace
  946.         set -o nounset
  947.  
  948. +       printf '# uname='%s' isadmin=%d\n' \
  949. +               "$(uname -a)" \
  950. +               "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))"
  951. +
  952.         typeset -a nfsd_args=(
  953.                 'nfsd_debug.exe'
  954.                 '-d' '0'
  955. --
  956. 2.43.0

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