Просмотр исходного кода

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 лет назад: 11
Родитель
Сommit
2600dd55f2
2 измененных файлов с 1 добавлено и 4 удалено
  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
     Closes: #720761
   * Fix setting the SE Linux context when a file has a statoverride.
   * Fix setting the SE Linux context when a file has a statoverride.
     Closes: #786435
     Closes: #786435
+  * Set the SE Linux file context even when the file mode has no file type.
   * Perl modules:
   * Perl modules:
     - Add missing strict and warnings pragmas for submodules.
     - Add missing strict and warnings pragmas for submodules.
     - Use non-destructive substitutions inside map.
     - 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;
 	security_context_t scontext = NULL;
 	int ret;
 	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. */
 	/* If SELinux is not enabled just do nothing. */
 	sehandle = dpkg_selabel_get_handle();
 	sehandle = dpkg_selabel_get_handle();
 	if (sehandle == NULL)
 	if (sehandle == NULL)