mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-20 03:26:53 +00:00
libselinux/utils/selabel_digest: pass BASEONLY only for file backend
Since commit65c8fd45
("libselinux: fail selabel_open(3) on invalid option") selabel_open(3) rejects options not supported for the respective backend. Pass SELABEL_OPT_BASEONLY only if the file backend is selected. Reported-by: zgzxx (https://github.com/SELinuxProject/selinux/issues/427) Fixes:65c8fd45
("libselinux: fail selabel_open(3) on invalid option") Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
5876aca048
commit
fb497895e1
@ -71,8 +71,8 @@ int main(int argc, char **argv)
|
||||
struct selabel_handle *hnd;
|
||||
struct selinux_opt selabel_option[] = {
|
||||
{ SELABEL_OPT_PATH, file },
|
||||
{ SELABEL_OPT_BASEONLY, baseonly },
|
||||
{ SELABEL_OPT_DIGEST, digest }
|
||||
{ SELABEL_OPT_DIGEST, digest },
|
||||
{ SELABEL_OPT_BASEONLY, baseonly }
|
||||
};
|
||||
|
||||
if (argc < 3)
|
||||
@ -119,10 +119,10 @@ int main(int argc, char **argv)
|
||||
memset(cmd_buf, 0, sizeof(cmd_buf));
|
||||
|
||||
selabel_option[0].value = file;
|
||||
selabel_option[1].value = baseonly;
|
||||
selabel_option[2].value = digest;
|
||||
selabel_option[1].value = digest;
|
||||
selabel_option[2].value = baseonly;
|
||||
|
||||
hnd = selabel_open(backend, selabel_option, 3);
|
||||
hnd = selabel_open(backend, selabel_option, backend == SELABEL_CTX_FILE ? 3 : 2);
|
||||
if (!hnd) {
|
||||
switch (errno) {
|
||||
case EOVERFLOW:
|
||||
|
Loading…
Reference in New Issue
Block a user