ftp-proxy.c (127082) | ftp-proxy.c (130617) |
---|---|
1/* $OpenBSD: ftp-proxy.c,v 1.33 2003/08/22 21:50:34 david Exp $ */ | 1/* $OpenBSD: ftp-proxy.c,v 1.35 2004/03/14 21:51:44 dhartmei Exp $ */ |
2 3/* 4 * Copyright (c) 1996-2001 5 * Obtuse Systems Corporation. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 16 unchanged lines hidden (view full) --- 26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 33#include <sys/cdefs.h> | 2 3/* 4 * Copyright (c) 1996-2001 5 * Obtuse Systems Corporation. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 16 unchanged lines hidden (view full) --- 26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/contrib/pf/ftp-proxy/ftp-proxy.c 127082 2004-03-16 17:24:06Z obrien $"); | 34__FBSDID("$FreeBSD: head/contrib/pf/ftp-proxy/ftp-proxy.c 130617 2004-06-16 23:39:33Z mlaier $"); |
35 36/* 37 * ftp proxy, Originally based on juniper_ftp_proxy from the Obtuse 38 * Systems juniper firewall, written by Dan Boulet <danny@obtuse.com> 39 * and Bob Beck <beck@obtuse.com> 40 * 41 * This version basically passes everything through unchanged except 42 * for the PORT and the * "227 Entering Passive Mode" reply. --- 103 unchanged lines hidden (view full) --- 146char RealServerName[NI_MAXHOST]; 147char OurName[NI_MAXHOST]; 148 149char *User = "proxy"; 150char *Group; 151 152extern int Debug_Level; 153extern int Use_Rdns; | 35 36/* 37 * ftp proxy, Originally based on juniper_ftp_proxy from the Obtuse 38 * Systems juniper firewall, written by Dan Boulet <danny@obtuse.com> 39 * and Bob Beck <beck@obtuse.com> 40 * 41 * This version basically passes everything through unchanged except 42 * for the PORT and the * "227 Entering Passive Mode" reply. --- 103 unchanged lines hidden (view full) --- 146char RealServerName[NI_MAXHOST]; 147char OurName[NI_MAXHOST]; 148 149char *User = "proxy"; 150char *Group; 151 152extern int Debug_Level; 153extern int Use_Rdns; |
154extern in_addr_t Bind_Addr; |
|
154extern char *__progname; 155 156typedef enum { 157 UNKNOWN_MODE, 158 PORT_MODE, 159 PASV_MODE, 160 EPRT_MODE, 161 EPSV_MODE --- 7 unchanged lines hidden (view full) --- 169void log_control_command (char *cmd, int client); 170int new_dataconn(int server); 171void do_client_cmd(struct csiob *client, struct csiob *server); 172void do_server_reply(struct csiob *server, struct csiob *client); 173static void 174usage(void) 175{ 176 syslog(LOG_NOTICE, | 155extern char *__progname; 156 157typedef enum { 158 UNKNOWN_MODE, 159 PORT_MODE, 160 PASV_MODE, 161 EPRT_MODE, 162 EPSV_MODE --- 7 unchanged lines hidden (view full) --- 170void log_control_command (char *cmd, int client); 171int new_dataconn(int server); 172void do_client_cmd(struct csiob *client, struct csiob *server); 173void do_server_reply(struct csiob *server, struct csiob *client); 174static void 175usage(void) 176{ 177 syslog(LOG_NOTICE, |
177 "usage: %s [-AnrVw] [-D debuglevel] [-g group] %s %s", 178 __progname, "[-m minport] [-M maxport] [-t timeout]", 179 "[-u user]"); | 178 "usage: %s [-AnrVw] [-a address] [-D debuglevel [-g group]" 179 " [-M maxport] [-m minport] [-t timeout] [-u user]", __progname); |
180 exit(EX_USAGE); 181} 182 183static void 184close_client_data(void) 185{ 186 if (client_data_socket >= 0) { 187 shutdown(client_data_socket, 2); --- 783 unchanged lines hidden (view full) --- 971 socklen_t salen; 972 int one = 1; 973 long timeout_seconds = 0; 974 struct timeval tv; 975#ifdef LIBWRAP 976 int use_tcpwrapper = 0; 977#endif /* LIBWRAP */ 978 | 180 exit(EX_USAGE); 181} 182 183static void 184close_client_data(void) 185{ 186 if (client_data_socket >= 0) { 187 shutdown(client_data_socket, 2); --- 783 unchanged lines hidden (view full) --- 971 socklen_t salen; 972 int one = 1; 973 long timeout_seconds = 0; 974 struct timeval tv; 975#ifdef LIBWRAP 976 int use_tcpwrapper = 0; 977#endif /* LIBWRAP */ 978 |
979 while ((ch = getopt(argc, argv, "D:g:m:M:t:u:AnVwr")) != -1) { | 979 while ((ch = getopt(argc, argv, "a:D:g:m:M:t:u:AnVwr")) != -1) { |
980 char *p; 981 switch (ch) { | 980 char *p; 981 switch (ch) { |
982 case 'a': 983 if (!*optarg) 984 usage(); 985 if ((Bind_Addr = inet_addr(optarg)) == INADDR_NONE) { 986 syslog(LOG_NOTICE, 987 "%s: invalid address", optarg); 988 usage(); 989 } 990 break; |
|
982 case 'A': 983 AnonFtpOnly = 1; /* restrict to anon usernames only */ 984 break; 985 case 'D': 986 Debug_Level = strtol(optarg, &p, 10); 987 if (!*optarg || *p) 988 usage(); 989 break; --- 334 unchanged lines hidden --- | 991 case 'A': 992 AnonFtpOnly = 1; /* restrict to anon usernames only */ 993 break; 994 case 'D': 995 Debug_Level = strtol(optarg, &p, 10); 996 if (!*optarg || *p) 997 usage(); 998 break; --- 334 unchanged lines hidden --- |