3
@@ -301,6 +301,7 @@ int bump_nofile(void);
4
struct servtab *enter(struct servtab *);
5
int matchconf(struct servtab *, struct servtab *);
6
int dg_broadcast(struct in_addr *in);
7
+void discard_stupid_environment(void);
9
#define NUMINT (sizeof(intab) / sizeof(struct inent))
10
char *CONFIG = _PATH_INETDCONF;
11
@@ -333,6 +334,7 @@ main(int argc, char *argv[], char *envp[
14
int readablen = 0, ch;
19
@@ -342,11 +344,14 @@ main(int argc, char *argv[], char *envp[
21
initsetproctitle(argc, argv, envp);
23
- while ((ch = getopt(argc, argv, "dR:")) != -1)
24
+ while ((ch = getopt(argc, argv, "dER:")) != -1)
32
case 'R': { /* invocation rate */
35
@@ -364,13 +369,17 @@ main(int argc, char *argv[], char *envp[
39
- "usage: %s [-d] [-R rate] [configuration file]\n",
40
+ "usage: %s [-dE] [-R rate] [configuration file]\n",
47
+ /* This must be called _after_ initsetproctitle and arg parsing */
49
+ discard_stupid_environment();
54
@@ -2071,3 +2080,45 @@ spawn(struct servtab *sep, int ctrl)
55
if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
59
+/* from netkit+USAGI */
61
+discard_stupid_environment(void)
63
+ static const char *const junk[] = {
64
+ /* these are prefixes */
89
+ for (i = 0; __environ[i]; i++) {
92
+ for (j = 0; junk[j]; j++)
93
+ if (!strncmp(__environ[i], junk[j], strlen(junk[j])))
96
+ __environ[k++] = __environ[i];
98
+ __environ[k] = NULL;
108
.Op Ar configuration file
110
@@ -62,6 +63,13 @@ The options are as follows:
117
+from laundering the environment. Without this option a selection of
118
+potentially harmful environent variables, including
120
+will be removed and not inherited by services.
122
Specify the maximum number of times a service can be invoked
123
in one minute; the default is 256.