diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-09-08 15:39:09 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-09-08 15:39:09 +0000 |
commit | 972bad0e238bc2fbb786808b8f5334d34d305990 (patch) | |
tree | 3d97b8ca37345a4cac49db450929cc1ffcd646ef /networking | |
parent | b08fbd3a368b023796613eaa42e4e62d267e869b (diff) | |
download | busybox-w32-972bad0e238bc2fbb786808b8f5334d34d305990.tar.gz busybox-w32-972bad0e238bc2fbb786808b8f5334d34d305990.tar.bz2 busybox-w32-972bad0e238bc2fbb786808b8f5334d34d305990.zip |
Vodz, last_patch_110
no limit, no memory usage for env buffer, always call putenv().
remove small error for previous last_patch109.
git-svn-id: svn://busybox.net/trunk/busybox@7426 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-rw-r--r-- | networking/httpd.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index eb03f34c0..251eee01b 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -202,13 +202,6 @@ void bb_show_usage(void) | |||
202 | #undef DEBUG | 202 | #undef DEBUG |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | /* CGI environ size */ | ||
206 | #ifdef CONFIG_FEATURE_HTTPD_SET_CGI_VARS_TO_ENV | ||
207 | #define ENVSIZE 70 /* set max CGI variable */ | ||
208 | #else | ||
209 | #define ENVSIZE 15 /* minimal requires */ | ||
210 | #endif | ||
211 | |||
212 | #define MAX_POST_SIZE (64*1024) /* 64k. Its Small? May be ;) */ | 205 | #define MAX_POST_SIZE (64*1024) /* 64k. Its Small? May be ;) */ |
213 | 206 | ||
214 | #define MAX_MEMORY_BUFF 8192 /* IO buffer */ | 207 | #define MAX_MEMORY_BUFF 8192 /* IO buffer */ |
@@ -228,10 +221,6 @@ typedef struct HT_ACCESS_IP { | |||
228 | 221 | ||
229 | typedef struct | 222 | typedef struct |
230 | { | 223 | { |
231 | #ifdef CONFIG_FEATURE_HTTPD_CGI | ||
232 | char *envp[ENVSIZE+1]; | ||
233 | int envCount; | ||
234 | #endif | ||
235 | char buf[MAX_MEMORY_BUFF]; | 224 | char buf[MAX_MEMORY_BUFF]; |
236 | 225 | ||
237 | #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH | 226 | #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH |
@@ -659,20 +648,17 @@ static void parse_conf(const char *path, int flag) | |||
659 | c = strchr(cf, ':'); | 648 | c = strchr(cf, ':'); |
660 | *c++ = 0; | 649 | *c++ = 0; |
661 | cur->after_colon = c; | 650 | cur->after_colon = c; |
662 | #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH | ||
663 | if(*cf == '/') | ||
664 | free(p0); | ||
665 | #endif | ||
666 | #ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES | 651 | #ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES |
667 | else if(*cf == '.') { | 652 | if(*cf == '.') { |
668 | /* config .mime line move top for overwrite previous */ | 653 | /* config .mime line move top for overwrite previous */ |
669 | cur->next = config->mime_a; | 654 | cur->next = config->mime_a; |
670 | config->mime_a = cur; | 655 | config->mime_a = cur; |
656 | continue; | ||
671 | } | 657 | } |
672 | #endif | 658 | #endif |
673 | |||
674 | #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH | 659 | #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH |
675 | else if(prev == NULL) { | 660 | free(p0); |
661 | if(prev == NULL) { | ||
676 | /* first line */ | 662 | /* first line */ |
677 | config->auth = prev = cur; | 663 | config->auth = prev = cur; |
678 | } else { | 664 | } else { |
@@ -809,19 +795,16 @@ static char *decodeString(char *orig, int flag_plus_to_space) | |||
809 | static void addEnv(const char *name_before_underline, | 795 | static void addEnv(const char *name_before_underline, |
810 | const char *name_after_underline, const char *value) | 796 | const char *name_after_underline, const char *value) |
811 | { | 797 | { |
812 | char *s; | 798 | char *s = NULL; |
813 | const char *underline; | 799 | const char *underline; |
814 | 800 | ||
815 | if (config->envCount >= ENVSIZE) | ||
816 | return; | ||
817 | if (!value) | 801 | if (!value) |
818 | value = ""; | 802 | value = ""; |
819 | underline = *name_after_underline ? "_" : ""; | 803 | underline = *name_after_underline ? "_" : ""; |
820 | asprintf(&s, "%s%s%s=%s", name_before_underline, underline, | 804 | asprintf(&s, "%s%s%s=%s", name_before_underline, underline, |
821 | name_after_underline, value); | 805 | name_after_underline, value); |
822 | if(s) { | 806 | if(s) { |
823 | config->envp[config->envCount++] = s; | 807 | putenv(s); |
824 | config->envp[config->envCount] = 0; | ||
825 | } | 808 | } |
826 | } | 809 | } |
827 | 810 | ||
@@ -1242,7 +1225,7 @@ static int sendCgi(const char *url, | |||
1242 | // now run the program. If it fails, | 1225 | // now run the program. If it fails, |
1243 | // use _exit() so no destructors | 1226 | // use _exit() so no destructors |
1244 | // get called and make a mess. | 1227 | // get called and make a mess. |
1245 | execve(realpath_buff, argp, config->envp); | 1228 | execv(realpath_buff, argp); |
1246 | } | 1229 | } |
1247 | } | 1230 | } |
1248 | } | 1231 | } |