diff options
author | Ron Yorston <rmy@pobox.com> | 2017-01-04 11:32:33 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-01-04 11:41:38 +0000 |
commit | f9cf712f8a640ac2d250dfa77dd809ab033f618a (patch) | |
tree | c8f6135b5842e0110ca54d6690ab95b28792bb1e /libbb/appletlib.c | |
parent | 71ecc8033e6989996057b32577e71148fd544596 (diff) | |
parent | c6725b0af68238a456690146adec763c04f66c82 (diff) | |
download | busybox-w32-f9cf712f8a640ac2d250dfa77dd809ab033f618a.tar.gz busybox-w32-f9cf712f8a640ac2d250dfa77dd809ab033f618a.tar.bz2 busybox-w32-f9cf712f8a640ac2d250dfa77dd809ab033f618a.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 1fe0eb44f..f11384962 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -334,21 +334,6 @@ static struct suid_config_t { | |||
334 | 334 | ||
335 | static bool suid_cfg_readable; | 335 | static bool suid_cfg_readable; |
336 | 336 | ||
337 | /* check if u is member of group g */ | ||
338 | static int ingroup(uid_t u, gid_t g) | ||
339 | { | ||
340 | struct group *grp = getgrgid(g); | ||
341 | if (grp) { | ||
342 | char **mem; | ||
343 | for (mem = grp->gr_mem; *mem; mem++) { | ||
344 | struct passwd *pwd = getpwnam(*mem); | ||
345 | if (pwd && (pwd->pw_uid == u)) | ||
346 | return 1; | ||
347 | } | ||
348 | } | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | /* libbb candidate */ | 337 | /* libbb candidate */ |
353 | static char *get_trimmed_slice(char *s, char *e) | 338 | static char *get_trimmed_slice(char *s, char *e) |
354 | { | 339 | { |
@@ -573,7 +558,24 @@ static inline void parse_config_file(void) | |||
573 | # endif /* FEATURE_SUID_CONFIG */ | 558 | # endif /* FEATURE_SUID_CONFIG */ |
574 | 559 | ||
575 | 560 | ||
576 | # if ENABLE_FEATURE_SUID | 561 | # if ENABLE_FEATURE_SUID && NUM_APPLETS > 0 |
562 | # if ENABLE_FEATURE_SUID_CONFIG | ||
563 | /* check if u is member of group g */ | ||
564 | static int ingroup(uid_t u, gid_t g) | ||
565 | { | ||
566 | struct group *grp = getgrgid(g); | ||
567 | if (grp) { | ||
568 | char **mem; | ||
569 | for (mem = grp->gr_mem; *mem; mem++) { | ||
570 | struct passwd *pwd = getpwnam(*mem); | ||
571 | if (pwd && (pwd->pw_uid == u)) | ||
572 | return 1; | ||
573 | } | ||
574 | } | ||
575 | return 0; | ||
576 | } | ||
577 | # endif | ||
578 | |||
577 | static void check_suid(int applet_no) | 579 | static void check_suid(int applet_no) |
578 | { | 580 | { |
579 | gid_t rgid; /* real gid */ | 581 | gid_t rgid; /* real gid */ |