public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: Some SELABEL_ options are only supported in SELABEL_CTX_FILE
@ 2026-09-11 13:22 Petr Lautrbach
0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-09-11 13:22 UTC (permalink / raw)
To: git-commits
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: ");
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:22 [tests/selinux] pr775-checkpolicy-revdeps: Some SELABEL_ options are only supported in SELABEL_CTX_FILE Petr Lautrbach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox