1 /* 2 * Part of Very Secure FTPd 3 * Licence: GPL v2 4 * Author: Chris Evans 5 * tcpwrap.c 6 * 7 * Routines to encapsulate the usage of tcp_wrappers. 8 */ 9 10 #include "tcpwrap.h" 11 #include "builddefs.h" 12 #include "utility.h" 13 #include "sysutil.h" 14 15 #ifdef VSF_BUILD_TCPWRAPPERS 16 #include <tcpd.h> 17 #endif 18 19 #ifdef VSF_BUILD_TCPWRAPPERS 20 21 #include <sys/syslog.h> 22 23 int deny_severity = LOG_WARNING; 24 int allow_severity = LOG_INFO; 25 26 int vsf_tcp_wrapper_ok(int remote_fd)27vsf_tcp_wrapper_ok(int remote_fd) 28 { 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)) 34 { 35 vsf_sysutil_closelog(); 36 return 0; 37 } 38 vsf_sysutil_closelog(); 39 return 1; 40 } 41 42 #else /* VSF_BUILD_TCPWRAPPERS */ 43 44 int vsf_tcp_wrapper_ok(int remote_fd)45vsf_tcp_wrapper_ok(int remote_fd) 46 { 47 (void) remote_fd; 48 die("tcp_wrappers is set to YES but no tcp wrapper support compiled in"); 49 return 0; 50 } 51 52 #endif /* VSF_BUILD_TCPWRAPPERS */ 53 54