upgrade busybox to 1.1.0 final
[openwrt.git] / package / busybox / patches / 220-http_address_binding.patch
1 diff -ur busybox-1.1.0/networking/httpd.c busybox-1.1.0-owrt/networking/httpd.c
2 --- busybox-1.1.0/networking/httpd.c 2006-01-11 06:43:51.000000000 +0100
3 +++ busybox-1.1.0-owrt/networking/httpd.c 2006-01-14 17:56:53.000000000 +0100
4 @@ -150,6 +150,7 @@
5
6 /* You can use this server as standalone, require libbb.a for linking */
7 //#define HTTPD_STANDALONE
8 +static const char address[16] = "127.0.0.1";
9
10 /* Config options, disable this for do very small module */
11 //#define CONFIG_FEATURE_HTTPD_CGI
12 @@ -202,7 +203,7 @@
13 void bb_show_usage(void)
14 {
15 fprintf(stderr, "Usage: %s [-p <port>] [-c configFile] [-d/-e <string>] "
16 - "[-r realm] [-u user] [-h homedir]\n", bb_applet_name);
17 + "[-l IP address] [-r realm] [-u user] [-h homedir]\n", bb_applet_name);
18 exit(1);
19 }
20 #endif
21 @@ -256,6 +257,7 @@
22 #endif
23 unsigned port; /* server initial port and for
24 set env REMOTE_PORT */
25 + char addr[16]; /* server initial IP address */
26 union HTTPD_FOUND {
27 const char *found_mime_type;
28 const char *found_moved_temporarily;
29 @@ -858,6 +860,13 @@
30 sprintf(buf, "%u", config->port);
31 addEnv(port_name, "PORT", buf);
32 }
33 +static void addEnvAddr(const char *addr_name)
34 +{
35 + char buf[16];
36 +
37 + sprintf(buf, "%s", config->addr);
38 + addEnv(addr_name, "ADDR", buf);
39 +}
40 #endif
41 #endif /* CONFIG_FEATURE_HTTPD_CGI */
42
43 @@ -942,7 +951,14 @@
44 /* inet_addr() returns a value that is already in network order */
45 memset(&lsocket, 0, sizeof(lsocket));
46 lsocket.sin_family = AF_INET;
47 - lsocket.sin_addr.s_addr = INADDR_ANY;
48 + if (inet_aton(config->addr, & (lsocket.sin_addr)) == 0) {
49 + if ((gethostbyname(config->addr)) == NULL) return -1;
50 + lsocket.sin_addr.s_addr = ((struct in_addr *) ((gethostbyname(config->addr))->h_addr))->s_addr;
51 + }
52 + else
53 + {
54 + lsocket.sin_addr.s_addr = htons(INADDR_ANY);
55 + }
56 lsocket.sin_port = htons(config->port) ;
57 fd = socket(AF_INET, SOCK_STREAM, 0);
58 if (fd >= 0) {
59 @@ -1971,7 +1987,7 @@
60 #define OPT_INC_3 ENABLE_FEATURE_HTTPD_AUTH_MD5
61
62 #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
63 - "p:"
64 + "p:l"
65 #endif
66 #ifdef CONFIG_FEATURE_HTTPD_SETUID
67 "u:"
68 @@ -1985,6 +2001,7 @@
69 #define OPT_REALM (1<<(2+OPT_INC_1+OPT_INC_2)) /* r */
70 #define OPT_MD5 (1<<(2+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* m */
71 #define OPT_PORT (1<<(3+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* p */
72 +#define OPT_ADDR (1<<(4+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* l */
73 #define OPT_SETUID (1<<(4+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* u */
74
75
76 @@ -2038,6 +2055,7 @@
77 #endif
78 #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
79 , &s_port
80 + , &(config->addr)
81 #endif
82 #ifdef CONFIG_FEATURE_HTTPD_SETUID
83 , &s_uid
84 Only in busybox-1.1.0-owrt/networking: httpd.c.orig
85 Only in busybox-1.1.0-owrt/networking: httpd.c.rej
This page took 0.058437 seconds and 5 git commands to generate.