pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: ACL mask rework, sshnfs Windows targets, 2024-06-19
Posted by Anonymous on Wed 19th Jun 2024 16:39
raw | new post

  1. From 1a6cb6f3c9e8b917c9f4917d0bccf9925d1ae6ab Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 19 Jun 2024 17:29:27 +0200
  4. Subject: [PATCH 1/2] daemon: Rework ACL mask code+better debug output for ACL
  5.  masks
  6.  
  7. Rework ACL mask code, and add better debug output for ACL masks
  8.  
  9. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  10. ---
  11. daemon/acl.c          | 289 ++++++++++++++++++++++++++++++++++++------
  12.  daemon/daemon_debug.c |  37 +++---
  13.  daemon/daemon_debug.h |   5 +-
  14.  3 files changed, 277 insertions(+), 54 deletions(-)
  15.  
  16. diff --git a/daemon/acl.c b/daemon/acl.c
  17. index 0aff8d2..8844c46 100644
  18. --- a/daemon/acl.c
  19. +++ b/daemon/acl.c
  20. @@ -41,7 +41,10 @@
  21.  /* Local prototypes */
  22.  static void map_winace2nfs4aceflags(BYTE win_aceflags, uint32_t *nfs4_aceflags);
  23.  static void map_nfs4aceflags2winaceflags(uint32_t nfs4_aceflags, DWORD *win_aceflags);
  24. -
  25. +static void map_winaccessmask2nfs4acemask(ACCESS_MASK win_mask,
  26. +    int file_type, uint32_t *nfs4_mask);
  27. +static void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask,
  28. +    int file_type, ACCESS_MASK *win_mask);
  29.  
  30.  static int parse_getacl(unsigned char *buffer, uint32_t length,
  31.                          nfs41_upcall *upcall)
  32. @@ -150,7 +153,7 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  33.          size += sid_len - sizeof(DWORD);
  34.      }
  35.  
  36.      size += sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE)*acl->count);
  37.  
  38. -    size = (size + sizeof(DWORD) - 1) & 0xfffffffc; //align size on word boundry
  39.  
  40. +    size = align8(size); // align size on |DWORD| boundry
  41.      dacl = malloc(size);
  42.  
  43.      if (dacl == NULL)
  44.  
  45.          goto out_free_sids;
  46.  
  47. @@ -161,17 +164,28 @@ static int convert_nfs4acl_2_dacl(nfs41_daemon_globals *nfs41dg,
  48.  
  49.          for (i = 0; i < acl->count; i++) {
  50.              win_aceflags = 0;
  51. +            mask = 0;
  52.  
  53. -            // nfs4 acemask should be exactly the same as file access mask
  54. -            mask = acl->aces[i].acemask;
  55. -            map_nfs4aceflags2winaceflags(acl->aces[i].aceflag, &win_aceflags);
  56. +            map_nfs4aceflags2winaceflags(acl->aces[i].aceflag,
  57. +                &win_aceflags);
  58. +            map_nfs4acemask2winaccessmask(acl->aces[i].acemask,
  59. +                file_type, &mask);
  60.  
  61. -            DPRINTF(ACLLVL, ("aces[%d].who='%s': "
  62. -                "access mask=0x%x, acetype='%s', win_aceflags=0x%x\n",
  63. -                i, acl->aces[i].who,
  64. -                (int)mask,
  65. -                acl->aces[i].acetype?"DENIED ACE":"ALLOWED ACE",
  66. -                (int)win_aceflags));
  67. +            if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  68. +                dprintf_out("nfs2win: acl->aces[%d].who='%s': "
  69. +                    "acetype='%s', "
  70. +                    "nfs_acemask=0x%lx, win_mask=0x%lx, "
  71. +                    "win_aceflags=0x%lx\n",
  72. +                    i, acl->aces[i].who,
  73. +                    map_nfs_acetype2str(acl->aces[i].acetype),
  74. +                    (long)acl->aces[i].acemask,
  75. +                    (long)mask,
  76. +                    (long)win_aceflags);
  77. +
  78. +                print_nfs_access_mask(acl->aces[i].who,
  79. +                    acl->aces[i].acemask);
  80. +                print_windows_access_mask(acl->aces[i].who, mask);
  81. +            }
  82.  
  83.              if (acl->aces[i].acetype == ACE4_ACCESS_ALLOWED_ACE_TYPE) {
  84.                  status = AddAccessAllowedAceEx(dacl, ACL_REVISION, win_aceflags, mask, sids[i]);
  85. @@ -238,7 +252,8 @@ static int handle_getacl(void *daemon_context, nfs41_upcall *upcall)
  86.      char owner[NFS4_OPAQUE_LIMIT+1], group[NFS4_OPAQUE_LIMIT+1];
  87.      nfsacl41 acl = { 0 };
  88.  
  89. -    DPRINTF(ACLLVL, ("--> handle_getacl()\n"));
  90. +    DPRINTF(ACLLVL, ("--> handle_getacl(state->path.path='%s')\n",
  91. +        state->path.path));
  92.  
  93.      if (args->query & DACL_SECURITY_INFORMATION) {
  94.  use_nfs41_getattr:
  95. @@ -524,38 +539,221 @@ static void map_nfs4aceflags2winaceflags(uint32_t nfs4_aceflags, DWORD *win_acef
  96.          (int)nfs4_aceflags, (int)*win_aceflags));
  97.  }
  98.  
  99. -static void map_winaccessmask2nfs4acemask(ACCESS_MASK mask, int file_type, uint32_t *nfs4_mask)
  100. +static
  101. +void map_winaccessmask2nfs4acemask(ACCESS_MASK win_mask,
  102. +    int file_type, uint32_t *nfs4_mask)
  103.  {
  104. -    DPRINTF(ACLLVL,
  105. -        ("--> map_winaccessmask2nfs4acemask(mask=0x%x)\n",
  106. -        (int)mask));
  107. -    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  108. -        print_windows_access_mask(mask);
  109. -    }
  110.      /* check if any GENERIC bits set */
  111. -    if (mask & 0xf000000) {
  112. -        if (mask & GENERIC_ALL) {
  113. +    if (win_mask & 0xf000000) {
  114. +        if (win_mask & GENERIC_ALL) {
  115.              if (file_type == NF4DIR)
  116.  
  117.                  *nfs4_mask |= ACE4_ALL_DIR;
  118.  
  119.              else
  120.  
  121.                  *nfs4_mask |= ACE4_ALL_FILE;
  122.  
  123.          } else {
  124.  
  125. -            if (mask & GENERIC_READ)
  126.  
  127. +            if (win_mask & GENERIC_READ)
  128.                  *nfs4_mask |= ACE4_GENERIC_READ;
  129.  
  130. -            if (mask & GENERIC_WRITE)
  131.  
  132. +            if (win_mask & GENERIC_WRITE)
  133.                  *nfs4_mask |= ACE4_GENERIC_WRITE;
  134.  
  135. -            if (mask & GENERIC_EXECUTE)
  136.  
  137. +            if (win_mask & GENERIC_EXECUTE)
  138.                  *nfs4_mask |= ACE4_GENERIC_EXECUTE;
  139.  
  140.          }
  141.  
  142.      }
  143. -    else /* ignoring generic and reserved bits */
  144. -        *nfs4_mask = mask & 0x00ffffff;
  145. -    if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  146. -        print_nfs_access_mask(*nfs4_mask);
  147. +    else {
  148. +       /* Individual flags */
  149. +        if (file_type == NF4DIR) {
  150. +            if (win_mask & FILE_LIST_DIRECTORY) {
  151. +                *nfs4_mask |= ACE4_LIST_DIRECTORY;
  152. +            }
  153. +            if (win_mask & FILE_ADD_FILE) {
  154. +                *nfs4_mask |= ACE4_ADD_FILE;
  155. +            }
  156. +            if (win_mask & FILE_ADD_SUBDIRECTORY) {
  157. +                *nfs4_mask |= ACE4_ADD_SUBDIRECTORY;
  158. +            }
  159. +            if (win_mask & FILE_DELETE_CHILD) {
  160. +                *nfs4_mask |= ACE4_DELETE_CHILD;
  161. +            }
  162. +            if (win_mask & FILE_TRAVERSE) {
  163. +                *nfs4_mask |= ACE4_EXECUTE;
  164. +            }
  165. +        }
  166. +        else {
  167. +            if (win_mask & FILE_READ_DATA) {
  168. +                *nfs4_mask |= ACE4_READ_DATA;
  169. +            }
  170. +            if (win_mask & FILE_WRITE_DATA) {
  171. +                *nfs4_mask |= ACE4_WRITE_DATA;
  172. +            }
  173. +            if (win_mask & FILE_APPEND_DATA) {
  174. +                *nfs4_mask |= ACE4_APPEND_DATA;
  175. +            }
  176. +            if (win_mask & FILE_EXECUTE) {
  177. +                *nfs4_mask |= ACE4_EXECUTE;
  178. +            }
  179. +            /*
  180. +             * gisburn: Why does Win10 set |FILE_DELETE_CHILD| for
  181. +             * plain files ?
  182. +             */
  183. +            if (win_mask & FILE_DELETE_CHILD) {
  184. +                *nfs4_mask |= ACE4_DELETE_CHILD;
  185. +            }
  186. +        }
  187.      }
  188. -    DPRINTF(ACLLVL,
  189. -        ("<-- map_winaccessmask2nfs4acemask(mask=0x%x, *nfs4_mask=0x%x)\n",
  190. -        (int)mask, (int)*nfs4_mask));
  191. +
  192. +    if (win_mask & FILE_READ_EA) {
  193. +        *nfs4_mask |= ACE4_READ_NAMED_ATTRS;
  194. +    }
  195. +    if (win_mask & FILE_WRITE_EA) {
  196. +        *nfs4_mask |= ACE4_WRITE_NAMED_ATTRS;
  197. +    }
  198. +    if (win_mask & FILE_READ_ATTRIBUTES) {
  199. +        *nfs4_mask |= ACE4_READ_ATTRIBUTES;
  200. +    }
  201. +    if (win_mask & FILE_WRITE_ATTRIBUTES) {
  202. +        *nfs4_mask |= ACE4_WRITE_ATTRIBUTES;
  203. +    }
  204. +    if (win_mask & READ_CONTROL) {
  205. +        *nfs4_mask |= ACE4_READ_ACL;
  206. +    }
  207. +    if (win_mask & WRITE_DAC) {
  208. +        *nfs4_mask |= ACE4_WRITE_ACL;
  209. +    }
  210. +    if (win_mask & WRITE_OWNER) {
  211. +        *nfs4_mask |= ACE4_WRITE_OWNER;
  212. +    }
  213. +    if (win_mask & SYNCHRONIZE) {
  214. +        *nfs4_mask |= ACE4_SYNCHRONIZE;
  215. +    }
  216. +    if (win_mask & DELETE) {
  217. +        *nfs4_mask |= ACE4_DELETE;
  218. +    }
  219. +
  220. +#if 1
  221. +    /* Compare old and new code */
  222. +    EASSERT_MSG(((long)*nfs4_mask == (long)(win_mask /*& 0x00ffffff*/)),
  223. +        ("map_winaccessmask2nfs4acemask: "
  224. +        "new code nfs4_mask=0x%lx, "
  225. +        "old code nfs4_mask=0x%lx\n",
  226. +        (long)*nfs4_mask, (long)(win_mask /*& 0x00ffffff*/)));
  227. +#endif
  228. +}
  229. +
  230. +static
  231. +void map_nfs4acemask2winaccessmask(uint32_t nfs4_mask,
  232. +    int file_type, ACCESS_MASK *win_mask)
  233. +{
  234. +#ifdef GENERIC_DISABLED_FOR_NOW
  235. +    bool is_generic = false;
  236. +
  237. +    /*
  238. +     * Generic masks
  239. +     * (|ACE4_GENERIC_*| contain multiple bits
  240. +     */
  241. +    if ((nfs4_mask & ACE4_GENERIC_READ) == ACE4_GENERIC_READ) {
  242. +        *win_mask |= GENERIC_READ;
  243. +        is_generic = true;
  244. +    }
  245. +    if ((nfs4_mask & ACE4_GENERIC_WRITE) == ACE4_GENERIC_WRITE) {
  246. +        *win_mask |= GENERIC_WRITE;
  247. +        is_generic = true;
  248. +    }
  249. +    if ((nfs4_mask & ACE4_GENERIC_EXECUTE) == ACE4_GENERIC_EXECUTE) {
  250. +        *win_mask |= GENERIC_EXECUTE;
  251. +        is_generic = true;
  252. +    }
  253. +
  254. +    if (file_type == NF4DIR) {
  255. +        if ((nfs4_mask & ACE4_ALL_DIR) == ACE4_ALL_DIR) {
  256. +            *win_mask |= GENERIC_ALL;
  257. +            is_generic = true;
  258. +        }
  259. +    }
  260. +    else {
  261. +        if ((nfs4_mask & ACE4_ALL_FILE) == ACE4_ALL_FILE) {
  262. +            *win_mask |= GENERIC_ALL;
  263. +            is_generic = true;
  264. +        }
  265. +    }
  266. +#if 0
  267. +    if (is_generic)
  268. +        goto mapping_done;
  269. +#endif
  270. +#endif /* GENERIC_DISABLED_FOR_NOW */
  271. +
  272. +    /* Individual flags */
  273. +    if (file_type == NF4DIR) {
  274. +        if (nfs4_mask & ACE4_LIST_DIRECTORY) {
  275. +            *win_mask |= FILE_LIST_DIRECTORY;
  276. +        }
  277. +        if (nfs4_mask & ACE4_ADD_FILE) {
  278. +            *win_mask |= FILE_ADD_FILE;
  279. +        }
  280. +        if (nfs4_mask & ACE4_ADD_SUBDIRECTORY) {
  281. +            *win_mask |= FILE_ADD_SUBDIRECTORY;
  282. +        }
  283. +        if (nfs4_mask & ACE4_DELETE_CHILD) {
  284. +            *win_mask |= FILE_DELETE_CHILD;
  285. +        }
  286. +        if (nfs4_mask & ACE4_EXECUTE) {
  287. +            *win_mask |= FILE_TRAVERSE;
  288. +        }
  289. +    }
  290. +    else {
  291. +        if (nfs4_mask & ACE4_READ_DATA) {
  292. +            *win_mask |= FILE_READ_DATA;
  293. +        }
  294. +        if (nfs4_mask & ACE4_WRITE_DATA) {
  295. +            *win_mask |= FILE_WRITE_DATA;
  296. +        }
  297. +        if (nfs4_mask & ACE4_APPEND_DATA) {
  298. +            *win_mask |= FILE_APPEND_DATA;
  299. +        }
  300. +        if (nfs4_mask & ACE4_EXECUTE) {
  301. +            *win_mask |= FILE_EXECUTE;
  302. +        }
  303. +    }
  304. +
  305. +    if (nfs4_mask & ACE4_READ_NAMED_ATTRS) {
  306. +        *win_mask |= FILE_READ_EA;
  307. +    }
  308. +    if (nfs4_mask & ACE4_WRITE_NAMED_ATTRS) {
  309. +        *win_mask |= FILE_WRITE_EA;
  310. +    }
  311. +    if (nfs4_mask & ACE4_READ_ATTRIBUTES) {
  312. +        *win_mask |= FILE_READ_ATTRIBUTES;
  313. +    }
  314. +    if (nfs4_mask & ACE4_WRITE_ATTRIBUTES) {
  315. +        *win_mask |= FILE_WRITE_ATTRIBUTES;
  316. +    }
  317. +    if (nfs4_mask & ACE4_READ_ACL) {
  318. +        *win_mask |= READ_CONTROL;
  319. +    }
  320. +    if (nfs4_mask & ACE4_WRITE_ACL) {
  321. +        *win_mask |= WRITE_DAC;
  322. +    }
  323. +    if (nfs4_mask & ACE4_WRITE_OWNER) {
  324. +        *win_mask |= WRITE_OWNER;
  325. +    }
  326. +    if (nfs4_mask & ACE4_SYNCHRONIZE) {
  327. +        *win_mask |= SYNCHRONIZE;
  328. +    }
  329. +    if (nfs4_mask & ACE4_DELETE) {
  330. +        *win_mask |= DELETE;
  331. +    }
  332. +
  333. +#ifdef GENERIC_DISABLED_FOR_NOW
  334. +mapping_done:
  335. +#endif
  336. +
  337. +#if 1
  338. +    /* Compare old and new code */
  339. +    EASSERT_MSG(((long)*win_mask == (long)(nfs4_mask /*& 0x00ffffff*/)),
  340. +        ("#### map_nfs4acemask2winaccessmask: "
  341. +        "new code win_mask=0x%lx, "
  342. +        "old code win_mask=0x%lx\n",
  343. +        (long)*win_mask, (long)(nfs4_mask /*& 0x00ffffff*/)));
  344. +#endif
  345.  }
  346.  
  347.  static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_out, char *domain, SID_NAME_USE *sid_type_out)
  348. @@ -723,6 +921,7 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  349.          PACE_HEADER ace;
  350.          PBYTE tmp_pointer;
  351.          SID_NAME_USE who_sid_type = 0;
  352. +        ACCESS_MASK win_mask;
  353.  
  354.          DPRINTF(ACLLVL, ("NON-NULL dacl with %d ACEs\n", acl->AceCount));
  355.          if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  356. @@ -760,10 +959,6 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  357.                  goto out_free;
  358.              }
  359.  
  360. -            map_winace2nfs4aceflags(ace->AceFlags, &nfs4_acl->aces[i].aceflag);
  361. -            map_winaccessmask2nfs4acemask(*(PACCESS_MASK)(ace + 1),
  362. -                file_type, &nfs4_acl->aces[i].acemask);
  363. -
  364.              tmp_pointer += sizeof(ACCESS_MASK) + sizeof(ACE_HEADER);
  365.  
  366.              status = map_nfs4ace_who(tmp_pointer, sid, gsid, nfs4_acl->aces[i].who,
  367. @@ -771,6 +966,27 @@ static int map_dacl_2_nfs4acl(PACL acl, PSID sid, PSID gsid, nfsacl41 *nfs4_acl,
  368.              if (status)
  369.                  goto out_free;
  370.  
  371. +            win_mask = *(PACCESS_MASK)(ace + 1);
  372. +
  373. +            map_winace2nfs4aceflags(ace->AceFlags,
  374. +                &nfs4_acl->aces[i].aceflag);
  375. +            map_winaccessmask2nfs4acemask(win_mask,
  376. +                file_type, &nfs4_acl->aces[i].acemask);
  377. +
  378. +            if (DPRINTF_LEVEL_ENABLED(ACLLVL)) {
  379. +                dprintf_out("win2nfs: nfs4_acl->aces[%d].who='%s', "
  380. +                    "acetype='%s', "
  381. +                    "win_mask=0x%lx, nfs_acemask=0x%lx\n",
  382. +                    i, nfs4_acl->aces[i].who,
  383. +                    (nfs4_acl->aces[i].acetype?
  384. +                        "DENIED ACE":"ALLOWED ACE"),
  385. +                    (long)win_mask, (long)nfs4_acl->aces[i].acemask);
  386. +                print_windows_access_mask(nfs4_acl->aces[i].who,
  387. +                    win_mask);
  388. +                print_nfs_access_mask(nfs4_acl->aces[i].who,
  389. +                    nfs4_acl->aces[i].acemask);
  390. +            }
  391. +
  392.              /*
  393.               * Treat |SidTypeAlias| as (local) group
  394.               *
  395. @@ -814,7 +1030,8 @@ static int handle_setacl(void *daemon_context, nfs41_upcall *upcall)
  396.      char ownerbuf[NFS4_OPAQUE_LIMIT+1];
  397.      char groupbuf[NFS4_OPAQUE_LIMIT+1];
  398.  
  399. -    DPRINTF(ACLLVL, ("--> handle_setacl()\n"));
  400. +    DPRINTF(ACLLVL, ("--> handle_setacl(state->path.path='%s')\n",
  401. +        state->path.path));
  402.  
  403.      if (args->query & OWNER_SECURITY_INFORMATION) {
  404.          DPRINTF(ACLLVL, ("handle_setacl: OWNER_SECURITY_INFORMATION\n"));
  405. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  406. index dcf2f4d..9d555e1 100644
  407. --- a/daemon/daemon_debug.c
  408. +++ b/daemon/daemon_debug.c
  409. @@ -819,13 +819,26 @@ const char *map_nfs_ftype2str(int ftype)
  410.      return "<Unknown nfs_ftype4 type>";
  411.  }
  412.  
  413. -void print_windows_access_mask(ACCESS_MASK win_mask)
  414. +const char *map_nfs_acetype2str(uint32_t ace_type)
  415.  {
  416. -    dprintf_out("--> print_windows_access_mask: 0x%lx\n", (long)win_mask);
  417. +    switch(ace_type) {
  418. +#define ACETYPE2STRLITERAL(e) case e: return #e;
  419. +        ACETYPE2STRLITERAL(ACE4_ACCESS_ALLOWED_ACE_TYPE)
  420. +        ACETYPE2STRLITERAL(ACE4_ACCESS_DENIED_ACE_TYPE)
  421. +        ACETYPE2STRLITERAL(ACE4_SYSTEM_AUDIT_ACE_TYPE)
  422. +        ACETYPE2STRLITERAL(ACE4_SYSTEM_ALARM_ACE_TYPE)
  423. +    }
  424. +
  425. +    return "<Unknown ace_type type>";
  426. +}
  427. +
  428. +void print_windows_access_mask(const char *label, ACCESS_MASK win_mask)
  429. +{
  430. +    dprintf_out("--> print_windows_access_mask"
  431. +        "(label='%s',win_mask=0x%lx)\n", label, (long)win_mask);
  432.  #define PRINTWINACCESSMASKBITS(s) \
  433. -    if ((win_mask & (s)) == (s)) { \
  434. +    if (win_mask & (s)) { \
  435.          dprintf_out("\t" #s "\n"); \
  436. -        win_mask &= ~(s); \
  437.      }
  438.      PRINTWINACCESSMASKBITS(GENERIC_READ);
  439.      PRINTWINACCESSMASKBITS(GENERIC_WRITE);
  440. @@ -860,20 +873,16 @@ void print_windows_access_mask(ACCESS_MASK win_mask)
  441.      PRINTWINACCESSMASKBITS(FILE_GENERIC_WRITE);
  442.      PRINTWINACCESSMASKBITS(FILE_GENERIC_EXECUTE);
  443.  
  444. -    /* Print any "leftover" bits */
  445. -    if (win_mask) {
  446. -        dprintf_out("\t0x%lx\n", (long)win_mask);
  447. -    }
  448.      dprintf_out("<-- print_windows_access_mask\n");
  449.  }
  450.  
  451. -void print_nfs_access_mask(uint32_t nfs_mask)
  452. +void print_nfs_access_mask(const char *label, uint32_t nfs_mask)
  453.  {
  454. -    dprintf_out("--> print_nfs_access_mask: 0x%lx\n", (long)nfs_mask);
  455. +    dprintf_out("--> print_nfs_access_mask("
  456. +        "label='%s',nfs_mask=0x%lx)\n", label, (long)nfs_mask);
  457.  #define PRINTNFSMASKBITS(s) \
  458. -    if ((nfs_mask & (s)) == (s)) { \
  459. +    if (nfs_mask & (s)) { \
  460.          dprintf_out("\t" #s "\n"); \
  461. -        nfs_mask &= ~(s); \
  462.      }
  463.      PRINTNFSMASKBITS(ACE4_READ_DATA);
  464.      PRINTNFSMASKBITS(ACE4_LIST_DIRECTORY);
  465. @@ -899,10 +908,6 @@ void print_nfs_access_mask(uint32_t nfs_mask)
  466.      PRINTNFSMASKBITS(ACE4_GENERIC_EXECUTE);
  467.      PRINTNFSMASKBITS(ACE4_FILE_ALL_ACCESS);
  468.  
  469. -    /* Print any "leftover" bits */
  470. -    if (nfs_mask) {
  471. -        dprintf_out("\t0x%lx\n", (long)nfs_mask);
  472. -    }
  473.      dprintf_out("<-- print_nfs_access_mask\n");
  474.  }
  475.  
  476. diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
  477. index 78e5925..e283296 100644
  478. --- a/daemon/daemon_debug.h
  479. +++ b/daemon/daemon_debug.h
  480. @@ -105,8 +105,9 @@ void eprintf_out(LPCSTR format, ...);
  481.  void eprintf(LPCSTR format, ...);
  482.  
  483.  const char *map_nfs_ftype2str(int ftype);
  484. -void print_windows_access_mask(ACCESS_MASK win_mask);
  485. -void print_nfs_access_mask(uint32_t nfs_mask);
  486. +const char *map_nfs_acetype2str(uint32_t ace_type);
  487. +void print_windows_access_mask(const char *label, ACCESS_MASK win_mask);
  488. +void print_nfs_access_mask(const char *label, uint32_t nfs_mask);
  489.  void print_hexbuf_no_asci(const char *title, const unsigned char *buf, int len);
  490.  void print_hexbuf(const char *title, const unsigned char *buf, int len);
  491.  void print_create_attributes(int level, DWORD create_opts);
  492. --
  493. 2.45.1
  494.  
  495. From ae79e6d0bd397717bae86a5dcd2539b0334841a3 Mon Sep 17 00:00:00 2001
  496. From: Roland Mainz <roland.mainz@nrubsig.org>
  497. Date: Wed, 19 Jun 2024 17:31:23 +0200
  498. Subject: [PATCH 2/2] cygwin: sshnfs should provide mount instructions for
  499.  Windows+ms-nfs41-client targets
  500.  
  501. sshnfs should provide mount instructions for Windows targets
  502. with ms-nfs41-client
  503.  
  504. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  505. ---
  506. cygwin/utils/sshnfs/sshnfs.ksh | 13 ++++++++++++-
  507.  1 file changed, 12 insertions(+), 1 deletion(-)
  508.  
  509. diff --git a/cygwin/utils/sshnfs/sshnfs.ksh b/cygwin/utils/sshnfs/sshnfs.ksh
  510. index 32b8668..bfccabb 100644
  511. --- a/cygwin/utils/sshnfs/sshnfs.ksh
  512. +++ b/cygwin/utils/sshnfs/sshnfs.ksh
  513. @@ -453,11 +453,22 @@ function main
  514.                                                 -O 'check' \
  515.                                                 "${c.nfsserver_ssh_login_name}@${c.nfs_server.host}"
  516.  
  517. -                               print -u2 -f $"# Use this to mount the directory:\n"
  518. +                               print -u2 -f $"# Linux: Use this to mount the directory:\n"
  519.                                 print -u2 -f $"# $ mkdir /mnt_nfs\n"
  520.                                 print -u2 -f $"# $ mount -vvv -t nfs -o vers=4.2,port=%d localhost:%s /mnt_nfs\n" \
  521.                                         c.destination_nfs_port \
  522.                                         "${c.nfs_server.uripath}"
  523. +                               print -u2 -f $"\n"
  524. +
  525. +                               # note that OpenSSH on Windows (not Cygwin) will clear the screen
  526. +                               # imediately after login
  527. +                               print -u2 -f $"# Windows/ms-nfs41-client: Use this to mount the directory:\n"
  528. +                               print -u2 -f $"# > %s --login\n" "C:\cygwin64\bin\bash.exe"
  529. +                               print -u2 -f $"# $ /sbin/nfs_mount -o rw 'S' nfs://localhost:%d/%(url)q\n" \
  530. +                                       c.destination_nfs_port \
  531. +                                       "${c.nfs_server.uripath}"
  532. +                               print -u2 -f $"\n\n"
  533. +
  534.  
  535.                                 #
  536.                                 # add NFS forwarding options to main ssh argument list
  537. --
  538. 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