? source/Debug
? source/FileZilla server.aps
? source/FileZilla server.clw
? source/FileZilla server.ncb
? source/FileZilla server.opt
? source/FileZilla server.plg
? source/Release
Index: source/ControlSocket.cpp
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/ControlSocket.cpp,v
retrieving revision 1.10
diff -u -r1.10 ControlSocket.cpp
--- source/ControlSocket.cpp	23 Nov 2001 22:09:30 -0000	1.10
+++ source/ControlSocket.cpp	7 Mar 2002 07:58:02 -0000
@@ -372,8 +372,37 @@
 				m_transferstatus.socket=0;
 			}
 			m_transferstatus.socket=new CTransferSocket;
-			if (!m_transferstatus.socket->Create())
-			{
+			unsigned int port = 0;
+			CString ip;
+			unsigned int retries = 3;
+			while (retries > 0) {
+				if (COptions::GetOptionVal(OPTION_CUSTOMPASVENABLE)) {
+					static UINT customPort = 0;
+					unsigned int minPort = COptions::GetOptionVal(OPTION_CUSTOMPASVMINPORT);
+					unsigned int maxPort = COptions::GetOptionVal(OPTION_CUSTOMPASVMAXPORT);
+					if (minPort > maxPort) {
+						unsigned int temp = minPort;
+						minPort = maxPort;
+						maxPort = temp;
+					}
+					if (customPort < minPort || customPort > maxPort) {
+						customPort = minPort;
+					}
+					port = customPort;
+					ip = COptions::GetOption(OPTION_CUSTOMPASVIP);
+					++customPort;
+				} else {
+					//Get the ip of the control socket
+					unsigned int junkPort;
+					GetSockName(ip,junkPort);
+				}
+				if (m_transferstatus.socket->Create(port))
+				{
+					break;
+				}
+				--retries;
+			}
+			if (retries <= 0) {
 				delete m_transferstatus.socket;
 				m_transferstatus.socket=0;
 				Send("421 Can't create socket");
@@ -381,10 +410,7 @@
 			}
 			m_transferstatus.socket->Listen();
 			m_transferstatus.socket->AsyncSelect();
-			CString ip,tmp;
-			unsigned int port;
-			//Get the ip of the control socket (the newly created socket would only return 127.0.0.1)
-			GetSockName(ip,port);
+			CString tmp;
 			//Now retrieve the port
 			m_transferstatus.socket->GetSockName(tmp,port);
 			//Reformat the ip
Index: source/FileZilla server.rc
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/FileZilla server.rc,v
retrieving revision 1.8
diff -u -r1.8 FileZilla server.rc
--- source/FileZilla server.rc	26 Nov 2001 15:45:16 -0000	1.8
+++ source/FileZilla server.rc	7 Mar 2002 07:58:02 -0000
@@ -13,7 +13,7 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// Deutsch (Deutschland) resources
+// German (Germany) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
 #ifdef _WIN32
@@ -337,13 +337,28 @@
                     IDC_STATIC,13,178,259,16
 END
 
-IDD_OPTIONS_MISC DIALOG DISCARDABLE  0, 0, 286, 208
+IDD_OPTIONS_MISC DIALOGEX 0, 0, 286, 208
 STYLE DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif"
 BEGIN
     CONTROL         "Don't show &passwords in message log",
                     IDC_OPTIONS_MISC_DONTSHOWPASS,"Button",BS_AUTOCHECKBOX | 
                     WS_TABSTOP,7,7,135,10
+    GROUPBOX        "Custom PASV settings",IDC_STATIC,7,21,272,63
+    CONTROL         "Enable custom PASV settings",
+                    IDC_OPTIONS_MISC_CUSTOM_PASV,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,13,33,109,10
+    LTEXT           "IP Address",IDC_STATIC,13,52,35,8
+    EDITTEXT        IDC_CUSTOM_PASV_IP,53,48,68,14,ES_AUTOHSCROLL
+    LTEXT           "---.---.---.---",IDC_STATIC,125,51,31,8
+    LTEXT           "Port range",IDC_STATIC,13,70,34,8
+    CTEXT           "-",IDC_STATIC,83,68,8,8
+    EDITTEXT        IDC_CUSTOM_PASV_MIN_PORT,53,66,27,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_CUSTOM_PASV_MAX_PORT,94,66,27,14,ES_AUTOHSCROLL
+    LTEXT           "(1-65535)",IDC_STATIC,126,69,31,8
+    EDITTEXT        IDC_CUSTOM_PASV_TEXT,160,27,113,54,ES_MULTILINE | 
+                    ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | WS_VSCROLL,
+                    WS_EX_STATICEDGE
 END
 
 
@@ -585,12 +600,17 @@
     ID_LOCK                 "Lock server, no new connections will be accepted"
 END
 
-#endif    // Deutsch (Deutschland) resources
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDC_CUSTOM_PASV_TEXT    "Use custom PASV settings if you are operating the server from behind a NAT router or a firewall. In that case, the IP address of the server is not accessible from outside of the router, so you should fill in the correct address here. Use the port range to limit the number of ports that will need to be forwarded through the router."
+END
+
+#endif    // German (Germany) resources
 /////////////////////////////////////////////////////////////////////////////
 
 
 /////////////////////////////////////////////////////////////////////////////
-// Englisch (USA) resources
+// English (U.S.) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
@@ -657,7 +677,7 @@
 END
 #endif    // APSTUDIO_INVOKED
 
-#endif    // Englisch (USA) resources
+#endif    // English (U.S.) resources
 /////////////////////////////////////////////////////////////////////////////
 
 
Index: source/Options.cpp
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/Options.cpp,v
retrieving revision 1.2
diff -u -r1.2 Options.cpp
--- source/Options.cpp	14 Nov 2001 16:52:38 -0000	1.2
+++ source/Options.cpp	7 Mar 2002 07:58:02 -0000
@@ -62,6 +62,10 @@
 	m_OptionsSecurityPage.m_bOutFxpStrict=GetOptionVal(OPTION_NOOUTFXPSTRICT);
 
 	m_OptionsMiscPage.m_bDontShowPass=GetOptionVal(OPTION_LOGSHOWPASS)?FALSE:TRUE;
+	m_OptionsMiscPage.m_bEnableCustomPASV=GetOptionVal(OPTION_CUSTOMPASVENABLE)?TRUE:FALSE;
+	m_OptionsMiscPage.m_sCustomPASVString=GetOption(OPTION_CUSTOMPASVIP);
+	m_OptionsMiscPage.m_sCustomPASVMinPort=GetOptionVal(OPTION_CUSTOMPASVMINPORT);
+	m_OptionsMiscPage.m_sCustomPASVMaxPort=GetOptionVal(OPTION_CUSTOMPASVMAXPORT);
 
 	DoModal();
 
@@ -78,6 +82,10 @@
 	SetOption(OPTION_NOOUTFXPSTRICT,m_OptionsSecurityPage.m_bOutFxpStrict);
 
 	SetOption(OPTION_LOGSHOWPASS,m_OptionsMiscPage.m_bDontShowPass?0:1);
+	SetOption(OPTION_CUSTOMPASVENABLE,m_OptionsMiscPage.m_bEnableCustomPASV?1:0);
+	SetOption(OPTION_CUSTOMPASVIP,m_OptionsMiscPage.m_sCustomPASVString);
+	SetOption(OPTION_CUSTOMPASVMINPORT,m_OptionsMiscPage.m_sCustomPASVMinPort);
+	SetOption(OPTION_CUSTOMPASVMAXPORT,m_OptionsMiscPage.m_sCustomPASVMaxPort);
 }
 
 BOOL COptions::OnInitDialog() 
@@ -90,7 +98,8 @@
 
 char keyname[][30]={"Serverport",		  "Number of Threads", "Maximum user count","Timeout",
 					"No Transfer Timeout","Allow Incoming FXP","Allow outgoing FXP","No Strict In Fxp",
-					"No Strict Out Fxp",  "Login Timeout",     "Show Pass in log"};
+					"No Strict Out Fxp",  "Login Timeout",     "Show Pass in log",
+					"Custom PASV Enable", "Custom PASV IP", "Custom PASV min port", "Custom PASV max port" };
 
 void COptions::SetOption(int OptionID,int value)
 {
Index: source/Options.h
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/Options.h,v
retrieving revision 1.2
diff -u -r1.2 Options.h
--- source/Options.h	14 Nov 2001 16:52:38 -0000	1.2
+++ source/Options.h	7 Mar 2002 07:58:02 -0000
@@ -68,6 +68,10 @@
 #define OPTION_NOOUTFXPSTRICT 9
 #define OPTION_LOGINTIMEOUT 10
 #define OPTION_LOGSHOWPASS 11
+#define OPTION_CUSTOMPASVENABLE 12
+#define OPTION_CUSTOMPASVIP 13
+#define OPTION_CUSTOMPASVMINPORT 14
+#define OPTION_CUSTOMPASVMAXPORT 15
 
 
 //{{AFX_INSERT_LOCATION}}
Index: source/OptionsMiscPage.cpp
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/OptionsMiscPage.cpp,v
retrieving revision 1.1
diff -u -r1.1 OptionsMiscPage.cpp
--- source/OptionsMiscPage.cpp	1 Mar 2002 08:37:30 -0000	1.1
+++ source/OptionsMiscPage.cpp	7 Mar 2002 07:58:02 -0000
@@ -21,6 +21,11 @@
 	//{{AFX_DATA_INIT(COptionsMisc)
 	m_bDontShowPass = FALSE;
 	//}}AFX_DATA_INIT
+	m_bEnableCustomPASV = FALSE;
+	m_sCustomPASVString = "";
+	m_sCustomPASVMinPort = 1024;
+	m_sCustomPASVMaxPort = 65535;
+	m_sCustomPASVHelp = CString((LPCTSTR)IDC_CUSTOM_PASV_TEXT);
 }
 
 
@@ -30,6 +35,11 @@
 	//{{AFX_DATA_MAP(COptionsMiscPage)
 	DDX_Check(pDX, IDC_OPTIONS_MISC_DONTSHOWPASS, m_bDontShowPass);
 	//}}AFX_DATA_MAP
+	DDX_Check(pDX, IDC_OPTIONS_MISC_CUSTOM_PASV, m_bEnableCustomPASV);
+	DDX_Text(pDX, IDC_CUSTOM_PASV_IP, m_sCustomPASVString);
+	DDX_Text(pDX, IDC_CUSTOM_PASV_MIN_PORT, m_sCustomPASVMinPort);
+	DDX_Text(pDX, IDC_CUSTOM_PASV_MAX_PORT, m_sCustomPASVMaxPort);
+	DDX_Text(pDX, IDC_CUSTOM_PASV_TEXT, m_sCustomPASVHelp);
 }
 
 
Index: source/OptionsMiscPage.h
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/OptionsMiscPage.h,v
retrieving revision 1.1
diff -u -r1.1 OptionsMiscPage.h
--- source/OptionsMiscPage.h	1 Mar 2002 08:37:30 -0000	1.1
+++ source/OptionsMiscPage.h	7 Mar 2002 07:58:02 -0000
@@ -21,6 +21,12 @@
 	enum { IDD = IDD_OPTIONS_MISC };
 	BOOL	m_bDontShowPass;
 	//}}AFX_DATA
+	BOOL m_bEnableCustomPASV;
+	CString m_sCustomPASVString;
+	UINT m_sCustomPASVMinPort;
+	UINT m_sCustomPASVMaxPort;
+	CString m_sCustomPASVHelp;
+
 
 
 // Überschreibungen
Index: source/resource.h
===================================================================
RCS file: /cvsroot/filezilla/FileZilla Server/source/resource.h,v
retrieving revision 1.5
diff -u -r1.5 resource.h
--- source/resource.h	22 Nov 2001 18:21:29 -0000	1.5
+++ source/resource.h	7 Mar 2002 07:58:02 -0000
@@ -54,6 +54,7 @@
 #define IDC_PORT                        1023
 #define IDC_MAXUSERS                    1024
 #define IDC_THREADNUM                   1025
+#define IDC_CUSTOM_PASV_MAX_PORT        1025
 #define IDC_MAXUSERBYPASS               1026
 #define IDC_MAXCONNCOUNT                1027
 #define IDC_IPLIMIT                     1028
@@ -71,6 +72,10 @@
 #define IDC_MAIL                        1039
 #define IDC_HOMEPAGE                    1040
 #define IDC_OPTIONS_MISC_DONTSHOWPASS   1041
+#define IDC_OPTIONS_MISC_CUSTOM_PASV    1042
+#define IDC_CUSTOM_PASV_IP              1043
+#define IDC_CUSTOM_PASV_MIN_PORT        1044
+#define IDC_CUSTOM_PASV_TEXT            1045
 #define ID_OUTPUTCONTEXT_CLEARALL       32770
 #define ID_USERMENU_ADD                 32771
 #define ID_TRAY_RESTORE                 32771
@@ -103,7 +108,7 @@
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        143
 #define _APS_NEXT_COMMAND_VALUE         32785
-#define _APS_NEXT_CONTROL_VALUE         1042
+#define _APS_NEXT_CONTROL_VALUE         1046
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

 	  	 
