diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-24 11:55:30 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-03-24 12:43:15 +0000 |
commit | 355a7a6c1e9626b7afe8758a6095f3cf275c52e1 (patch) | |
tree | 6dab679c15b049cab97212e0b43077132eec1fbe /libbb/update_passwd.c | |
parent | 71ecc8033e6989996057b32577e71148fd544596 (diff) | |
parent | 889425812b5cda8b3394d73253cbde7355fb1115 (diff) | |
download | busybox-w32-w32_1_26_2.tar.gz busybox-w32-w32_1_26_2.tar.bz2 busybox-w32-w32_1_26_2.zip |
Merge tag '1_26_2' into w32_1_26_2w32_1_26_2
Diffstat (limited to 'libbb/update_passwd.c')
-rw-r--r-- | libbb/update_passwd.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libbb/update_passwd.c b/libbb/update_passwd.c index a2004f480..95423d19b 100644 --- a/libbb/update_passwd.c +++ b/libbb/update_passwd.c | |||
@@ -30,7 +30,18 @@ static void check_selinux_update_passwd(const char *username) | |||
30 | if (!seuser) | 30 | if (!seuser) |
31 | bb_error_msg_and_die("invalid context '%s'", context); | 31 | bb_error_msg_and_die("invalid context '%s'", context); |
32 | if (strcmp(seuser, username) != 0) { | 32 | if (strcmp(seuser, username) != 0) { |
33 | if (checkPasswdAccess(PASSWD__PASSWD) != 0) | 33 | security_class_t tclass; |
34 | access_vector_t av; | ||
35 | |||
36 | tclass = string_to_security_class("passwd"); | ||
37 | if (tclass == 0) | ||
38 | goto die; | ||
39 | av = string_to_av_perm(tclass, "passwd"); | ||
40 | if (av == 0) | ||
41 | goto die; | ||
42 | |||
43 | if (selinux_check_passwd_access(av) != 0) | ||
44 | die: | ||
34 | bb_error_msg_and_die("SELinux: access denied"); | 45 | bb_error_msg_and_die("SELinux: access denied"); |
35 | } | 46 | } |
36 | if (ENABLE_FEATURE_CLEAN_UP) | 47 | if (ENABLE_FEATURE_CLEAN_UP) |
@@ -169,6 +180,7 @@ int FAST_FUNC update_passwd(const char *filename, | |||
169 | if (!line) /* EOF/error */ | 180 | if (!line) /* EOF/error */ |
170 | break; | 181 | break; |
171 | 182 | ||
183 | #if ENABLE_FEATURE_ADDUSER_TO_GROUP || ENABLE_FEATURE_DEL_USER_FROM_GROUP | ||
172 | if (!name && member) { | 184 | if (!name && member) { |
173 | /* Delete member from all groups */ | 185 | /* Delete member from all groups */ |
174 | /* line is "GROUP:PASSWD:[member1[,member2]...]" */ | 186 | /* line is "GROUP:PASSWD:[member1[,member2]...]" */ |
@@ -198,6 +210,7 @@ int FAST_FUNC update_passwd(const char *filename, | |||
198 | fprintf(new_fp, "%s\n", line); | 210 | fprintf(new_fp, "%s\n", line); |
199 | goto next; | 211 | goto next; |
200 | } | 212 | } |
213 | #endif | ||
201 | 214 | ||
202 | cp = is_prefixed_with(line, name_colon); | 215 | cp = is_prefixed_with(line, name_colon); |
203 | if (!cp) { | 216 | if (!cp) { |