Unfortunately, the current libselinux implementation of
is_selinux_enabled() returns -1 on error. This behavior is
undocumented.
The proper solution is to use "if (is_selinux_enabled() > 0)".
Signed-off-by: Karel Zak <kzak@redhat.com>
#endif
#ifdef HAVE_LIBSELINUX
- if (S_ISREG(statbuf.st_mode) && is_selinux_enabled()) {
+ if (S_ISREG(statbuf.st_mode) && is_selinux_enabled() > 0) {
security_context_t context_string;
security_context_t oldcontext;
context_t newcontext;
}
#ifdef HAVE_LIBSELINUX
- if (is_selinux_enabled()) {
+ if (is_selinux_enabled() > 0) {
if(uid == 0) {
if (checkAccess(oldf.username,PASSWD__CHFN)!=0) {
security_context_t user_context;
}
#ifdef HAVE_LIBSELINUX
- if (is_selinux_enabled()) {
+ if (is_selinux_enabled() > 0) {
if(uid == 0) {
if (checkAccess(pw->pw_name,PASSWD__CHSH)!=0) {
security_context_t user_context;
}
int setupDefaultContext(char *orig_file) {
- if (is_selinux_enabled()) {
+ if (is_selinux_enabled() > 0) {
security_context_t scontext;
if (getfilecon(orig_file,&scontext)<0) {
link(orig_file, tmp);
#ifdef HAVE_LIBSELINUX
- if (is_selinux_enabled()) {
+ if (is_selinux_enabled() > 0) {
security_context_t passwd_context=NULL;
int ret=0;
if (getfilecon(orig_file,&passwd_context) < 0) {