summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
Diffstat (limited to 'networking')
-rw-r--r--networking/inetd.c4
-rw-r--r--networking/isrv_identd.c19
2 files changed, 14 insertions, 9 deletions
diff --git a/networking/inetd.c b/networking/inetd.c
index fd2c88a6b..01f38ad60 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1292,9 +1292,9 @@ inetd_main(int argc, char *argv[])
1292 /* reexec for vfork() do continue parent */ 1292 /* reexec for vfork() do continue parent */
1293 vfork_daemon_rexec(0, 0, argc, argv, "-f"); 1293 vfork_daemon_rexec(0, 0, argc, argv, "-f");
1294 } 1294 }
1295 bb_sanitize_stdio(0); 1295 bb_sanitize_server_stdio(0);
1296#else 1296#else
1297 bb_sanitize_stdio(!(opt & 2)); 1297 bb_sanitize_server_stdio(!(opt & 2));
1298#endif 1298#endif
1299 openlog(applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON); 1299 openlog(applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
1300 logmode = LOGMODE_SYSLOG; 1300 logmode = LOGMODE_SYSLOG;
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index 0279fc0bb..e757d7c29 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -65,6 +65,7 @@ static int do_rd(int fd, void **paramp)
65 goto ok; 65 goto ok;
66 /* Terminate session. If we are in server mode, then 66 /* Terminate session. If we are in server mode, then
67 * fd is still in nonblocking mode - we never block here */ 67 * fd is still in nonblocking mode - we never block here */
68 if (fd == 0) fd++; /* inetd mode? then write to fd 1 */
68 fdprintf(fd, "%s : USERID : UNIX : %s\r\n", buf->buf, bogouser); 69 fdprintf(fd, "%s : USERID : UNIX : %s\r\n", buf->buf, bogouser);
69 term: 70 term:
70 free(buf); 71 free(buf);
@@ -97,7 +98,7 @@ int fakeidentd_main(int argc, char **argv)
97 OPT_foreground = 0x1, 98 OPT_foreground = 0x1,
98 OPT_inetd = 0x2, 99 OPT_inetd = 0x2,
99 OPT_inetdwait = 0x4, 100 OPT_inetdwait = 0x4,
100 OPT_nodeamon = 0x7, 101 OPT_fiw = 0x7,
101 OPT_bindaddr = 0x8, 102 OPT_bindaddr = 0x8,
102 }; 103 };
103 104
@@ -109,9 +110,14 @@ int fakeidentd_main(int argc, char **argv)
109 if (optind < argc) 110 if (optind < argc)
110 bogouser = argv[optind]; 111 bogouser = argv[optind];
111 112
112 /* Daemonize if no -f or -i or -w */ 113 /* Daemonize if no -f and no -i and no -w */
113 bb_sanitize_stdio(!(opt & OPT_nodeamon)); 114 bb_sanitize_server_stdio(!(opt & OPT_fiw));
114 if (!(opt & OPT_nodeamon)) { 115 /* Where to log in inetd modes? "Classic" inetd
116 * probably has its stderr /dev/null'ed (we need log to syslog?),
117 * but daemontools-like utilities usually expect that children
118 * log to stderr. I like daemontools more. Go their way.
119 * (Or maybe we need yet another option "log to syslog") */
120 if (!(opt & OPT_fiw) /* || (opt & OPT_syslog) */) {
115 openlog(applet_name, 0, LOG_DAEMON); 121 openlog(applet_name, 0, LOG_DAEMON);
116 logmode = LOGMODE_SYSLOG; 122 logmode = LOGMODE_SYSLOG;
117 } 123 }
@@ -124,9 +130,8 @@ int fakeidentd_main(int argc, char **argv)
124 /* Ignore closed connections when writing */ 130 /* Ignore closed connections when writing */
125 signal(SIGPIPE, SIG_IGN); 131 signal(SIGPIPE, SIG_IGN);
126 132
127 if (opt & OPT_inetdwait) { 133 fd = 0;
128 fd = 0; 134 if (!(opt & OPT_inetdwait)) {
129 } else {
130 fd = create_and_bind_stream_or_die(bind_address, 135 fd = create_and_bind_stream_or_die(bind_address,
131 bb_lookup_port("identd", "tcp", 113)); 136 bb_lookup_port("identd", "tcp", 113));
132 xlisten(fd, 5); 137 xlisten(fd, 5);