diff options
author | midipix <writeonce@midipix.org> | 2020-05-13 14:14:56 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2020-05-14 07:18:54 +0000 |
commit | 354869228432b19b7eda7fc2cf186bf980e02c4c (patch) | |
tree | 42d9a89b7f8014286d275a63b3d22b9ed5f8924a /src | |
parent | de8f1c50cdd48b3f06226de300e9d2cfb440f484 (diff) | |
download | ntux-354869228432b19b7eda7fc2cf186bf980e02c4c.tar.bz2 ntux-354869228432b19b7eda7fc2cf186bf980e02c4c.tar.xz |
ntux_cmd_chmod(): --strmode is now optional.
Diffstat (limited to 'src')
-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, |