1
0
mirror of https://github.com/InfrastructureServices/vsftpd.git synced 2025-04-19 01:24:02 +03:00
vsftpd/tcpwrap.c
Ondřej Lysoněk ee6af258e8 Log die() calls to syslog
Pass messages given to die(), die2() and bug() to syslog. Currently this
functionality requires waiting for a short amount of time (1 second is
used) after logging the message and before exiting. This is a workaround
for the following systemd bug:
https://github.com/systemd/systemd/issues/2913

The need for this workaround is the main reason why I decided not to
enable this functionality by default.

Resolves: rhbz#1318198
Resolves: rhbz#1582672
2018-06-18 13:39:13 +02:00

51 lines
849 B
C

/*
* Part of Very Secure FTPd
* Licence: GPL v2
* Author: Chris Evans
* tcpwrap.c
*
* Routines to encapsulate the usage of tcp_wrappers.
*/
#include "tcpwrap.h"
#include "builddefs.h"
#include "utility.h"
#include "sysutil.h"
#ifdef VSF_BUILD_TCPWRAPPERS
#include <tcpd.h>
#endif
#ifdef VSF_BUILD_TCPWRAPPERS
#include <sys/syslog.h>
int deny_severity = LOG_WARNING;
int allow_severity = LOG_INFO;
int
vsf_tcp_wrapper_ok(int remote_fd)
{
struct request_info req;
request_init(&req, RQ_DAEMON, "vsftpd", RQ_FILE, remote_fd, 0);
fromhost(&req);
if (!hosts_access(&req))
{
return 0;
}
return 1;
}
#else /* VSF_BUILD_TCPWRAPPERS */
int
vsf_tcp_wrapper_ok(int remote_fd)
{
(void) remote_fd;
die("tcp_wrappers is set to YES but no tcp wrapper support compiled in");
return 0;
}
#endif /* VSF_BUILD_TCPWRAPPERS */