summaryrefslogtreecommitdiff
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 a888c24..a8e5df9 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2089,7 +2089,13 @@ int httpd_main(int argc, char **argv)
#endif
}
-#if ENABLE_FEATURE_HTTPD_CGI
+#if 0 /*was #if ENABLE_FEATURE_HTTPD_CGI*/
+ /* User can do it himself: 'env - PATH="$PATH" httpd'
+ * We don't do it because we don't want to screw users
+ * which want to do
+ * 'env - VAR1=val1 VAR2=val2 https'
+ * and have VAR1 and VAR2 values visible in their CGIs.
+ * Besides, it is also smaller. */
{
char *p = getenv("PATH");
/* env strings themself are not freed, no need to strdup(p): */
diff --git a/util-linux/Config.in b/util-linux/Config.in
index c910813..107382f 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -360,6 +360,16 @@ config MOUNT
NFS filesystems. Most people using BusyBox will also want to enable
the 'mount' utility.
+config FEATURE_MOUNT_HELPERS
+ bool "Support mount helpers"
+ default n
+ depends on MOUNT
+ help
+ Enable mounting of virtual file systems via external helpers.
+ E.g. mount obexfs#-b00.11.22.33.44.55 /mnt will in effect call
+ obexfs -b00.11.22.33.44.55 /mnt
+ The idea is to use such virtual filesystems in /etc/fstab
+
config FEATURE_MOUNT_NFS
bool "Support mounting NFS file systems"
default n
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 91f09e1..d391a26 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -18,8 +18,8 @@
mount_it_now() does the actual mount.
*/
-#include "libbb.h"
#include <mntent.h>
+#include "libbb.h"
/* Needed for nfs support only... */
#include <syslog.h>
@@ -30,20 +30,23 @@
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
+#ifndef MS_SILENT
+#define MS_SILENT (1 << 15)
+#endif
#if defined(__dietlibc__)
/* 16.12.2006, Sampo Kellomaki (sampo@iki.fi)
* dietlibc-0.30 does not have implementation of getmntent_r() */
-/* OTOH: why we use getmntent_r instead of getmntent? TODO... */
struct mntent *getmntent_r(FILE* stream, struct mntent* result, char* buffer, int bufsize)
{
- /* *** XXX FIXME WARNING: This hack is NOT thread safe. --Sampo */
struct mntent* ment = getmntent(stream);
memcpy(result, ment, sizeof(struct mntent));
return result;
}
#endif
+#define getmntent_buf bb_common_bufsiz1
+
// Not real flags, but we want to be able to check for this.
enum {
@@ -186,11 +189,11 @@ static int parse_mount_options(char *options, char **unrecognized)
strcpy((*unrecognized)+i, options);
}
- // Advance to next option, or finish
- if (comma) {
- *comma = ',';
- options = ++comma;
- } else break;
+ if (!comma)
+ break;
+ // Advance to next option
+ *comma = ',';
+ options = ++comma;
}
return flags;
@@ -262,8 +265,9 @@ static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
vfsflags, filteropts);
if (!rc || (vfsflags&MS_RDONLY) || (errno!=EACCES && errno!=EROFS))
break;
- bb_error_msg("%s is write-protected, mounting read-only",
- mp->mnt_fsname);
+ if (!(vfsflags & MS_SILENT))
+ bb_error_msg("%s is write-protected, mounting read-only",
+ mp->mnt_fsname);
vfsflags |= MS_RDONLY;
}
@@ -1399,6 +1403,27 @@ static int singlemount(struct mntent *mp, int ignore_busy)
if (mp->mnt_type && strcmp(mp->mnt_type,"auto") == 0)
mp->mnt_type = 0;
+ // Might this be a virtual filesystem?
+
+ if (ENABLE_FEATURE_MOUNT_HELPERS
+ && (strchr(mp->mnt_fsname,'#'))
+ ) {
+ char *s, *p, *args[35];
+ int n = 0;
+ for (s = p = mp->mnt_fsname; *s && n < 35-3; ++s) {
+ if (s[0] == '#' && s[1] != '#') {
+ *s = '\0';
+ args[n++] = p;
+ p = s + 1;
+ }
+ }
+ args[n++] = p;
+ args[n++] = mp->mnt_dir;
+ args[n] = NULL;
+ rc = wait4pid(xspawn(args));
+ goto report_error;
+ }
+
// Might this be an CIFS filesystem?
if (ENABLE_FEATURE_MOUNT_CIFS
@@ -1593,8 +1618,8 @@ int mount_main(int argc, char **argv)
if (!mountTable) bb_error_msg_and_die("no %s", bb_path_mtab_file);
- while (getmntent_r(mountTable, mtpair, bb_common_bufsiz1,
- sizeof(bb_common_bufsiz1)))
+ while (getmntent_r(mountTable, &mtpair[0], getmntent_buf,
+ sizeof(getmntent_buf)))
{
// Don't show rootfs. FIXME: why??
// util-linux 2.12a happily shows rootfs...
@@ -1657,9 +1682,9 @@ int mount_main(int argc, char **argv)
// Get next fstab entry
- if (!getmntent_r(fstab, mtcur, bb_common_bufsiz1
- + (mtcur==mtpair ? sizeof(bb_common_bufsiz1)/2 : 0),
- sizeof(bb_common_bufsiz1)/2))
+ if (!getmntent_r(fstab, mtcur, getmntent_buf
+ + (mtcur==mtpair ? sizeof(getmntent_buf)/2 : 0),
+ sizeof(getmntent_buf)/2))
{
// Were we looking for something specific?