diff options
| author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-28 19:38:04 +0000 |
|---|---|---|
| committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-28 19:38:04 +0000 |
| commit | 31924a3fe8deffa4724cbf4bca14a710d4439b9d (patch) | |
| tree | 5e51df91f30752db400655b99f798969191b32bb | |
| parent | badea0f8783572a68aaca3b54473a54c76d6cf78 (diff) | |
| download | busybox-w32-31924a3fe8deffa4724cbf4bca14a710d4439b9d.tar.gz busybox-w32-31924a3fe8deffa4724cbf4bca14a710d4439b9d.tar.bz2 busybox-w32-31924a3fe8deffa4724cbf4bca14a710d4439b9d.zip | |
More usage.h cleanups, with collateral changes to httpd. Specifically,
most of our CONFIG entries switch stuff on instead of off when enabled, so fix
the gratuitously reversed INETD thing.
git-svn-id: svn://busybox.net/trunk/busybox@14952 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | include/usage.h | 86 | ||||
| -rw-r--r-- | networking/Config.in | 12 | ||||
| -rw-r--r-- | networking/httpd.c | 48 |
3 files changed, 44 insertions, 102 deletions
diff --git a/include/usage.h b/include/usage.h index 052f6fcc2..65a7874fa 100644 --- a/include/usage.h +++ b/include/usage.h | |||
| @@ -975,36 +975,6 @@ USE_FEATURE_DATE_ISOFMT( \ | |||
| 975 | "\t-n\t\tno call to sync()\n" \ | 975 | "\t-n\t\tno call to sync()\n" \ |
| 976 | "\t-f\t\tforce halt (don't go through init)" | 976 | "\t-f\t\tforce halt (don't go through init)" |
| 977 | 977 | ||
| 978 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF | ||
| 979 | #define USAGE_SCAN_HWIF(a) a | ||
| 980 | #else | ||
| 981 | #define USAGE_SCAN_HWIF(a) | ||
| 982 | #endif | ||
| 983 | |||
| 984 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF | ||
| 985 | #define USAGE_UNREGISTER_HWIF(a) a | ||
| 986 | #else | ||
| 987 | #define USAGE_UNREGISTER_HWIF(a) | ||
| 988 | #endif | ||
| 989 | |||
| 990 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET | ||
| 991 | #define USAGE_DRIVE_RESET(a) a | ||
| 992 | #else | ||
| 993 | #define USAGE_DRIVE_RESET(a) | ||
| 994 | #endif | ||
| 995 | |||
| 996 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | ||
| 997 | #define USAGE_TRISTATE_HWIF(a) a | ||
| 998 | #else | ||
| 999 | #define USAGE_TRISTATE_HWIF(a) | ||
| 1000 | #endif | ||
| 1001 | |||
| 1002 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA | ||
| 1003 | #define USAGE_GETSET_DMA(a) a | ||
| 1004 | #else | ||
| 1005 | #define USAGE_GETSET_DMA(a) | ||
| 1006 | #endif | ||
| 1007 | |||
| 1008 | #define hdparm_trivial_usage \ | 978 | #define hdparm_trivial_usage \ |
| 1009 | "[options] [device] .." | 979 | "[options] [device] .." |
| 1010 | #define hdparm_full_usage \ | 980 | #define hdparm_full_usage \ |
| @@ -1015,7 +985,7 @@ USE_FEATURE_DATE_ISOFMT( \ | |||
| 1015 | "\t-B set Advanced Power Management setting (1-255)\n" \ | 985 | "\t-B set Advanced Power Management setting (1-255)\n" \ |
| 1016 | "\t-c get/set IDE 32-bit IO setting\n" \ | 986 | "\t-c get/set IDE 32-bit IO setting\n" \ |
| 1017 | "\t-C check IDE power mode status\n" \ | 987 | "\t-C check IDE power mode status\n" \ |
| 1018 | USAGE_GETSET_DMA("\t-d get/set using_dma flag\n") \ | 988 | USE_FEATURE_HDPARM_HDIO_GETSET_DMA("\t-d get/set using_dma flag\n") \ |
| 1019 | "\t-D enable/disable drive defect-mgmt\n" \ | 989 | "\t-D enable/disable drive defect-mgmt\n" \ |
| 1020 | "\t-f flush buffer cache for device on exit\n" \ | 990 | "\t-f flush buffer cache for device on exit\n" \ |
| 1021 | "\t-g display drive geometry\n" \ | 991 | "\t-g display drive geometry\n" \ |
| @@ -1033,29 +1003,23 @@ USE_FEATURE_DATE_ISOFMT( \ | |||
| 1033 | "\t-q change next setting quietly\n" \ | 1003 | "\t-q change next setting quietly\n" \ |
| 1034 | "\t-Q get/set DMA tagged-queuing depth (if supported)\n" \ | 1004 | "\t-Q get/set DMA tagged-queuing depth (if supported)\n" \ |
| 1035 | "\t-r get/set readonly flag (DANGEROUS to set)\n" \ | 1005 | "\t-r get/set readonly flag (DANGEROUS to set)\n" \ |
| 1036 | USAGE_SCAN_HWIF("\t-R register an IDE interface (DANGEROUS)\n") \ | 1006 | USE_FEATURE_HDPARM_HDIO_SCAN_HWIF("\t-R register an IDE interface (DANGEROUS)\n") \ |
| 1037 | "\t-S set standby (spindown) timeout\n" \ | 1007 | "\t-S set standby (spindown) timeout\n" \ |
| 1038 | "\t-t perform device read timings\n" \ | 1008 | "\t-t perform device read timings\n" \ |
| 1039 | "\t-T perform cache read timings\n" \ | 1009 | "\t-T perform cache read timings\n" \ |
| 1040 | "\t-u get/set unmaskirq flag (0/1)\n" \ | 1010 | "\t-u get/set unmaskirq flag (0/1)\n" \ |
| 1041 | USAGE_UNREGISTER_HWIF("\t-U un-register an IDE interface (DANGEROUS)\n") \ | 1011 | USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("\t-U un-register an IDE interface (DANGEROUS)\n") \ |
| 1042 | "\t-v defaults; same as -mcudkrag for IDE drives\n" \ | 1012 | "\t-v defaults; same as -mcudkrag for IDE drives\n" \ |
| 1043 | "\t-V display program version and exit immediately\n" \ | 1013 | "\t-V display program version and exit immediately\n" \ |
| 1044 | USAGE_DRIVE_RESET("\t-w perform device reset (DANGEROUS)\n") \ | 1014 | USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("\t-w perform device reset (DANGEROUS)\n") \ |
| 1045 | "\t-W set drive write-caching flag (0/1) (DANGEROUS)\n" \ | 1015 | "\t-W set drive write-caching flag (0/1) (DANGEROUS)\n" \ |
| 1046 | USAGE_TRISTATE_HWIF("\t-x tristate device for hotswap (0/1) (DANGEROUS)\n") \ | 1016 | USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF("\t-x tristate device for hotswap (0/1) (DANGEROUS)\n") \ |
| 1047 | "\t-X set IDE xfer mode (DANGEROUS)\n" \ | 1017 | "\t-X set IDE xfer mode (DANGEROUS)\n" \ |
| 1048 | "\t-y put IDE drive in standby mode\n" \ | 1018 | "\t-y put IDE drive in standby mode\n" \ |
| 1049 | "\t-Y put IDE drive to sleep\n" \ | 1019 | "\t-Y put IDE drive to sleep\n" \ |
| 1050 | "\t-Z disable Seagate auto-powersaving mode\n" \ | 1020 | "\t-Z disable Seagate auto-powersaving mode\n" \ |
| 1051 | "\t-z re-read partition table" | 1021 | "\t-z re-read partition table" |
| 1052 | 1022 | ||
| 1053 | #ifdef CONFIG_FEATURE_FANCY_HEAD | ||
| 1054 | #define USAGE_FANCY_HEAD(a) a | ||
| 1055 | #else | ||
| 1056 | #define USAGE_FANCY_HEAD(a) | ||
| 1057 | #endif | ||
| 1058 | |||
| 1059 | #define head_trivial_usage \ | 1023 | #define head_trivial_usage \ |
| 1060 | "[OPTION]... [FILE]..." | 1024 | "[OPTION]... [FILE]..." |
| 1061 | #define head_full_usage \ | 1025 | #define head_full_usage \ |
| @@ -1064,7 +1028,7 @@ USE_FEATURE_DATE_ISOFMT( \ | |||
| 1064 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ | 1028 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" \ |
| 1065 | "Options:\n" \ | 1029 | "Options:\n" \ |
| 1066 | "\t-n NUM\t\tPrint first NUM lines instead of first 10" \ | 1030 | "\t-n NUM\t\tPrint first NUM lines instead of first 10" \ |
| 1067 | USAGE_FANCY_HEAD( \ | 1031 | USE_FEATURE_FANCY_HEAD( \ |
| 1068 | "\n\t-c NUM\t\toutput the first NUM bytes\n" \ | 1032 | "\n\t-c NUM\t\toutput the first NUM bytes\n" \ |
| 1069 | "\t-q\t\tnever output headers giving file names\n" \ | 1033 | "\t-q\t\tnever output headers giving file names\n" \ |
| 1070 | "\t-v\t\talways output headers giving file names" ) | 1034 | "\t-v\t\talways output headers giving file names" ) |
| @@ -1111,44 +1075,22 @@ USE_FEATURE_DATE_ISOFMT( \ | |||
| 1111 | "$ hostname\n" \ | 1075 | "$ hostname\n" \ |
| 1112 | "sage\n" | 1076 | "sage\n" |
| 1113 | 1077 | ||
| 1114 | #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH | ||
| 1115 | # define USAGE_HTTPD_BASIC_AUTH(a) a | ||
| 1116 | # ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5 | ||
| 1117 | # define USAGE_HTTPD_AUTH_MD5(a) a | ||
| 1118 | # else | ||
| 1119 | # define USAGE_HTTPD_AUTH_MD5(a) | ||
| 1120 | # endif | ||
| 1121 | #else | ||
| 1122 | # define USAGE_HTTPD_BASIC_AUTH(a) | ||
| 1123 | # define USAGE_HTTPD_AUTH_MD5(a) | ||
| 1124 | #endif | ||
| 1125 | #ifdef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | ||
| 1126 | # define USAGE_HTTPD_STANDALONE(a) | ||
| 1127 | # define USAGE_HTTPD_SETUID(a) | ||
| 1128 | #else | ||
| 1129 | # define USAGE_HTTPD_STANDALONE(a) a | ||
| 1130 | # ifdef CONFIG_FEATURE_HTTPD_SETUID | ||
| 1131 | # define USAGE_HTTPD_SETUID(a) a | ||
| 1132 | # else | ||
| 1133 | # define USAGE_HTTPD_SETUID(a) | ||
| 1134 | # endif | ||
| 1135 | #endif | ||
| 1136 | #define httpd_trivial_usage \ | 1078 | #define httpd_trivial_usage \ |
| 1137 | "[-c <conf file>]" \ | 1079 | "[-c <conf file>]" \ |
| 1138 | USAGE_HTTPD_STANDALONE(" [-p <port>]") \ | 1080 | USE_FEATURE_HTTPD_WITHOUT_INETD(" [-p <port>]") \ |
| 1139 | USAGE_HTTPD_SETUID(" [-u user]") \ | 1081 | USE_FEATURE_HTTPD_SETUID(" [-u user]") \ |
| 1140 | USAGE_HTTPD_BASIC_AUTH(" [-r <realm>]") \ | 1082 | USE_FEATURE_HTTPD_BASIC_AUTH(" [-r <realm>]") \ |
| 1141 | USAGE_HTTPD_AUTH_MD5(" [-m pass]") \ | 1083 | USE_FEATURE_HTTPD_AUTH_MD5(" [-m pass]") \ |
| 1142 | " [-h home]" \ | 1084 | " [-h home]" \ |
| 1143 | " [-d/-e <string>]" | 1085 | " [-d/-e <string>]" |
| 1144 | #define httpd_full_usage \ | 1086 | #define httpd_full_usage \ |
| 1145 | "Listens for incoming http server requests.\n\n" \ | 1087 | "Listens for incoming http server requests.\n\n" \ |
| 1146 | "Options:\n" \ | 1088 | "Options:\n" \ |
| 1147 | "\t-c FILE\t\tSpecifies configuration file. (default httpd.conf)\n" \ | 1089 | "\t-c FILE\t\tSpecifies configuration file. (default httpd.conf)\n" \ |
| 1148 | USAGE_HTTPD_STANDALONE("\t-p PORT\tServer port (default 80)\n") \ | 1090 | USE_FEATURE_HTTPD_WITHOUT_INETD("\t-p PORT\tServer port (default 80)\n") \ |
| 1149 | USAGE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privileges port\n") \ | 1091 | USE_FEATURE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privileges port\n") \ |
| 1150 | USAGE_HTTPD_BASIC_AUTH("\t-r REALM\tAuthentication Realm for Basic Authentication\n") \ | 1092 | USE_FEATURE_HTTPD_BASIC_AUTH("\t-r REALM\tAuthentication Realm for Basic Authentication\n") \ |
| 1151 | USAGE_HTTPD_AUTH_MD5("\t-m PASS\t\tCrypt PASS with md5 algorithm\n") \ | 1093 | USE_FEATURE_HTTPD_AUTH_MD5("\t-m PASS\t\tCrypt PASS with md5 algorithm\n") \ |
| 1152 | "\t-h HOME \tSpecifies http HOME directory (default ./)\n" \ | 1094 | "\t-h HOME \tSpecifies http HOME directory (default ./)\n" \ |
| 1153 | "\t-e STRING\tHtml encode STRING\n" \ | 1095 | "\t-e STRING\tHtml encode STRING\n" \ |
| 1154 | "\t-d STRING\tURL decode STRING" | 1096 | "\t-d STRING\tURL decode STRING" |
diff --git a/networking/Config.in b/networking/Config.in index 61d03aaf0..94e59ead1 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
| @@ -61,18 +61,18 @@ config CONFIG_HTTPD | |||
| 61 | help | 61 | help |
| 62 | Serve web pages via an HTTP server. | 62 | Serve web pages via an HTTP server. |
| 63 | 63 | ||
| 64 | config CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 64 | config CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 65 | bool "Support using httpd only from inetd" | 65 | bool "Support using httpd as a daemon (not from inetd)" |
| 66 | default n | 66 | default n |
| 67 | depends on CONFIG_HTTPD | 67 | depends on CONFIG_HTTPD |
| 68 | help | 68 | help |
| 69 | This option disables uid and port options for the httpd applet | 69 | This option enables uid and port options for the httpd applet, |
| 70 | but requires inetd server daemon. | 70 | and eliminates the need to be called from the inetd server daemon. |
| 71 | 71 | ||
| 72 | config CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP | 72 | config CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP |
| 73 | bool "Support reloading the global config file using hup signal" | 73 | bool "Support reloading the global config file using hup signal" |
| 74 | default n | 74 | default n |
| 75 | depends on CONFIG_HTTPD && !CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 75 | depends on CONFIG_HTTPD && CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 76 | help | 76 | help |
| 77 | This option enables processing of SIGHUP to reload cached | 77 | This option enables processing of SIGHUP to reload cached |
| 78 | configuration settings. | 78 | configuration settings. |
| @@ -80,7 +80,7 @@ config CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP | |||
| 80 | config CONFIG_FEATURE_HTTPD_SETUID | 80 | config CONFIG_FEATURE_HTTPD_SETUID |
| 81 | bool "Enable support -u <user> option" | 81 | bool "Enable support -u <user> option" |
| 82 | default n | 82 | default n |
| 83 | depends on CONFIG_HTTPD && !CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 83 | depends on CONFIG_HTTPD && CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 84 | help | 84 | help |
| 85 | This option allows the server to run as a specific user | 85 | This option allows the server to run as a specific user |
| 86 | rather than defaulting to the user that starts the server. | 86 | rather than defaulting to the user that starts the server. |
diff --git a/networking/httpd.c b/networking/httpd.c index 97bec6e4b..73a9461fa 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
| @@ -183,7 +183,7 @@ typedef struct | |||
| 183 | Htaccess *mime_a; /* config mime types */ | 183 | Htaccess *mime_a; /* config mime types */ |
| 184 | #endif | 184 | #endif |
| 185 | 185 | ||
| 186 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 186 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 187 | int accepted_socket; | 187 | int accepted_socket; |
| 188 | # define a_c_r config->accepted_socket | 188 | # define a_c_r config->accepted_socket |
| 189 | # define a_c_w config->accepted_socket | 189 | # define a_c_w config->accepted_socket |
| @@ -776,7 +776,7 @@ static void addEnv(const char *name_before_underline, | |||
| 776 | } | 776 | } |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | #if defined(CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV) || !defined(CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY) | 779 | #if defined(CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV) || defined(CONFIG_FEATURE_HTTPD_WITHOUT_INETD) |
| 780 | /* set environs SERVER_PORT and REMOTE_PORT */ | 780 | /* set environs SERVER_PORT and REMOTE_PORT */ |
| 781 | static void addEnvPort(const char *port_name) | 781 | static void addEnvPort(const char *port_name) |
| 782 | { | 782 | { |
| @@ -848,7 +848,7 @@ static void decodeBase64(char *Data) | |||
| 848 | #endif | 848 | #endif |
| 849 | 849 | ||
| 850 | 850 | ||
| 851 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 851 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 852 | /**************************************************************************** | 852 | /**************************************************************************** |
| 853 | * | 853 | * |
| 854 | > $Function: openServer() | 854 | > $Function: openServer() |
| @@ -885,7 +885,7 @@ static int openServer(void) | |||
| 885 | signal(SIGCHLD, SIG_IGN); /* prevent zombie (defunct) processes */ | 885 | signal(SIGCHLD, SIG_IGN); /* prevent zombie (defunct) processes */ |
| 886 | return fd; | 886 | return fd; |
| 887 | } | 887 | } |
| 888 | #endif /* CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY */ | 888 | #endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */ |
| 889 | 889 | ||
| 890 | /**************************************************************************** | 890 | /**************************************************************************** |
| 891 | * | 891 | * |
| @@ -1163,7 +1163,7 @@ static int sendCgi(const char *url, | |||
| 1163 | } | 1163 | } |
| 1164 | } | 1164 | } |
| 1165 | } | 1165 | } |
| 1166 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1166 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1167 | config->accepted_socket = 1; /* send to stdout */ | 1167 | config->accepted_socket = 1; /* send to stdout */ |
| 1168 | #endif | 1168 | #endif |
| 1169 | sendHeaders(HTTP_NOT_FOUND); | 1169 | sendHeaders(HTTP_NOT_FOUND); |
| @@ -1728,7 +1728,7 @@ FORBIDDEN: /* protect listing /cgi-bin */ | |||
| 1728 | config->last_mod = sb.st_mtime; | 1728 | config->last_mod = sb.st_mtime; |
| 1729 | } | 1729 | } |
| 1730 | sendFile(test); | 1730 | sendFile(test); |
| 1731 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1731 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1732 | /* unset if non inetd looped */ | 1732 | /* unset if non inetd looped */ |
| 1733 | config->ContentLength = -1; | 1733 | config->ContentLength = -1; |
| 1734 | #endif | 1734 | #endif |
| @@ -1741,7 +1741,7 @@ FORBIDDEN: /* protect listing /cgi-bin */ | |||
| 1741 | } while (0); | 1741 | } while (0); |
| 1742 | 1742 | ||
| 1743 | 1743 | ||
| 1744 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1744 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1745 | /* from inetd don`t looping: freeing, closing automatic from exit always */ | 1745 | /* from inetd don`t looping: freeing, closing automatic from exit always */ |
| 1746 | # if DEBUG | 1746 | # if DEBUG |
| 1747 | fprintf(stderr, "closing socket\n"); | 1747 | fprintf(stderr, "closing socket\n"); |
| @@ -1754,7 +1754,7 @@ FORBIDDEN: /* protect listing /cgi-bin */ | |||
| 1754 | free(config->remoteuser); | 1754 | free(config->remoteuser); |
| 1755 | #endif | 1755 | #endif |
| 1756 | # endif | 1756 | # endif |
| 1757 | #endif /* CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY */ | 1757 | #endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */ |
| 1758 | shutdown(a_c_w, SHUT_WR); | 1758 | shutdown(a_c_w, SHUT_WR); |
| 1759 | 1759 | ||
| 1760 | /* Properly wait for remote to closed */ | 1760 | /* Properly wait for remote to closed */ |
| @@ -1768,9 +1768,9 @@ FORBIDDEN: /* protect listing /cgi-bin */ | |||
| 1768 | } while (retval > 0 && (read (a_c_r, buf, sizeof (config->buf)) > 0)); | 1768 | } while (retval > 0 && (read (a_c_r, buf, sizeof (config->buf)) > 0)); |
| 1769 | 1769 | ||
| 1770 | shutdown(a_c_r, SHUT_RD); | 1770 | shutdown(a_c_r, SHUT_RD); |
| 1771 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1771 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1772 | close(config->accepted_socket); | 1772 | close(config->accepted_socket); |
| 1773 | #endif /* CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY */ | 1773 | #endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */ |
| 1774 | } | 1774 | } |
| 1775 | 1775 | ||
| 1776 | /**************************************************************************** | 1776 | /**************************************************************************** |
| @@ -1788,7 +1788,7 @@ FORBIDDEN: /* protect listing /cgi-bin */ | |||
| 1788 | * $Return: (int) . . . . Always 0. | 1788 | * $Return: (int) . . . . Always 0. |
| 1789 | * | 1789 | * |
| 1790 | ****************************************************************************/ | 1790 | ****************************************************************************/ |
| 1791 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1791 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1792 | static int miniHttpd(int server) | 1792 | static int miniHttpd(int server) |
| 1793 | { | 1793 | { |
| 1794 | fd_set readfd, portfd; | 1794 | fd_set readfd, portfd; |
| @@ -1874,7 +1874,7 @@ static int miniHttpd(void) | |||
| 1874 | handleIncoming(); | 1874 | handleIncoming(); |
| 1875 | return 0; | 1875 | return 0; |
| 1876 | } | 1876 | } |
| 1877 | #endif /* CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY */ | 1877 | #endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */ |
| 1878 | 1878 | ||
| 1879 | #ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP | 1879 | #ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP |
| 1880 | static void sighup_handler(int sig) | 1880 | static void sighup_handler(int sig) |
| @@ -1899,7 +1899,7 @@ enum httpd_opts_nums { | |||
| 1899 | USE_FEATURE_HTTPD_BASIC_AUTH(r_opt_realm,) | 1899 | USE_FEATURE_HTTPD_BASIC_AUTH(r_opt_realm,) |
| 1900 | USE_FEATURE_HTTPD_AUTH_MD5(m_opt_md5,) | 1900 | USE_FEATURE_HTTPD_AUTH_MD5(m_opt_md5,) |
| 1901 | USE_FEATURE_HTTPD_SETUID(u_opt_setuid,) | 1901 | USE_FEATURE_HTTPD_SETUID(u_opt_setuid,) |
| 1902 | SKIP_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(p_opt_port,) | 1902 | USE_FEATURE_HTTPD_WITHOUT_INETD(p_opt_port,) |
| 1903 | }; | 1903 | }; |
| 1904 | 1904 | ||
| 1905 | static const char httpd_opts[]="c:d:h:" | 1905 | static const char httpd_opts[]="c:d:h:" |
| @@ -1907,7 +1907,7 @@ static const char httpd_opts[]="c:d:h:" | |||
| 1907 | USE_FEATURE_HTTPD_BASIC_AUTH("r:") | 1907 | USE_FEATURE_HTTPD_BASIC_AUTH("r:") |
| 1908 | USE_FEATURE_HTTPD_AUTH_MD5("m:") | 1908 | USE_FEATURE_HTTPD_AUTH_MD5("m:") |
| 1909 | USE_FEATURE_HTTPD_SETUID("u:") | 1909 | USE_FEATURE_HTTPD_SETUID("u:") |
| 1910 | SKIP_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY("p:"); | 1910 | USE_FEATURE_HTTPD_WITHOUT_INETD("p:"); |
| 1911 | 1911 | ||
| 1912 | #define OPT_CONFIG_FILE (1<<c_opt_config_file) | 1912 | #define OPT_CONFIG_FILE (1<<c_opt_config_file) |
| 1913 | #define OPT_DECODE_URL (1<<d_opt_decode_url) | 1913 | #define OPT_DECODE_URL (1<<d_opt_decode_url) |
| @@ -1925,8 +1925,8 @@ static const char httpd_opts[]="c:d:h:" | |||
| 1925 | #define OPT_SETUID USE_FEATURE_HTTPD_SETUID((1<<u_opt_setuid)) \ | 1925 | #define OPT_SETUID USE_FEATURE_HTTPD_SETUID((1<<u_opt_setuid)) \ |
| 1926 | SKIP_FEATURE_HTTPD_SETUID(0) | 1926 | SKIP_FEATURE_HTTPD_SETUID(0) |
| 1927 | 1927 | ||
| 1928 | #define OPT_PORT SKIP_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY((1<<p_opt_port)) \ | 1928 | #define OPT_PORT USE_FEATURE_HTTPD_WITHOUT_INETD((1<<p_opt_port)) \ |
| 1929 | USE_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(0) | 1929 | SKIP_FEATURE_HTTPD_WITHOUT_INETD(0) |
| 1930 | 1930 | ||
| 1931 | 1931 | ||
| 1932 | int httpd_main(int argc, char *argv[]) | 1932 | int httpd_main(int argc, char *argv[]) |
| @@ -1935,8 +1935,8 @@ int httpd_main(int argc, char *argv[]) | |||
| 1935 | const char *home_httpd = home; | 1935 | const char *home_httpd = home; |
| 1936 | char *url_for_decode; | 1936 | char *url_for_decode; |
| 1937 | USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;) | 1937 | USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;) |
| 1938 | SKIP_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(const char *s_port;) | 1938 | USE_FEATURE_HTTPD_WITHOUT_INETD(const char *s_port;) |
| 1939 | SKIP_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(int server;) | 1939 | USE_FEATURE_HTTPD_WITHOUT_INETD(int server;) |
| 1940 | 1940 | ||
| 1941 | USE_FEATURE_HTTPD_SETUID(const char *s_uid;) | 1941 | USE_FEATURE_HTTPD_SETUID(const char *s_uid;) |
| 1942 | USE_FEATURE_HTTPD_SETUID(long uid = -1;) | 1942 | USE_FEATURE_HTTPD_SETUID(long uid = -1;) |
| @@ -1948,7 +1948,7 @@ int httpd_main(int argc, char *argv[]) | |||
| 1948 | config->realm = "Web Server Authentication"; | 1948 | config->realm = "Web Server Authentication"; |
| 1949 | #endif | 1949 | #endif |
| 1950 | 1950 | ||
| 1951 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1951 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1952 | config->port = 80; | 1952 | config->port = 80; |
| 1953 | #endif | 1953 | #endif |
| 1954 | 1954 | ||
| @@ -1960,7 +1960,7 @@ int httpd_main(int argc, char *argv[]) | |||
| 1960 | USE_FEATURE_HTTPD_BASIC_AUTH(, &(config->realm)) | 1960 | USE_FEATURE_HTTPD_BASIC_AUTH(, &(config->realm)) |
| 1961 | USE_FEATURE_HTTPD_AUTH_MD5(, &pass) | 1961 | USE_FEATURE_HTTPD_AUTH_MD5(, &pass) |
| 1962 | USE_FEATURE_HTTPD_SETUID(, &s_uid) | 1962 | USE_FEATURE_HTTPD_SETUID(, &s_uid) |
| 1963 | SKIP_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY(, &s_port) | 1963 | USE_FEATURE_HTTPD_WITHOUT_INETD(, &s_port) |
| 1964 | ); | 1964 | ); |
| 1965 | 1965 | ||
| 1966 | if(opt & OPT_DECODE_URL) { | 1966 | if(opt & OPT_DECODE_URL) { |
| @@ -1979,7 +1979,7 @@ int httpd_main(int argc, char *argv[]) | |||
| 1979 | return 0; | 1979 | return 0; |
| 1980 | } | 1980 | } |
| 1981 | #endif | 1981 | #endif |
| 1982 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1982 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 1983 | if(opt & OPT_PORT) | 1983 | if(opt & OPT_PORT) |
| 1984 | config->port = bb_xgetlarg(s_port, 10, 1, 0xffff); | 1984 | config->port = bb_xgetlarg(s_port, 10, 1, 0xffff); |
| 1985 | #ifdef CONFIG_FEATURE_HTTPD_SETUID | 1985 | #ifdef CONFIG_FEATURE_HTTPD_SETUID |
| @@ -1996,7 +1996,7 @@ int httpd_main(int argc, char *argv[]) | |||
| 1996 | #endif | 1996 | #endif |
| 1997 | 1997 | ||
| 1998 | bb_xchdir(home_httpd); | 1998 | bb_xchdir(home_httpd); |
| 1999 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 1999 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 2000 | server = openServer(); | 2000 | server = openServer(); |
| 2001 | # ifdef CONFIG_FEATURE_HTTPD_SETUID | 2001 | # ifdef CONFIG_FEATURE_HTTPD_SETUID |
| 2002 | /* drop privileges */ | 2002 | /* drop privileges */ |
| @@ -2014,7 +2014,7 @@ int httpd_main(int argc, char *argv[]) | |||
| 2014 | clearenv(); | 2014 | clearenv(); |
| 2015 | if(p) | 2015 | if(p) |
| 2016 | setenv("PATH", p, 1); | 2016 | setenv("PATH", p, 1); |
| 2017 | # ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 2017 | # ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 2018 | addEnvPort("SERVER"); | 2018 | addEnvPort("SERVER"); |
| 2019 | # endif | 2019 | # endif |
| 2020 | } | 2020 | } |
| @@ -2026,7 +2026,7 @@ int httpd_main(int argc, char *argv[]) | |||
| 2026 | parse_conf(default_path_httpd_conf, FIRST_PARSE); | 2026 | parse_conf(default_path_httpd_conf, FIRST_PARSE); |
| 2027 | #endif | 2027 | #endif |
| 2028 | 2028 | ||
| 2029 | #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY | 2029 | #ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD |
| 2030 | # if !DEBUG | 2030 | # if !DEBUG |
| 2031 | bb_xdaemon(1, 0); /* don`t change curent directory */ | 2031 | bb_xdaemon(1, 0); /* don`t change curent directory */ |
| 2032 | # endif | 2032 | # endif |
