* NEWS, src/useradd.c, man/useradd.8.xml: add -Z option to map

SELinux user for user's login.
	* NEWS, src/usermod.c, man/usermod.8.xml: Likewise.
	* libmisc/system.c, libmisc/Makefile.am, lib/prototypes.h: Added
	safe_system(). Used to run semanage.
	* lib/prototypes.h, libmisc/copydir.c: Make a
	selinux_file_context() an extern function.
	* libmisc/copydir.c: Reset SELinux to create files with default
	contexts at the end of copy_tree().
	* NEWS, src/userdel.c: Delete the SELinux user mapping for user's
	login.
This commit is contained in:
nekral-guest
2009-04-11 15:34:10 +00:00
parent 2c400eff94
commit 8d136297c4
12 changed files with 285 additions and 3 deletions

View File

@@ -83,8 +83,11 @@ static int copy_file (const char *src, const char *dst,
* selinux_file_context () should be called before any creation of file,
* symlink, directory, ...
*
* Callers may have to Reset SELinux to create files with default
* contexts:
* setfscreatecon (NULL);
*/
static int selinux_file_context (const char *dst_name)
int selinux_file_context (const char *dst_name)
{
static bool selinux_checked = false;
static bool selinux_enabled;
@@ -259,6 +262,12 @@ int copy_tree (const char *src_root, const char *dst_root,
src_orig = NULL;
dst_orig = NULL;
}
#ifdef WITH_SELINUX
/* Reset SELinux to create files with default contexts */
setfscreatecon (NULL);
#endif
return err;
}