[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    dvv pending patches
From:       Vladimir Dronnikov <dronnikov () gmail ! com>
Date:       2009-01-29 17:45:12
Message-ID: 6784529b0901290945y38b9d853ta95a90545c90cfbf () mail ! gmail ! com
[Download RAW message or body]

Hello!

Attached is some pending patches which may be of some use in mainstream:

* crond: make spool directory path configurable;
* httpd: use unified parser;
* sendmail: remove erroneous usage lines.

Please, consider applying.

Regards,
--
Vladimir

["crond.patch" (text/x-patch)]

--- busybox.orig/miscutils/Config.in	Wed Nov 26 21:38:41 2008
+++ busybox/miscutils/Config.in	Wed Dec 17 22:01:03 2008
@@ -121,6 +121,13 @@
 	help
 	  Support calling /usr/sbin/sendmail for send cmd outputs.
 
+config FEATURE_CROND_DIR
+	string "crond spool directory"
+	default "/var/spool/cron"
+	depends on CROND || CRONTAB
+	help
+	  Location of crond spool.
+
 config CRONTAB
 	bool "crontab"
 	default n
--- busybox.orig/miscutils/crond.c	Sat Dec 13 16:54:14 2008
+++ busybox/miscutils/crond.c	Wed Dec 17 21:59:46 2008
@@ -23,12 +23,8 @@
 #endif
 
 
-#ifndef CRONTABS
-#define CRONTABS        "/var/spool/cron/crontabs"
-#endif
-#ifndef TMPDIR
-#define TMPDIR          "/var/spool/cron"
-#endif
+#define TMPDIR          CONFIG_FEATURE_CROND_DIR
+#define CRONTABS        CONFIG_FEATURE_CROND_DIR "/crontabs"
 #ifndef SENDMAIL
 #define SENDMAIL        "sendmail"
 #endif
--- busybox.orig/miscutils/crontab.c	Sat Dec 13 16:54:14 2008
+++ busybox/miscutils/crontab.c	Wed Dec 17 22:02:14 2008
@@ -12,9 +12,7 @@
 
 #include "libbb.h"
 
-#ifndef CRONTABS
-#define CRONTABS        "/var/spool/cron/crontabs"
-#endif
+#define CRONTABS	CONFIG_FEATURE_CROND_DIR "/crontabs"
 #ifndef CRONUPDATE
 #define CRONUPDATE      "cron.update"
 #endif

["httpd.patch" (text/x-patch)]

--- busybox.orig/networking/httpd.c	Sun Nov 23 08:54:42 2008
+++ busybox/networking/httpd.c	Sun Nov 30 18:13:10 2008
@@ -484,7 +484,8 @@
 #define FIND_FROM_HTTPD_ROOT 3
 static void parse_conf(const char *path, int flag)
 {
-	FILE *f;
+	parser_t *parser;
+	char *token[3];
 #if ENABLE_FEATURE_HTTPD_BASIC_AUTH
 	Htaccess *prev;
 #endif
@@ -494,9 +495,7 @@
 	Htaccess *cur;
 #endif
 	const char *filename = configFile;
-	char buf[160];
 	char *p, *p0;
-	char *after_colon;
 	Htaccess_IP *pip;
 
 	/* discard old rules */
@@ -524,7 +523,7 @@
 		sprintf((char *)filename, "%s/%s", path, httpd_conf);
 	}
 
-	while ((f = fopen_for_read(filename)) == NULL) {
+	while ((parser = config_open2(filename, fopen_for_read)) == NULL) {
 		if (flag == SUBDIR_PARSE || flag == FIND_FROM_HTTPD_ROOT) {
 			/* config file not found, no changes to config */
 			return;
@@ -539,24 +538,13 @@
 	prev = g_auth;
 #endif
 	/* This could stand some work */
-	while ((p0 = fgets(buf, sizeof(buf), f)) != NULL) {
-		after_colon = NULL;
-		for (p = p0; *p0 != '\0' && *p0 != '#'; p0++) {
-			if (!isspace(*p0)) {
-				*p++ = *p0;
-				if (*p0 == ':' && after_colon == NULL)
-					after_colon = p;
-			}
-		}
-		*p = '\0';
+	while (config_read(parser, token, 3, 2, "#:", PARSE_NORMAL)) {
+		p0 = token[0];
 
-		/* test for empty or strange line */
-		if (after_colon == NULL || *after_colon == '\0')
-			continue;
-		p0 = buf;
+		/*  [adAD]:from # ip address allow/deny, * for wildcard */
 		if (*p0 == 'd' || *p0 == 'a')
 			*p0 -= 0x20; /* a/d -> A/D */
-		if (*after_colon == '*') {
+		if (*token[1] == '*') {
 			if (*p0 == 'D') {
 				/* memorize "deny all" */
 				flg_deny_all = 1;
@@ -568,7 +556,7 @@
 		if (*p0 == 'A' || *p0 == 'D') {
 			/* storing current config IP line */
 			pip = xzalloc(sizeof(Htaccess_IP));
-			if (scan_ip_mask(after_colon, &(pip->ip), &(pip->mask))) {
+			if (scan_ip_mask(token[1], &(pip->ip), &(pip->mask))) {
 				/* IP{/mask} syntax error detected, protect all */
 				*p0 = 'D';
 				pip->mask = 0;
@@ -593,20 +581,25 @@
 		}
 
 #if ENABLE_FEATURE_HTTPD_ERROR_PAGES
+		/* Ennn:error.html  # error page for status nnn */
 		if (flag == FIRST_PARSE && *p0 == 'E') {
 			unsigned i;
 			int status = atoi(++p0); /* error status code */
 			if (status < HTTP_CONTINUE) {
-				bb_error_msg("config error '%s' in '%s'", buf, filename);
+#if ENABLE_FEATURE_HTTPD_PROXY
+				goto conferr;
+#else
+				bb_error_msg("config error at line '%d' of '%s'", parser->lineno, filename);
 				continue;
+#endif
 			}
 			/* then error page; find matching status */
 			for (i = 0; i < ARRAY_SIZE(http_response_type); i++) {
 				if (http_response_type[i] == status) {
 					/* We chdir to home_httpd, thus no need to
-					 * concat_path_file(home_httpd, after_colon)
+					 * concat_path_file(home_httpd, token[1])
 					 * here */
-					http_error_page[i] = xstrdup(after_colon);
+					http_error_page[i] = xstrdup(token[1]);
 					break;
 				}
 			}
@@ -615,29 +608,25 @@
 #endif
 
 #if ENABLE_FEATURE_HTTPD_PROXY
+		/* P:/url:[http://]hostname[:port]/new/path # reverse proxy */
 		if (flag == FIRST_PARSE && *p0 == 'P') {
-			/* P:/url:[http://]hostname[:port]/new/path */
 			char *url_from, *host_port, *url_to;
 			Htaccess_Proxy *proxy_entry;
 
-			url_from = after_colon;
-			host_port = strchr(after_colon, ':');
-			if (host_port == NULL) {
-				bb_error_msg("config error '%s' in '%s'", buf, filename);
+			url_from = token[1];
+			host_port = token[2];
+			if (!host_port) {
+ conferr:
+				bb_error_msg("config error at line '%d' of '%s'", parser->lineno, filename);
 				continue;
 			}
-			*host_port++ = '\0';
 			if (strncmp(host_port, "http://", 7) == 0)
 				host_port += 7;
-			if (*host_port == '\0') {
-				bb_error_msg("config error '%s' in '%s'", buf, filename);
-				continue;
-			}
+			if (*host_port == '\0')
+				goto conferr;
 			url_to = strchr(host_port, '/');
-			if (url_to == NULL) {
-				bb_error_msg("config error '%s' in '%s'", buf, filename);
-				continue;
-			}
+			if (url_to == NULL)
+				goto conferr;
 			*url_to = '\0';
 			proxy_entry = xzalloc(sizeof(Htaccess_Proxy));
 			proxy_entry->url_from = xstrdup(url_from);
@@ -651,12 +640,13 @@
 #endif
 
 #if ENABLE_FEATURE_HTTPD_BASIC_AUTH
+		/* /cgi-bin:foo:bar  # Require user foo, pwd bar on urls starting with /cgi-bin/ */
 		if (*p0 == '/') {
 			/* make full path from httpd root / current_path / config_line_path */
 			const char *tp = (flag == SUBDIR_PARSE ? path : "");
-			p0 = xmalloc(strlen(tp) + (after_colon - buf) + 2 + strlen(after_colon));
-			after_colon[-1] = '\0';
-			sprintf(p0, "/%s%s", tp, buf);
+			// concat_path_file instead?
+			p0 = xmalloc(strlen(tp) + 2 + strlen(token[0]));
+			sprintf(p0, "/%s%s", tp, token[0]);
 
 			/* looks like bb_simplify_path... */
 			tp = p = p0;
@@ -685,18 +675,16 @@
 			if ((p == p0) || (*p != '/')) { /* not a trailing slash */
 				++p;                    /* so keep last character */
 			}
-			*p = ':';
-			strcpy(p + 1, after_colon);
 		}
 #endif
 		if (*p0 == 'I') {
-			index_page = xstrdup(after_colon);
+			index_page = xstrdup(token[1]);
 			continue;
 		}
 
 		/* Do not allow jumping around using H in subdir's configs */
 		if (flag == FIRST_PARSE && *p0 == 'H') {
-			home_httpd = xstrdup(after_colon);
+			home_httpd = xstrdup(token[1]);
 			xchdir(home_httpd);
 			continue;
 		}
@@ -763,8 +751,8 @@
 		}
 #endif /* BASIC_AUTH */
 #endif /* BASIC_AUTH || MIME_TYPES || SCRIPT_INTERPR */
-	 } /* while (fgets) */
-	 fclose(f);
+	} /* while (config_read) */
+	config_close(parser);
 }
 
 #if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR

["sendmail.patch" (text/x-patch)]

--- busybox.orig/include/usage.h	Thu Dec 25 21:11:54 2008
+++ busybox/include/usage.h	Thu Jan 15 18:57:15 2009
@@ -3624,8 +3624,6 @@
        "Send an email\n" \
      "\nOptions:" \
      "\n	-w timeout	Network timeout" \
-     "\n	-H [user:pass@]server[:port] Server" \
-     "\n	-S		Use openssl connection helper for secure servers" \
      "\n	-N type		Request delivery notification. Type is ignored" \
      "\n	-f sender	Sender" \
      "\n	-F fullname	Sender full name. Overrides $NAME" \


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic