summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2011-05-16 13:53:19 +0200
committerDenys Vlasenko2011-05-16 13:53:19 +0200
commitd83aff1aeddeb617f4cd3303bee220306005d0af (patch)
treef0f8129a77bef1ecd4711b23cb6d38d05618472b /libbb
parent3770b6b06168d9971b3583924a6ddf01b28c8745 (diff)
downloadbusybox-d83aff1aeddeb617f4cd3303bee220306005d0af.zip
busybox-d83aff1aeddeb617f4cd3303bee220306005d0af.tar.gz
busybox.conf: USER.GROUP is _optional_
function old new delta main 785 809 +24 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index ed60a1a..86b5cd3 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -261,9 +261,7 @@ static int ingroup(uid_t u, gid_t g)
return 0;
}
-/* This should probably be a libbb routine. In that case,
- * I'd probably rename it to something like bb_trimmed_slice.
- */
+/* libbb candidate */
static char *get_trimmed_slice(char *s, char *e)
{
/* First, consider the value at e to be nul and back up until we
@@ -442,15 +440,16 @@ static void parse_config_file(void)
/* Now get the user/group info. */
s = skip_whitespace(e);
+ if (*s == '\0')
+ s = strcpy(buffer, "0.0");
- /* Note: we require whitespace between the mode and the
- * user/group info. */
+ /* We require whitespace between mode and USER.GROUP */
if ((s == e) || !(e = strchr(s, '.'))) {
errmsg = "uid.gid";
goto pe_label;
}
- *e = ':'; /* get_uidgid doesn't understand user.group */
+ *e = ':'; /* get_uidgid needs USER:GROUP syntax */
if (get_uidgid(&sct->m_ugid, s, /*allow_numeric:*/ 1) == 0) {
errmsg = "unknown user/group";
goto pe_label;
@@ -518,7 +517,7 @@ static void check_suid(int applet_no)
/* same group / in group */
m >>= 3;
if (!(m & S_IXOTH)) /* is x bit not set? */
- bb_error_msg_and_die("you have no permission to run this applet!");
+ bb_error_msg_and_die("you have no permission to run this applet");
/* We set effective AND saved ids. If saved-id is not set
* like we do below, seteuid(0) can still later succeed! */