History log of /external/selinux/libselinux/utils/selabel_digest.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e4f2bcce24181131014dc18d3f948e7e2a65d6cc 01-Nov-2016 William Roberts <william.c.roberts@intel.com> libselinux/utils: fix all the noreturn errors

When building with clang, multiple noreturn issues arise,
for instance:

selabel_partial_match.c:11:1: error: function 'usage' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]

Fix these.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
/external/selinux/libselinux/utils/selabel_digest.c
6dd85b9e0e1d0e875263cc8cba3e3d4383974700 29-Sep-2016 Janis Danisevskis <jdanis@android.com> libselinux: android: fix lax service context lookup

We use the same lookup function for service contexts
that we use for property contexts. However, property
contexts are namespace based and only compare the
prefix. This may lead to service associations with
a wrong label.

This patch introduces a new back end for android
services with a stricter lookup function. Now the
service name must match the key of the service label
exactly.

Signed-off-by: Janis Danisevskis <jdanis@android.com>
/external/selinux/libselinux/utils/selabel_digest.c
8647a6c6214be2e6b87526c5755480b5bb3452fd 25-Sep-2016 Nicolas Iooss <nicolas.iooss@m4x.org> libselinux: silent -Wsign-compare warnings

When building libselinux with gcc and many warning flags, the build
fails with the following errors:

selinux_restorecon.c: In function ‘selinux_restorecon’:
selinux_restorecon.c:784:36: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]
if (!flags.ignore_digest && size == fc_digest_len &&
^~

selabel_digest.c: In function ‘main’:
selabel_digest.c:162:16: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]
for (i = 0; i < digest_len; i++)
^
selabel_digest.c:173:17: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]
for (i = 0; i < num_specfiles; i++) {
^

clang reports the precise type information of the variables:

selinux_restorecon.c:784:36: error: comparison of integers of
different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned
long') [-Werror,-Wsign-compare]
if (!flags.ignore_digest && size == fc_digest_len &&
~~~~ ^ ~~~~~~~~~~~~~

selabel_digest.c:162:16: error: comparison of integers of different
signs: 'int' and 'size_t' (aka 'unsigned long')
[-Werror,-Wsign-compare]
for (i = 0; i < digest_len; i++)
~ ^ ~~~~~~~~~~
selabel_digest.c:173:17: error: comparison of integers of different
signs: 'int' and 'size_t' (aka 'unsigned long')
[-Werror,-Wsign-compare]
for (i = 0; i < num_specfiles; i++) {
~ ^ ~~~~~~~~~~~~~

Silent the warnings by using size_t where appropriate.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
/external/selinux/libselinux/utils/selabel_digest.c
e0456053d045997fa072565eb9b2c95ce9c9724a 15-Oct-2015 Richard Haines <richard_c_haines@btinternet.com> libselinux: Fix selabel_open(3) services if no digest requested

If selabel_open is called with no request for a digest it will fail
with ENOENT. This fixes all the labeling routines to resolve this
problem. The utils/selabel_digest example has also been updated
to allow calling selabel_open with and without digest requests to
aid testing.

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
/external/selinux/libselinux/utils/selabel_digest.c
e40bbea95f555fe9708cbbc39895bd67a8ac6c48 30-Sep-2015 Richard Haines <richard_c_haines@btinternet.com> libselinux: Add selabel_digest function

selabel_digest(3) if enabled by the SELABEL_OPT_DIGEST option during
selabel_open(3) will return an SHA1 digest of the spec files, plus
a list of the specfiles used to calculate the digest. There is a
test utility supplied that will demonstrate the functionality.

The use case for selabel_digest(3) is to implement an selinux_restorecon
function based on the Android version that writes a hash of the
file_contexts files to an extended attribute to enhance performance
(see external/libselinux/src/android.c selinux_android_restorecon()).

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
/external/selinux/libselinux/utils/selabel_digest.c