diff options
-rw-r--r-- | src/cmds/ntux_cmd_chmod.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/cmds/ntux_cmd_chmod.c b/src/cmds/ntux_cmd_chmod.c index a8d25cb..416d756 100644 --- a/src/cmds/ntux_cmd_chmod.c +++ b/src/cmds/ntux_cmd_chmod.c @@ -57,16 +57,11 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit) void * hasync = 0; uint32_t buf[0x300]; - /* initial version: --strmode only */ + /* ACE propagation: +p, -p */ if (!dctx->cctx->strmode) - return ntux_cmd_chmod_ret( - 0,0,0, - NTUX_CUSTOM_ERROR( - dctx, - NTUX_ERR_FLEE_ERROR)); + ace_flags = 0; - /* ACE propagation: +p, -p */ - if (!strcmp(dctx->cctx->strmode,"+p")) + else if (!strcmp(dctx->cctx->strmode,"+p")) ace_flags = NT_ACE_CONTAINER_INHERIT | NT_ACE_OBJECT_INHERIT; else if (!strcmp(dctx->cctx->strmode,"-p")) @@ -145,6 +140,14 @@ int ntux_cmd_chmod(const struct ntux_driver_ctx * dctx, const char * dunit) access_other = meta.other_ace ? meta.other_ace->mask : 0; access_admin = meta.admin_ace ? meta.admin_ace->mask : 0; + /* initial --strmode support, retaining previous options as needed */ + if (!dctx->cctx->strmode) { + ace_flags |= meta.owner_ace ? meta.owner_ace->header.ace_flags : 0; + ace_flags |= meta.group_ace ? meta.group_ace->header.ace_flags : 0; + ace_flags |= meta.other_ace ? meta.other_ace->header.ace_flags : 0; + ace_flags |= meta.admin_ace ? meta.admin_ace->header.ace_flags : 0; + } + /* updated dacl */ __xfi_acl_init_common_descriptor( &dstsd, |