Update and clean Tomato RAF files
[tomato.git] / release / src / router / vsftpd / tcpwrap.c
blob5bf57d39c99c692805e259cb16def4e9a4197416
1 /*
2 * Part of Very Secure FTPd
3 * Licence: GPL v2
4 * Author: Chris Evans
5 * tcpwrap.c
7 * Routines to encapsulate the usage of tcp_wrappers.
8 */
10 #include "tcpwrap.h"
11 #include "builddefs.h"
12 #include "utility.h"
13 #include "sysutil.h"
15 #ifdef VSF_BUILD_TCPWRAPPERS
16 #include <tcpd.h>
17 #endif
19 #ifdef VSF_BUILD_TCPWRAPPERS
21 #include <sys/syslog.h>
23 int deny_severity = LOG_WARNING;
24 int allow_severity = LOG_INFO;
26 int
27 vsf_tcp_wrapper_ok(int remote_fd)
29 struct request_info req;
30 vsf_sysutil_openlog(0);
31 request_init(&req, RQ_DAEMON, "vsftpd", RQ_FILE, remote_fd, 0);
32 fromhost(&req);
33 if (!hosts_access(&req))
35 vsf_sysutil_closelog();
36 return 0;
38 vsf_sysutil_closelog();
39 return 1;
42 #else /* VSF_BUILD_TCPWRAPPERS */
44 int
45 vsf_tcp_wrapper_ok(int remote_fd)
47 (void) remote_fd;
48 die("tcp_wrappers is set to YES but no tcp wrapper support compiled in");
49 return 0;
52 #endif /* VSF_BUILD_TCPWRAPPERS */