utils: use common code for apply_rules and apply_cipso
authorRafal Krypa <r.krypa@samsung.com>
Tue, 31 Dec 2013 20:11:35 +0000 (21:11 +0100)
committerRafal Krypa <r.krypa@samsung.com>
Tue, 31 Dec 2013 20:51:56 +0000 (21:51 +0100)
commit9fbf62c5caad1b30764a87979bad3fa95454d821
tree22e851894b2e98db15c27735a9741ee13345eb45
parentb5cf5ed8a575b848e4c767f803869e076d5782dc
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_path(). The common function can
handle both directory and single file,  so apply_rules_file() and
apply_cipso_file() are dropped.
The resulting code is 69 lines shorter and keeps directory traversal logic
in single place. It's side effect is applying CIPSO rules in one shot, just
like regular Smack rules.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
utils/common.c
utils/common.h
utils/smackcipso.c
utils/smackload.c