aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-05-16 13:53:19 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-16 13:53:19 +0200
commitd83aff1aeddeb617f4cd3303bee220306005d0af (patch)
treef0f8129a77bef1ecd4711b23cb6d38d05618472b /libbb/appletlib.c
parent3770b6b06168d9971b3583924a6ddf01b28c8745 (diff)
downloadbusybox-w32-d83aff1aeddeb617f4cd3303bee220306005d0af.tar.gz
busybox-w32-d83aff1aeddeb617f4cd3303bee220306005d0af.tar.bz2
busybox-w32-d83aff1aeddeb617f4cd3303bee220306005d0af.zip
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/appletlib.c')
-rw-r--r--libbb/appletlib.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index ed60a1a0a..86b5cd381 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -261,9 +261,7 @@ static int ingroup(uid_t u, gid_t g)
261 return 0; 261 return 0;
262} 262}
263 263
264/* This should probably be a libbb routine. In that case, 264/* libbb candidate */
265 * I'd probably rename it to something like bb_trimmed_slice.
266 */
267static char *get_trimmed_slice(char *s, char *e) 265static char *get_trimmed_slice(char *s, char *e)
268{ 266{
269 /* First, consider the value at e to be nul and back up until we 267 /* First, consider the value at e to be nul and back up until we
@@ -442,15 +440,16 @@ static void parse_config_file(void)
442 /* Now get the user/group info. */ 440 /* Now get the user/group info. */
443 441
444 s = skip_whitespace(e); 442 s = skip_whitespace(e);
443 if (*s == '\0')
444 s = strcpy(buffer, "0.0");
445 445
446 /* Note: we require whitespace between the mode and the 446 /* We require whitespace between mode and USER.GROUP */
447 * user/group info. */
448 if ((s == e) || !(e = strchr(s, '.'))) { 447 if ((s == e) || !(e = strchr(s, '.'))) {
449 errmsg = "uid.gid"; 448 errmsg = "uid.gid";
450 goto pe_label; 449 goto pe_label;
451 } 450 }
452 451
453 *e = ':'; /* get_uidgid doesn't understand user.group */ 452 *e = ':'; /* get_uidgid needs USER:GROUP syntax */
454 if (get_uidgid(&sct->m_ugid, s, /*allow_numeric:*/ 1) == 0) { 453 if (get_uidgid(&sct->m_ugid, s, /*allow_numeric:*/ 1) == 0) {
455 errmsg = "unknown user/group"; 454 errmsg = "unknown user/group";
456 goto pe_label; 455 goto pe_label;
@@ -518,7 +517,7 @@ static void check_suid(int applet_no)
518 /* same group / in group */ 517 /* same group / in group */
519 m >>= 3; 518 m >>= 3;
520 if (!(m & S_IXOTH)) /* is x bit not set? */ 519 if (!(m & S_IXOTH)) /* is x bit not set? */
521 bb_error_msg_and_die("you have no permission to run this applet!"); 520 bb_error_msg_and_die("you have no permission to run this applet");
522 521
523 /* We set effective AND saved ids. If saved-id is not set 522 /* We set effective AND saved ids. If saved-id is not set
524 * like we do below, seteuid(0) can still later succeed! */ 523 * like we do below, seteuid(0) can still later succeed! */