Mount sys before trying to mount selinuxfs

If /sys is not present, the attempt to mount selinuxfs will of course
fail. So we try to mount /sys first (and only if that fails fall back to
the /selinux mount point) and then try to mount selinuxfs.

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Update pkgconfig definition

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Make RANLIB variable overridable

If the RANLIB variable is defined by the user, use that value instead of
the /usr/bin/ranlib binary.

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Support udev-197 and higher

The errno value was not set, causing wrong return notifications and
failing to have udev label things correctly.

See https://bugzilla.redhat.com/show_bug.cgi?id=909826#c24 and
see https://bugs.gentoo.org/show_bug.cgi?id=462626

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Current stable policycoreutils requires selinux_current_policy_path

Without this fix, stolen from Fedora's patchset, recent policycoreutils
just fails.

See http://marc.info/?t=136926404600001&r=1&w=2 and
see http://marc.info/?l=selinux&m=136692033821285&w=2

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Support user-provided RANLIB

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
Policycoreutils: Allow overriding INITDIR in restorecond Makefile
policycoreutils: Create correct man directory for run_init manpages
policycoreutils: Allow overriding CFLAGS in setfiles and sestatus Makefiles

This is required to be able to pass hardening flags in Debian.
checkpolicy: Allow overriding LIBDIR in test/Makefile
libsepol: Allow overriding LIBBASE in src/Makefile
libsemanage: Also check for the uppoer bound on user ids in login.defs

Some non-Debian packages (like qmail, shudder) create
users not below MIN_UID, but above MAX_UID, in /etc/login.defs
(non-system users are supposed to have uids between MIN_UID and
MAX_UID.

genhomedircon.c:gethomedirs() checks pwent.pw_uid against MIN_UID in
/etc/login.defs to exclude system users from generating homedir
contexts. But unfortunately it does not check it against MAX_UID
setting from the same file. This gets us lines like the following in
the contexts/files/file_contexts.homedirs file:
,----
| #
| # Home Context for user user_u
| #
| /var/qmail/[^/]*/.+ user_u:object_r:user_home_t:s0
| /var/qmail/[^/]*/\.ssh(/.*)? user_u:object_r:user_home_ssh_t:s0
| /var/qmail/[^/]*/\.gnupg(/.+)? user_u:object_r:user_gpg_secret_t:s0
| /var/qmail/[^/]* -d user_u:object_r:user_home_dir_t:s0
| /var/qmail/lost\+found/.* <<none>>
| /var/qmail -d system_u:object_r:home_root_t:s0
| /var/qmail/\.journal <<none>>
| /var/qmail/lost\+found -d system_u:object_r:lost_found_t:s0
| /tmp/gconfd-.* -d user_u:object_r:user_tmp_t:s0
`----
This commit adds checking uid value againt MAX_UID too.
libselinux: Allow overriding LIBBASE in src/Makefile
libselinux: Do not use LDFLAGS to set -lpcre and -lpthread

This is breaking build if LDFLAGS is redefined.

This is the case on Debian where hardening flags are passed
automatically by the build system.
libselinux: Fix various minor manpage issues and correct section numbering.
checkpolicy: Fix cases where hyphen were used as minus sign in manpages
libsemanage: Fix cases where hyphen were used as minus sign in manpages
libsepol: Fix cases where hyphen were used as minus sign in manpages
policycoreutils: Fix cases where hyphen were used as minus sign in manpages

And also other minor formating issues
policycoreutils: Fix semange alternative logging code

Fix semanage logging code when python-audit is not installed