public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Petr Lautrbach <lautrbach@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: Some SELABEL_ options are only supported in SELABEL_CTX_FILE
Date: Fri, 11 Sep 2026 13:22:00 GMT [thread overview]
Message-ID: <178913292005.1.15627256659823926154.tests-selinux-186b346eedae@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 186b346eedae46f437fc62b13cdd244cc69793fc
Author : Petr Lautrbach <lautrbach@redhat.com>
Date : 2024-09-24T16:18:45+02:00
Stats : +50/-50 in 4 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/186b346eedae46f437fc62b13cdd244cc69793fc?branch=pr775-checkpolicy-revdeps
Log:
Some SELABEL_ options are only supported in SELABEL_CTX_FILE
Since
https://github.com/SELinuxProject/selinux/commit/65c8fd457b056dc23756be2fc80847e57bac768d
selabel_open() would fail if used with unsupported option
Fixes:
selabel_open - ERROR: Invalid argument
selabel_options: SELABEL_OPT_PATH = (null), SELABEL_OPT_SUBSET = (null), SELABEL_OPT_VALIDATE = 0, SELABEL_OPT_BASEONLY = 0
Executing: selabel_open(SELABEL_CTX_MEDIA, &selabel_option, 4)
:: [ 07:57:09 ] :: [ FAIL ] :: Command './test_open CTX_MEDIA NULL NULL 0 0' (Expected 0, got 22)
---
diff --git a/libselinux/selabel-functions/test_best.c b/libselinux/selabel-functions/test_best.c
index 7eca4f4..ffa1ade 100644
--- a/libselinux/selabel-functions/test_best.c
+++ b/libselinux/selabel-functions/test_best.c
@@ -13,9 +13,9 @@ int main (int argc, char **argv)
struct selinux_opt selabel_option [] = {
{ SELABEL_OPT_PATH, NULL },
- { SELABEL_OPT_SUBSET, NULL },
+ { SELABEL_OPT_UNUSED, NULL },
{ SELABEL_OPT_VALIDATE, (char *) 1 },
- { SELABEL_OPT_BASEONLY, (char *) 1 }
+ { SELABEL_OPT_UNUSED, NULL }
};
if (argc < 8) {
@@ -52,11 +52,11 @@ int main (int argc, char **argv)
}
// set subset
- if (strcmp(argv[3], "NULL") == 0) {
- selabel_option[1].value = NULL;
- }
- else {
- selabel_option[1].value = argv[3];
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[1].type = SELABEL_OPT_SUBSET;
+ if (strcmp(argv[3], "NULL") != 0) {
+ selabel_option[1].value = argv[3];
+ }
}
// set validate
@@ -68,11 +68,11 @@ int main (int argc, char **argv)
}
// set baseonly
- if (strcmp(argv[5], "0") == 0) {
- selabel_option[3].value = NULL;
- }
- else {
- selabel_option[3].value = (char *) 1;
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[3].type = SELABEL_OPT_BASEONLY;
+ if (strcmp(argv[5], "0") != 0) {
+ selabel_option[3].value = (char *) 1;
+ }
}
printf("selabel_options: ");
diff --git a/libselinux/selabel-functions/test_lookup.c b/libselinux/selabel-functions/test_lookup.c
index ee0caaa..268e460 100644
--- a/libselinux/selabel-functions/test_lookup.c
+++ b/libselinux/selabel-functions/test_lookup.c
@@ -13,9 +13,9 @@ int main (int argc, char **argv)
struct selinux_opt selabel_option [] = {
{ SELABEL_OPT_PATH, NULL },
- { SELABEL_OPT_SUBSET, NULL },
+ { SELABEL_OPT_UNUSED, NULL },
{ SELABEL_OPT_VALIDATE, (char *) 1 },
- { SELABEL_OPT_BASEONLY, (char *) 1 }
+ { SELABEL_OPT_UNUSED, NULL }
};
if (argc < 8) {
@@ -53,11 +53,11 @@ int main (int argc, char **argv)
}
// set subset
- if (strcmp(argv[3], "NULL") == 0) {
- selabel_option[1].value = NULL;
- }
- else {
- selabel_option[1].value = argv[3];
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[1].type = SELABEL_OPT_SUBSET;
+ if (strcmp(argv[3], "NULL") != 0) {
+ selabel_option[1].value = argv[3];
+ }
}
// set validate
@@ -69,11 +69,11 @@ int main (int argc, char **argv)
}
// set baseonly
- if (strcmp(argv[5], "0") == 0) {
- selabel_option[3].value = NULL;
- }
- else {
- selabel_option[3].value = (char *) 1;
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[3].type = SELABEL_OPT_BASEONLY;
+ if (strcmp(argv[5], "0") != 0) {
+ selabel_option[3].value = (char *) 1;
+ }
}
printf("selabel_options: ");
diff --git a/libselinux/selabel-functions/test_open.c b/libselinux/selabel-functions/test_open.c
index 87f61ee..f19f720 100644
--- a/libselinux/selabel-functions/test_open.c
+++ b/libselinux/selabel-functions/test_open.c
@@ -14,9 +14,9 @@ int main (int argc, char **argv)
struct selinux_opt selabel_option [] = {
{ SELABEL_OPT_PATH, NULL },
- { SELABEL_OPT_SUBSET, NULL },
+ { SELABEL_OPT_UNUSED, NULL },
{ SELABEL_OPT_VALIDATE, (char *) 1 },
- { SELABEL_OPT_BASEONLY, (char *) 1 }
+ { SELABEL_OPT_UNUSED, NULL }
};
if (argc < 6) {
@@ -49,12 +49,12 @@ int main (int argc, char **argv)
}
// set subset
- if (strcmp(argv[3], "NULL") == 0) {
- selabel_option[1].value = NULL;
- }
- else {
- selabel_option[1].value = argv[3];
- }
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[1].type = SELABEL_OPT_SUBSET;
+ if (strcmp(argv[3], "NULL") != 0) {
+ selabel_option[1].value = argv[3];
+ }
+ }
// set validate
if (strcmp(argv[4], "0") == 0) {
@@ -65,12 +65,12 @@ int main (int argc, char **argv)
}
// set baseonly
- if (strcmp(argv[5], "0") == 0) {
- selabel_option[3].value = NULL;
- }
- else {
- selabel_option[3].value = (char *) 1;
- }
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[3].type = SELABEL_OPT_BASEONLY;
+ if (strcmp(argv[5], "0") != 0) {
+ selabel_option[3].value = (char *) 1;
+ }
+ }
if (argc == 7) {
nopt = strtol(argv[6], NULL, 10);
diff --git a/libselinux/selabel-functions/test_partial.c b/libselinux/selabel-functions/test_partial.c
index 4513cfa..dd60016 100644
--- a/libselinux/selabel-functions/test_partial.c
+++ b/libselinux/selabel-functions/test_partial.c
@@ -13,9 +13,9 @@ int main (int argc, char **argv)
struct selinux_opt selabel_option [] = {
{ SELABEL_OPT_PATH, NULL },
- { SELABEL_OPT_SUBSET, NULL },
+ { SELABEL_OPT_UNUSED, NULL },
{ SELABEL_OPT_VALIDATE, (char *) 1 },
- { SELABEL_OPT_BASEONLY, (char *) 1 }
+ { SELABEL_OPT_UNUSED, NULL }
};
if (argc < 7) {
@@ -52,11 +52,11 @@ int main (int argc, char **argv)
}
// set subset
- if (strcmp(argv[3], "NULL") == 0) {
- selabel_option[1].value = NULL;
- }
- else {
- selabel_option[1].value = argv[3];
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[1].type = SELABEL_OPT_SUBSET;
+ if (strcmp(argv[3], "NULL") != 0) {
+ selabel_option[1].value = argv[3];
+ }
}
// set validate
@@ -68,11 +68,11 @@ int main (int argc, char **argv)
}
// set baseonly
- if (strcmp(argv[5], "0") == 0) {
- selabel_option[3].value = NULL;
- }
- else {
- selabel_option[3].value = (char *) 1;
+ if (backend == SELABEL_CTX_FILE) {
+ selabel_option[3].type = SELABEL_OPT_BASEONLY;
+ if (strcmp(argv[5], "0") != 0) {
+ selabel_option[3].value = (char *) 1;
+ }
}
printf("selabel_options: ");
reply other threads:[~2026-09-11 13:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178913292005.1.15627256659823926154.tests-selinux-186b346eedae@fedoraproject.org \
--to=lautrbach@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox