utils: apply access rules to load/load2 in one shot

Open load/load2 only once. Inside the callback only collect rules
using smack_accessed_add_from_file(). Finally, apply access rules
in a single slot.

This was inspired by feedback from Rafal Krypa <r.krypa@samsung.com>.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
utils: common.c: invalid fprintf()

fprintf() has path parameter that was not utilized.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Merge branch 'v1.0.x'
libsmack: add support for new access mode for setting locks ("l")

This change should be backward compatible for kernels without l-mode support
as long as requested permissions don't contain this mode.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Merge branch 'v1.0.x'
libsmack: clean up redundant stuff

Cleaned up redundant constants and code. Grouped related constants
nearby each other.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack: clean up redundant stuff

Cleaned up redundant constants and code. Grouped related constants
nearby each other.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
(cherry picked from commit d6f8c52011013f536b7171c2d1f3e9c5ecfaf2f9)
utils: use common code for apply_rules and apply_cipso

Code for apply_rules() has been rewritten to use opendir() and readdir(),
but apply_cipso() remained implemented with nftw().
This patch implements both applying functions with opendir() and readdir()
using a common internal function apply_dir().
The resulting code is 45 lines shorter and keeps directory traversal logic
in single place.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Merge branch 'v1.0.x'