Skip to content

Commit 9d107ab

Browse files
committed
libsemanage: Set new restorecon handle before doing restorecon
In semanage_setfiles(), need to reset the restorecon handle to make sure restorecon is not operating on old selabel data. This fixes commit d96f27b ("libsemanage: Preserve file context and ownership in policy store") which could cause restorecon to use old data. Reported-by: Petr Lautrbach <[email protected]> Signed-off-by: James Carter <[email protected]> Acked-by: Petr Lautrbach <[email protected]>
1 parent 45fdf23 commit 9d107ab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libsemanage/src/semanage_store.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,9 +3012,14 @@ log_callback_mute(__attribute__((unused)) int type, __attribute__((unused)) cons
30123012
void semanage_setfiles(semanage_handle_t * sh, const char *path){
30133013
struct stat sb;
30143014
int fd;
3015+
struct selabel_handle *sehandle;
3016+
30153017
union selinux_callback cb_orig = selinux_get_callback(SELINUX_CB_LOG);
30163018
union selinux_callback cb = { .func_log = log_callback_mute };
30173019

3020+
sehandle = selinux_restorecon_default_handle();
3021+
selinux_restorecon_set_sehandle(sehandle);
3022+
30183023
/* Mute all logs */
30193024
selinux_set_callback(SELINUX_CB_LOG, cb);
30203025

0 commit comments

Comments
 (0)