@@ -2422,16 +2422,8 @@ static void fs__chmod(uv_fs_t* req) {
2422
2422
continue ;
2423
2423
}
2424
2424
2425
- /* Check to see if our user is a member of this group */
2426
- if (!CheckTokenMembership (hImpersonatedToken , pEASid , & isMember )) {
2427
- SET_REQ_WIN32_ERROR (req , GetLastError ());
2428
- goto chmod_cleanup ;
2429
- }
2430
-
2431
- /* If we're a member, then count it */
2432
- if (isMember ) {
2433
- numOtherGroups ++ ;
2434
- }
2425
+ /* Count these as "other" groups */
2426
+ numOtherGroups ++ ;
2435
2427
}
2436
2428
2437
2429
/* Create an ACE for each triplet (user, group, other) */
@@ -2491,16 +2483,21 @@ static void fs__chmod(uv_fs_t* req) {
2491
2483
}
2492
2484
2493
2485
/*
2494
- * If we're a member, then count it. We limit our `ea_write_idx` to avoid
2495
- * the unlikely event that we have been added to a group since we first
2496
- * calculated `numOtherGroups`.
2486
+ * We limit our `ea_write_idx` to avoid the unlikely event that we
2487
+ * have been added to a group since we first calculated `numOtherGroups`.
2497
2488
*/
2498
- if (isMember && ea_write_idx < numNewEAs ) {
2499
- build_access_struct (& ea [ea_write_idx ], pEASid , TRUSTEE_IS_GROUP , 0 , REVOKE_ACCESS );
2489
+ assert (ea_write_idx <= numNewEAs - 3 );
2490
+ if (isMember ) {
2491
+ build_access_struct (& ea [ea_write_idx + 0 ], pEASid , TRUSTEE_IS_GROUP , 0 , REVOKE_ACCESS );
2500
2492
build_access_struct (& ea [ea_write_idx + 1 ], pEASid , TRUSTEE_IS_GROUP , g_deny_mode , DENY_ACCESS );
2501
2493
build_access_struct (& ea [ea_write_idx + 2 ], pEASid , TRUSTEE_IS_GROUP , g_mode , SET_ACCESS );
2502
- ea_write_idx += 3 ;
2494
+ } else {
2495
+ /* We revoke a second time here to keep offset management simple in groups of three. */
2496
+ build_access_struct (& ea [ea_write_idx + 0 ], pEASid , TRUSTEE_IS_GROUP , 0 , REVOKE_ACCESS );
2497
+ build_access_struct (& ea [ea_write_idx + 1 ], pEASid , TRUSTEE_IS_GROUP , 0 , REVOKE_ACCESS );
2498
+ build_access_struct (& ea [ea_write_idx + 2 ], pEASid , TRUSTEE_IS_GROUP , o_mode , SET_ACCESS );
2503
2499
}
2500
+ ea_write_idx += 3 ;
2504
2501
}
2505
2502
2506
2503
/* Set entries in the ACL object */
0 commit comments