summaryrefslogtreecommitdiff
path: root/tcpwrap.c
diff options
context:
space:
mode:
authorbeatrice <beatrice@dangofactory.net>2026-11-22 19:25:05 +0900
committerbeatrice <beatrice@dangofactory.net>2026-11-22 19:25:05 +0900
commitc7a201b58080c7a0f57b38c59e7865aa42c1d029 (patch)
treecde6146e3aada31e68594fd4f034abe90621ce34 /tcpwrap.c
downloadvsftpd-master.tar.gz
vsftpd-master.zip
Import vsftpd-3.0.5.tar.gzHEADlocal/vsftpdmaster
Diffstat (limited to 'tcpwrap.c')
-rw-r--r--tcpwrap.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/tcpwrap.c b/tcpwrap.c
new file mode 100644
index 0000000..5bf57d3
--- /dev/null
+++ b/tcpwrap.c
@@ -0,0 +1,53 @@
+/*
+ * 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;
+ vsf_sysutil_openlog(0);
+ request_init(&req, RQ_DAEMON, "vsftpd", RQ_FILE, remote_fd, 0);
+ fromhost(&req);
+ if (!hosts_access(&req))
+ {
+ vsf_sysutil_closelog();
+ return 0;
+ }
+ vsf_sysutil_closelog();
+ 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 */
+