Explorar el Código

dpkg: Set the SE Linux file context even without a file type in mode

If the mode does not have a file type, for whatever reason, the
libselinux labelling code will try to match on the pathname, which
is better than no labelling at all.

This should never happen in practice, but it is a safer assumption
and more future proof.
Guillem Jover hace 11 años
padre
commit
2600dd55f2
Se han modificado 2 ficheros con 1 adiciones y 4 borrados
  1. 1 0
      debian/changelog
  2. 0 4
      src/selinux.c

+ 1 - 0
debian/changelog

@@ -7,6 +7,7 @@ dpkg (1.18.1) UNRELEASED; urgency=low
     Closes: #720761
   * Fix setting the SE Linux context when a file has a statoverride.
     Closes: #786435
+  * Set the SE Linux file context even when the file mode has no file type.
   * Perl modules:
     - Add missing strict and warnings pragmas for submodules.
     - Use non-destructive substitutions inside map.

+ 0 - 4
src/selinux.c

@@ -95,10 +95,6 @@ dpkg_selabel_set_context(const char *matchpath, const char *path, mode_t mode)
 	security_context_t scontext = NULL;
 	int ret;
 
-	/* If there's no file type, just give up. */
-	if ((mode & S_IFMT) == 0)
-		return;
-
 	/* If SELinux is not enabled just do nothing. */
 	sehandle = dpkg_selabel_get_handle();
 	if (sehandle == NULL)