2018-02-06 10:33:37 +00:00
|
|
|
Index: shadow-4.5/lib/selinux.c
|
|
|
|
===================================================================
|
|
|
|
--- shadow-4.5.orig/lib/selinux.c
|
|
|
|
+++ shadow-4.5/lib/selinux.c
|
2017-11-02 10:50:59 +00:00
|
|
|
@@ -75,7 +75,7 @@ int set_selinux_file_context (const char
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
error:
|
|
|
|
- if (security_getenforce () != 0) {
|
|
|
|
+ if (security_getenforce () > 0) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
@@ -95,7 +95,7 @@ int reset_selinux_file_context (void)
|
|
|
|
selinux_checked = true;
|
|
|
|
}
|
|
|
|
if (selinux_enabled) {
|
|
|
|
- if (setfscreatecon (NULL) != 0) {
|
|
|
|
+ if (setfscreatecon (NULL) != 0 && security_getenforce () > 0) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
2018-02-06 10:33:37 +00:00
|
|
|
Index: shadow-4.5/src/userdel.c
|
|
|
|
===================================================================
|
|
|
|
--- shadow-4.5.orig/src/userdel.c
|
|
|
|
+++ shadow-4.5/src/userdel.c
|
2017-11-02 10:50:59 +00:00
|
|
|
@@ -96,6 +96,7 @@ static char *user_home;
|
|
|
|
static bool fflg = false;
|
|
|
|
static bool rflg = false;
|
|
|
|
static bool Zflg = false;
|
|
|
|
+static bool Rflg = false;
|
|
|
|
|
|
|
|
static bool is_shadow_pwd;
|
|
|
|
|
|
|
|
@@ -958,6 +959,7 @@ int main (int argc, char **argv)
|
|
|
|
rflg = true;
|
|
|
|
break;
|
|
|
|
case 'R': /* no-op, handled in process_root_flag () */
|
|
|
|
+ Rflg = true;
|
|
|
|
break;
|
|
|
|
#ifdef WITH_SELINUX
|
|
|
|
case 'Z':
|
2017-11-06 14:31:26 +00:00
|
|
|
@@ -1032,9 +1034,12 @@ int main (int argc, char **argv)
|
2017-11-02 10:50:59 +00:00
|
|
|
*/
|
|
|
|
user_name = argv[argc - 1];
|
|
|
|
{
|
|
|
|
- struct passwd *pwd;
|
|
|
|
- pwd = getpwnam (user_name); /* local, no need for xgetpwnam */
|
|
|
|
+ const struct passwd *pwd;
|
2017-11-06 14:31:26 +00:00
|
|
|
+
|
|
|
|
+ pw_open(O_RDONLY);
|
2017-11-02 10:50:59 +00:00
|
|
|
+ pwd = pw_locate (user_name); /* we care only about local users */
|
|
|
|
if (NULL == pwd) {
|
2017-11-06 14:31:26 +00:00
|
|
|
+ pw_close();
|
2017-11-02 10:50:59 +00:00
|
|
|
fprintf (stderr, _("%s: user '%s' does not exist\n"),
|
|
|
|
Prog, user_name);
|
2017-11-06 14:31:26 +00:00
|
|
|
#ifdef WITH_AUDIT
|
|
|
|
@@ -1048,6 +1053,7 @@ int main (int argc, char **argv)
|
2017-11-02 10:50:59 +00:00
|
|
|
user_id = pwd->pw_uid;
|
|
|
|
user_gid = pwd->pw_gid;
|
2017-11-06 14:31:26 +00:00
|
|
|
user_home = xstrdup (pwd->pw_dir);
|
|
|
|
+ pw_close();
|
2017-11-02 10:50:59 +00:00
|
|
|
}
|
|
|
|
#ifdef WITH_TCB
|
|
|
|
if (shadowtcb_set_user (user_name) == SHADOWTCB_FAILURE) {
|
2017-11-06 14:31:26 +00:00
|
|
|
@@ -1079,7 +1085,7 @@ int main (int argc, char **argv)
|
2017-11-02 10:50:59 +00:00
|
|
|
* Note: This is a best effort basis. The user may log in between,
|
|
|
|
* a cron job may be started on her behalf, etc.
|
|
|
|
*/
|
|
|
|
- if (user_busy (user_name, user_id) != 0) {
|
|
|
|
+ if (!Rflg && user_busy (user_name, user_id) != 0) {
|
|
|
|
if (!fflg) {
|
|
|
|
#ifdef WITH_AUDIT
|
|
|
|
audit_logger (AUDIT_DEL_USER, Prog,
|