summaryrefslogtreecommitdiffhomepage
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-12-23 02:42:26 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-12-23 02:42:26 +0100
commit9cc3d3ab21eb8b4766b71dffb04132184c754f7b (patch)
tree11ebefbc2a008c9479110177d97c346893ba4d82 /libbb
parent7c5dea399b16341ead146cb86eb4f6cde031a12d (diff)
fix breakage found by mass one-applet builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild.src1
-rw-r--r--libbb/appletlib.c32
-rw-r--r--libbb/update_passwd.c2
3 files changed, 19 insertions, 16 deletions
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index e426f3c7e..898a51a89 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -176,6 +176,7 @@ lib-$(CONFIG_TRACEROUTE6) += inet_cksum.o
lib-$(CONFIG_UDHCPC) += inet_cksum.o
lib-$(CONFIG_UDHCPC6) += inet_cksum.o
lib-$(CONFIG_UDHCPD) += inet_cksum.o
+lib-$(CONFIG_DHCPRELAY) += inet_cksum.o
# We shouldn't build xregcomp.c if we don't need it - this ensures we don't
# require regex.h to be in the include dir even if we don't need it thereby
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 9425c7bd4..ee8b4ec14 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -329,21 +329,6 @@ static struct suid_config_t {
static bool suid_cfg_readable;
-/* check if u is member of group g */
-static int ingroup(uid_t u, gid_t g)
-{
- struct group *grp = getgrgid(g);
- if (grp) {
- char **mem;
- for (mem = grp->gr_mem; *mem; mem++) {
- struct passwd *pwd = getpwnam(*mem);
- if (pwd && (pwd->pw_uid == u))
- return 1;
- }
- }
- return 0;
-}
-
/* libbb candidate */
static char *get_trimmed_slice(char *s, char *e)
{
@@ -568,7 +553,22 @@ static inline void parse_config_file(void)
# endif /* FEATURE_SUID_CONFIG */
-# if ENABLE_FEATURE_SUID
+# if ENABLE_FEATURE_SUID && NUM_APPLETS > 0
+/* check if u is member of group g */
+static int ingroup(uid_t u, gid_t g)
+{
+ struct group *grp = getgrgid(g);
+ if (grp) {
+ char **mem;
+ for (mem = grp->gr_mem; *mem; mem++) {
+ struct passwd *pwd = getpwnam(*mem);
+ if (pwd && (pwd->pw_uid == u))
+ return 1;
+ }
+ }
+ return 0;
+}
+
static void check_suid(int applet_no)
{
gid_t rgid; /* real gid */
diff --git a/libbb/update_passwd.c b/libbb/update_passwd.c
index 6255af492..95423d19b 100644
--- a/libbb/update_passwd.c
+++ b/libbb/update_passwd.c
@@ -180,6 +180,7 @@ int FAST_FUNC update_passwd(const char *filename,
if (!line) /* EOF/error */
break;
+#if ENABLE_FEATURE_ADDUSER_TO_GROUP || ENABLE_FEATURE_DEL_USER_FROM_GROUP
if (!name && member) {
/* Delete member from all groups */
/* line is "GROUP:PASSWD:[member1[,member2]...]" */
@@ -209,6 +210,7 @@ int FAST_FUNC update_passwd(const char *filename,
fprintf(new_fp, "%s\n", line);
goto next;
}
+#endif
cp = is_prefixed_with(line, name_colon);
if (!cp) {