aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-01-04 11:32:33 +0000
committerRon Yorston <rmy@pobox.com>2017-01-04 11:41:38 +0000
commitf9cf712f8a640ac2d250dfa77dd809ab033f618a (patch)
treec8f6135b5842e0110ca54d6690ab95b28792bb1e /libbb/appletlib.c
parent71ecc8033e6989996057b32577e71148fd544596 (diff)
parentc6725b0af68238a456690146adec763c04f66c82 (diff)
downloadbusybox-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.c34
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
335static bool suid_cfg_readable; 335static bool suid_cfg_readable;
336 336
337/* check if u is member of group g */
338static 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 */
353static char *get_trimmed_slice(char *s, char *e) 338static 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 */
564static 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
577static void check_suid(int applet_no) 579static void check_suid(int applet_no)
578{ 580{
579 gid_t rgid; /* real gid */ 581 gid_t rgid; /* real gid */