Bug 1402140

Summary: getsebool prints Success when boolean names are not accessible
Product: Red Hat Enterprise Linux 7 Reporter: Milos Malik <mmalik>
Component: libselinuxAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: low    
Version: 7.3CC: dwalsh, lvrabec, mgrepl, mmalik, plautrba, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libselinux-2.5-10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 17:43:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Milos Malik 2016-12-06 21:24:59 UTC
Description of problem:

Version-Release number of selected component (if applicable):
libselinux-utils-2.5-6.el7.x86_64

How reproducible:
* always

Steps to Reproduce:
# mkdir booleans
# mount --bind ./booleans /sys/fs/selinux/booleans
# getsebool -a
getsebool:  Unable to get boolean names:  Success
#

Expected results:
getsebool:  Unable to get boolean names

Comment 1 Petr Lautrbach 2017-03-06 12:26:09 UTC
--- a/libselinux/src/booleans.c
+++ b/libselinux/src/booleans.c
@@ -53,6 +53,7 @@ int security_get_boolean_names(char ***names, int *len)
        snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
        *len = scandir(path, &namelist, &filename_select, alphasort);
        if (*len <= 0) {
+               errno = ENOENT;
                return -1;
        }

Comment 5 errata-xmlrpc 2017-08-01 17:43:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1853