svn commit: trunk/busybox: networking util-linux

vda at busybox.net vda at busybox.net
Sat Sep 15 13:28:31 UTC 2007


Author: vda
Date: 2007-09-15 06:28:30 -0700 (Sat, 15 Sep 2007)
New Revision: 19854

Log:
httpd: do not clear environment
mount: mount helpers support (by Vladimir Dronnikov <dronnikov at gmail.ru>)



Modified:
   trunk/busybox/networking/httpd.c
   trunk/busybox/util-linux/Config.in
   trunk/busybox/util-linux/mount.c


Changeset:
Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2007-09-15 12:16:25 UTC (rev 19853)
+++ trunk/busybox/networking/httpd.c	2007-09-15 13:28:30 UTC (rev 19854)
@@ -2089,7 +2089,13 @@
 #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): */

Modified: trunk/busybox/util-linux/Config.in
===================================================================
--- trunk/busybox/util-linux/Config.in	2007-09-15 12:16:25 UTC (rev 19853)
+++ trunk/busybox/util-linux/Config.in	2007-09-15 13:28:30 UTC (rev 19854)
@@ -360,6 +360,16 @@
 	  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

Modified: trunk/busybox/util-linux/mount.c
===================================================================
--- trunk/busybox/util-linux/mount.c	2007-09-15 12:16:25 UTC (rev 19853)
+++ trunk/busybox/util-linux/mount.c	2007-09-15 13:28:30 UTC (rev 19854)
@@ -18,8 +18,8 @@
    mount_it_now() does the actual mount.
 */
 
+#include <mntent.h>
 #include "libbb.h"
-#include <mntent.h>
 
 /* Needed for nfs support only... */
 #include <syslog.h>
@@ -30,21 +30,24 @@
 #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 at 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 {
 	MOUNT_USERS  = (1<<28)*ENABLE_DESKTOP,
@@ -186,11 +189,11 @@
 			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 @@
 				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 @@
 	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 @@
 
 			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 @@
 
 		// 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?
 




More information about the busybox-cvs mailing list