Merge common pieces of code

Refactoring repeated pieces of code by moving it to internal functions. Merged pieces of the following function pairs:
- `apply_rules()` and `apply_cipso()`
- `smack_accesses_add()` and `smack_accesses_add_modify()`
- `smack_accesses_apply()` and `smack_accesses_save()`

Three patches makes the code shorter by 128 lines total. More importantly modifications to these parts will have to be done in single place, which should improve maintainability.