summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-commit.c
diff options
context:
space:
mode:
authorLuca BRUNO <luca.bruno@coreos.com>2021-08-17 10:30:06 +0000
committerLuca BRUNO <luca.bruno@coreos.com>2021-08-18 08:16:26 +0000
commit5a3d5fb86f3d617c0c759c946fff92eec3e2bbad (patch)
treef5fccaed61f06c749e5ef5984c76e440ca371b85 /src/ostree/ot-builtin-commit.c
parent87db562744cc47610ca2d7212259ded5b0f5fb0d (diff)
downloadostree-5a3d5fb86f3d617c0c759c946fff92eec3e2bbad.tar.gz
builtins/commit: check for conflicting permissions options
This explicitly checks for commit command options asking for both non-zero UID/GID and canonical permissions at the same time, which are incompatible.
Diffstat (limited to 'src/ostree/ot-builtin-commit.c')
-rw-r--r--src/ostree/ot-builtin-commit.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c
index 7a23741e..5aecdbdb 100644
--- a/src/ostree/ot-builtin-commit.c
+++ b/src/ostree/ot-builtin-commit.c
@@ -555,6 +555,23 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
detached_metadata = g_variant_ref_sink (g_variant_builder_end (builder));
}
+ /* Check for conflicting options */
+ if (opt_canonical_permissions && opt_owner_uid > 0)
+ {
+ glnx_throw (error, "Cannot specify both --canonical-permissions and non-zero --owner-uid");
+ goto out;
+ }
+ if (opt_canonical_permissions && opt_owner_gid > 0)
+ {
+ glnx_throw (error, "Cannot specify both --canonical-permissions and non-zero --owner-gid");
+ goto out;
+ }
+ if (opt_selinux_policy && opt_selinux_policy_from_base)
+ {
+ glnx_throw (error, "Cannot specify both --selinux-policy and --selinux-policy-from-base");
+ goto out;
+ }
+
if (opt_no_xattrs)
flags |= OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS;
if (opt_consume)
@@ -570,11 +587,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
flags |= OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES;
if (opt_disable_fsync)
ostree_repo_set_disable_fsync (repo, TRUE);
- if (opt_selinux_policy && opt_selinux_policy_from_base)
- {
- glnx_throw (error, "Cannot specify both --selinux-policy and --selinux-policy-from-base");
- goto out;
- }
if (flags != 0
|| opt_owner_uid >= 0