When we're watching multiple sockets, we don't want to just close
the active one we got a connection on before launching the shoveler.
If we want to restart the daemon, we run into problems because the
socket is still in use. Instead, close all the sockets we were
listening on.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Use libcap for saving CAP_NET_ADMIN (if --transparent is given) over a
setuid(). We don’t need CAP_NET_BIND_SERVICE as the listening sockets
are established before dropping root.
The current asprintf usage triggers many warnings like:
sslh-main.c: In function 'print_usage':
sslh-main.c:86:17: warning: ignoring return value of 'asprintf',
declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This func takes an int, not a long. The current code triggers a warning:
sslh-main.c: In function 'config_parse':
sslh-main.c:275:5: warning: passing argument 3 of 'config_lookup_int' from incompatible pointer type [enabled by default]
if (config_lookup_int(&config, "timeout", &timeout) == CONFIG_TRUE) {
^
In file included from sslh-main.c:26:0:
/usr/include/libconfig.h:266:12: note: expected 'int *' but argument is of type 'long int *'
extern LIBCONFIG_API int config_lookup_int(const config_t *config,
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This code doesn't respect CPPFLAGS at all. Fix that and move the
existing -D flags to the right variable.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
We need these flags to come before all the objects, not after.
Otherwise, flags that impact handling of input objects do not
show up in time.
This also matches standard build system behavior (e.g. autotools).
Signed-off-by: Mike Frysinger <vapier@gentoo.org>