aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/httpd.c8
-rw-r--r--util-linux/Config.in10
-rw-r--r--util-linux/mount.c55
3 files changed, 57 insertions, 16 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index a888c2424..a8e5df98c 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2089,7 +2089,13 @@ int httpd_main(int argc, char **argv)
2089#endif 2089#endif
2090 } 2090 }
2091 2091
2092#if ENABLE_FEATURE_HTTPD_CGI 2092#if 0 /*was #if ENABLE_FEATURE_HTTPD_CGI*/
2093 /* User can do it himself: 'env - PATH="$PATH" httpd'
2094 * We don't do it because we don't want to screw users
2095 * which want to do
2096 * 'env - VAR1=val1 VAR2=val2 https'
2097 * and have VAR1 and VAR2 values visible in their CGIs.
2098 * Besides, it is also smaller. */
2093 { 2099 {
2094 char *p = getenv("PATH"); 2100 char *p = getenv("PATH");
2095 /* env strings themself are not freed, no need to strdup(p): */ 2101 /* env strings themself are not freed, no need to strdup(p): */
diff --git a/util-linux/Config.in b/util-linux/Config.in
index c9108134b..107382f51 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -360,6 +360,16 @@ config MOUNT
360 NFS filesystems. Most people using BusyBox will also want to enable 360 NFS filesystems. Most people using BusyBox will also want to enable
361 the 'mount' utility. 361 the 'mount' utility.
362 362
363config FEATURE_MOUNT_HELPERS
364 bool "Support mount helpers"
365 default n
366 depends on MOUNT
367 help
368 Enable mounting of virtual file systems via external helpers.
369 E.g. mount obexfs#-b00.11.22.33.44.55 /mnt will in effect call
370 obexfs -b00.11.22.33.44.55 /mnt
371 The idea is to use such virtual filesystems in /etc/fstab
372
363config FEATURE_MOUNT_NFS 373config FEATURE_MOUNT_NFS
364 bool "Support mounting NFS file systems" 374 bool "Support mounting NFS file systems"
365 default n 375 default n
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 91f09e15c..d391a26e1 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -18,8 +18,8 @@
18 mount_it_now() does the actual mount. 18 mount_it_now() does the actual mount.
19*/ 19*/
20 20
21#include "libbb.h"
22#include <mntent.h> 21#include <mntent.h>
22#include "libbb.h"
23 23
24/* Needed for nfs support only... */ 24/* Needed for nfs support only... */
25#include <syslog.h> 25#include <syslog.h>
@@ -30,20 +30,23 @@
30#include <rpc/pmap_prot.h> 30#include <rpc/pmap_prot.h>
31#include <rpc/pmap_clnt.h> 31#include <rpc/pmap_clnt.h>
32 32
33#ifndef MS_SILENT
34#define MS_SILENT (1 << 15)
35#endif
33 36
34#if defined(__dietlibc__) 37#if defined(__dietlibc__)
35/* 16.12.2006, Sampo Kellomaki (sampo@iki.fi) 38/* 16.12.2006, Sampo Kellomaki (sampo@iki.fi)
36 * dietlibc-0.30 does not have implementation of getmntent_r() */ 39 * dietlibc-0.30 does not have implementation of getmntent_r() */
37/* OTOH: why we use getmntent_r instead of getmntent? TODO... */
38struct mntent *getmntent_r(FILE* stream, struct mntent* result, char* buffer, int bufsize) 40struct mntent *getmntent_r(FILE* stream, struct mntent* result, char* buffer, int bufsize)
39{ 41{
40 /* *** XXX FIXME WARNING: This hack is NOT thread safe. --Sampo */
41 struct mntent* ment = getmntent(stream); 42 struct mntent* ment = getmntent(stream);
42 memcpy(result, ment, sizeof(struct mntent)); 43 memcpy(result, ment, sizeof(struct mntent));
43 return result; 44 return result;
44} 45}
45#endif 46#endif
46 47
48#define getmntent_buf bb_common_bufsiz1
49
47 50
48// Not real flags, but we want to be able to check for this. 51// Not real flags, but we want to be able to check for this.
49enum { 52enum {
@@ -186,11 +189,11 @@ static int parse_mount_options(char *options, char **unrecognized)
186 strcpy((*unrecognized)+i, options); 189 strcpy((*unrecognized)+i, options);
187 } 190 }
188 191
189 // Advance to next option, or finish 192 if (!comma)
190 if (comma) { 193 break;
191 *comma = ','; 194 // Advance to next option
192 options = ++comma; 195 *comma = ',';
193 } else break; 196 options = ++comma;
194 } 197 }
195 198
196 return flags; 199 return flags;
@@ -262,8 +265,9 @@ static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
262 vfsflags, filteropts); 265 vfsflags, filteropts);
263 if (!rc || (vfsflags&MS_RDONLY) || (errno!=EACCES && errno!=EROFS)) 266 if (!rc || (vfsflags&MS_RDONLY) || (errno!=EACCES && errno!=EROFS))
264 break; 267 break;
265 bb_error_msg("%s is write-protected, mounting read-only", 268 if (!(vfsflags & MS_SILENT))
266 mp->mnt_fsname); 269 bb_error_msg("%s is write-protected, mounting read-only",
270 mp->mnt_fsname);
267 vfsflags |= MS_RDONLY; 271 vfsflags |= MS_RDONLY;
268 } 272 }
269 273
@@ -1399,6 +1403,27 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1399 if (mp->mnt_type && strcmp(mp->mnt_type,"auto") == 0) 1403 if (mp->mnt_type && strcmp(mp->mnt_type,"auto") == 0)
1400 mp->mnt_type = 0; 1404 mp->mnt_type = 0;
1401 1405
1406 // Might this be a virtual filesystem?
1407
1408 if (ENABLE_FEATURE_MOUNT_HELPERS
1409 && (strchr(mp->mnt_fsname,'#'))
1410 ) {
1411 char *s, *p, *args[35];
1412 int n = 0;
1413 for (s = p = mp->mnt_fsname; *s && n < 35-3; ++s) {
1414 if (s[0] == '#' && s[1] != '#') {
1415 *s = '\0';
1416 args[n++] = p;
1417 p = s + 1;
1418 }
1419 }
1420 args[n++] = p;
1421 args[n++] = mp->mnt_dir;
1422 args[n] = NULL;
1423 rc = wait4pid(xspawn(args));
1424 goto report_error;
1425 }
1426
1402 // Might this be an CIFS filesystem? 1427 // Might this be an CIFS filesystem?
1403 1428
1404 if (ENABLE_FEATURE_MOUNT_CIFS 1429 if (ENABLE_FEATURE_MOUNT_CIFS
@@ -1593,8 +1618,8 @@ int mount_main(int argc, char **argv)
1593 1618
1594 if (!mountTable) bb_error_msg_and_die("no %s", bb_path_mtab_file); 1619 if (!mountTable) bb_error_msg_and_die("no %s", bb_path_mtab_file);
1595 1620
1596 while (getmntent_r(mountTable, mtpair, bb_common_bufsiz1, 1621 while (getmntent_r(mountTable, &mtpair[0], getmntent_buf,
1597 sizeof(bb_common_bufsiz1))) 1622 sizeof(getmntent_buf)))
1598 { 1623 {
1599 // Don't show rootfs. FIXME: why?? 1624 // Don't show rootfs. FIXME: why??
1600 // util-linux 2.12a happily shows rootfs... 1625 // util-linux 2.12a happily shows rootfs...
@@ -1657,9 +1682,9 @@ int mount_main(int argc, char **argv)
1657 1682
1658 // Get next fstab entry 1683 // Get next fstab entry
1659 1684
1660 if (!getmntent_r(fstab, mtcur, bb_common_bufsiz1 1685 if (!getmntent_r(fstab, mtcur, getmntent_buf
1661 + (mtcur==mtpair ? sizeof(bb_common_bufsiz1)/2 : 0), 1686 + (mtcur==mtpair ? sizeof(getmntent_buf)/2 : 0),
1662 sizeof(bb_common_bufsiz1)/2)) 1687 sizeof(getmntent_buf)/2))
1663 { 1688 {
1664 // Were we looking for something specific? 1689 // Were we looking for something specific?
1665 1690