Skip to contentSkip to conversation

libselinux/selinux_restorecon: Skip customized files also without -v

PATCH In review Petr Lautrbach 2 participants 3 messages Feb 6, 2019 – Feb 10, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux/selinux_restorecon: Skip customized files also without -v

In the original code, customizable file contexts were not changed only if -v was used. It lead to different behavior when selinux_restorecon was run with -v and without it.

Based on an initial patch by Jan Zarsky <[email protected]>

---
 libselinux/src/selinux_restorecon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/selinux_restorecon.c +1 -1
index 42a48f5a..0f0fd6ca 100644
@@ -672,8 +672,8 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
 				selinux_log(SELINUX_INFO,
 				 "%s not reset as customized by admin to %s\n",
 							    pathname, curcon);
-				goto out;
 			}
+			goto out;
 		}
 
 		if (!flags->set_specctx && curcon) {
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Petr Lautrbach

In the original code, customizable file contexts were not changed only if -v was used. It lead to different behavior when selinux_restorecon was run with -v and without it.

Based on an initial patch by Jan Zarsky <[email protected]>

Quoted 21 lines
---
 libselinux/src/selinux_restorecon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/selinux_restorecon.c +1 -2
index 42a48f5a..0f0fd6ca 100644
@@ -672,8 +672,8 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
                                selinux_log(SELINUX_INFO,
                                 "%s not reset as customized by admin to %s\n",
                                                            pathname, curcon);
-                               goto out;
                        }
+                       goto out;
                }
 
                if (!flags->set_specctx && curcon) {
--

2.20.1

#2 lore raw
Quoted 7 lines · Nicolas Iooss
Quoted 5 lines · Petr Lautrbach

In the original code, customizable file contexts were not changed only if -v was used. It lead to different behavior when selinux_restorecon was run with -v and without it.

Quoted 5 lines
Quoted 3 lines

Based on an initial patch by Jan Zarsky <[email protected]>

Merged.

Nicolas

Quoted 21 lines
Quoted 21 lines
---
 libselinux/src/selinux_restorecon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/selinux_restorecon.c +1 -2
index 42a48f5a..0f0fd6ca 100644
@@ -672,8 +672,8 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
                                selinux_log(SELINUX_INFO,
                                 "%s not reset as customized by admin to %s\n",
                                                            pathname, curcon);
-                               goto out;
                        }
+                       goto out;
                }
 
                if (!flags->set_specctx && curcon) {
--

2.20.1