]> The Tcpdump Group git mirrors - libpcap/commit
Move the SSL setup and host/port list checking to daemon_serviceloop().
authorGuy Harris <[email protected]>
Tue, 8 Jan 2019 05:21:20 +0000 (21:21 -0800)
committerGuy Harris <[email protected]>
Tue, 8 Jan 2019 05:21:20 +0000 (21:21 -0800)
commit941280a5cd6aefafa79ff4dd032c4467a42c1fd1
tree8111ebfb42748bc11661700b92c39504e5d424cb
parenta5f191481140b173ababa9f7dc425ef65bdab739
Move the SSL setup and host/port list checking to daemon_serviceloop().

That:

1) arranges that it's done only in one code path;

2) arranges that it not be done in the main connection-accepting
   thread/process if this isn't an inetd-style daemon;

3) means that we're doing the host/port list checking in
   inetd-style daemons - we weren't doing it before;

4) means that we're doing both of them after we've turned off
   non-blocking mode on Windows, not before - doing it before
   may cause the SSL setup and sending a host/port list check
   error not to work (as we won't block waiting for input or
   waiting for buffer space to be available for output).

Fix the file descriptor handling for inetd-style daemons while we're at
it; we should redirect the standard error to /dev/null - it's not
guaranteed to, for example, go to a daemon that reads your error
messages and logs them, and it could be going over the connection, which
would be a problem.

Close the control socket with sock_close() after daemon_serviceloop()
returns, in case shutting down the write side is necessary to have the
connection shut down cleanly.
rpcapd/daemon.c
rpcapd/daemon.h
rpcapd/rpcapd.c