mirror of
https://github.com/SELinuxProject/selinux
synced 2025-05-11 03:58:02 +00:00
libselinux: fail selabel_open(3) on invalid option
Return an error on invalid selabel_open(3) options, e.g. an option for a different backend was used. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
7f925776d9
commit
65c8fd457b
@ -157,6 +157,13 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
|
||||
case SELABEL_OPT_PATH:
|
||||
path = opts[n].value;
|
||||
break;
|
||||
case SELABEL_OPT_UNUSED:
|
||||
case SELABEL_OPT_VALIDATE:
|
||||
case SELABEL_OPT_DIGEST:
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!path)
|
||||
|
@ -268,6 +268,14 @@ db_init(const struct selinux_opt *opts, unsigned nopts,
|
||||
case SELABEL_OPT_PATH:
|
||||
path = opts[nopts].value;
|
||||
break;
|
||||
case SELABEL_OPT_UNUSED:
|
||||
case SELABEL_OPT_VALIDATE:
|
||||
case SELABEL_OPT_DIGEST:
|
||||
break;
|
||||
default:
|
||||
free(catalog);
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -812,6 +812,13 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
|
||||
case SELABEL_OPT_BASEONLY:
|
||||
baseonly = !!opts[n].value;
|
||||
break;
|
||||
case SELABEL_OPT_UNUSED:
|
||||
case SELABEL_OPT_VALIDATE:
|
||||
case SELABEL_OPT_DIGEST:
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(BUILD_HOST) && !defined(ANDROID)
|
||||
|
@ -85,6 +85,13 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
|
||||
case SELABEL_OPT_PATH:
|
||||
path = opts[n].value;
|
||||
break;
|
||||
case SELABEL_OPT_UNUSED:
|
||||
case SELABEL_OPT_VALIDATE:
|
||||
case SELABEL_OPT_DIGEST:
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Open the specification file. */
|
||||
|
@ -112,6 +112,13 @@ static int init(struct selabel_handle *rec, const struct selinux_opt *opts,
|
||||
case SELABEL_OPT_PATH:
|
||||
path = opts[n].value;
|
||||
break;
|
||||
case SELABEL_OPT_UNUSED:
|
||||
case SELABEL_OPT_VALIDATE:
|
||||
case SELABEL_OPT_DIGEST:
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Open the specification file. */
|
||||
|
Loading…
Reference in New Issue
Block a user