Ticket #1444: PASVPatch.patch
File PASVPatch.patch, 10.8 KB (added by , 23 years ago) |
---|
-
source/ControlSocket.cpp
? source/Debug ? source/FileZilla server.aps ? source/FileZilla server.clw ? source/FileZilla server.ncb ? source/FileZilla server.opt ? source/FileZilla server.plg ? source/Release RCS file: /cvsroot/filezilla/FileZilla Server/source/ControlSocket.cpp,v retrieving revision 1.10 diff -u -r1.10 ControlSocket.cpp
372 372 m_transferstatus.socket=0; 373 373 } 374 374 m_transferstatus.socket=new CTransferSocket; 375 if (!m_transferstatus.socket->Create()) 376 { 375 unsigned int port = 0; 376 CString ip; 377 unsigned int retries = 3; 378 while (retries > 0) { 379 if (COptions::GetOptionVal(OPTION_CUSTOMPASVENABLE)) { 380 static UINT customPort = 0; 381 unsigned int minPort = COptions::GetOptionVal(OPTION_CUSTOMPASVMINPORT); 382 unsigned int maxPort = COptions::GetOptionVal(OPTION_CUSTOMPASVMAXPORT); 383 if (minPort > maxPort) { 384 unsigned int temp = minPort; 385 minPort = maxPort; 386 maxPort = temp; 387 } 388 if (customPort < minPort || customPort > maxPort) { 389 customPort = minPort; 390 } 391 port = customPort; 392 ip = COptions::GetOption(OPTION_CUSTOMPASVIP); 393 ++customPort; 394 } else { 395 //Get the ip of the control socket 396 unsigned int junkPort; 397 GetSockName(ip,junkPort); 398 } 399 if (m_transferstatus.socket->Create(port)) 400 { 401 break; 402 } 403 --retries; 404 } 405 if (retries <= 0) { 377 406 delete m_transferstatus.socket; 378 407 m_transferstatus.socket=0; 379 408 Send("421 Can't create socket"); … … 381 410 } 382 411 m_transferstatus.socket->Listen(); 383 412 m_transferstatus.socket->AsyncSelect(); 384 CString ip,tmp; 385 unsigned int port; 386 //Get the ip of the control socket (the newly created socket would only return 127.0.0.1) 387 GetSockName(ip,port); 413 CString tmp; 388 414 //Now retrieve the port 389 415 m_transferstatus.socket->GetSockName(tmp,port); 390 416 //Reformat the ip -
source/FileZilla
RCS file: /cvsroot/filezilla/FileZilla Server/source/FileZilla server.rc,v retrieving revision 1.8 diff -u -r1.8 FileZilla server.rc
13 13 #undef APSTUDIO_READONLY_SYMBOLS 14 14 15 15 ///////////////////////////////////////////////////////////////////////////// 16 // Deutsch (Deutschland) resources16 // German (Germany) resources 17 17 18 18 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) 19 19 #ifdef _WIN32 … … 337 337 IDC_STATIC,13,178,259,16 338 338 END 339 339 340 IDD_OPTIONS_MISC DIALOG DISCARDABLE0, 0, 286, 208340 IDD_OPTIONS_MISC DIALOGEX 0, 0, 286, 208 341 341 STYLE DS_CONTROL | WS_CHILD 342 342 FONT 8, "MS Sans Serif" 343 343 BEGIN 344 344 CONTROL "Don't show &passwords in message log", 345 345 IDC_OPTIONS_MISC_DONTSHOWPASS,"Button",BS_AUTOCHECKBOX | 346 346 WS_TABSTOP,7,7,135,10 347 GROUPBOX "Custom PASV settings",IDC_STATIC,7,21,272,63 348 CONTROL "Enable custom PASV settings", 349 IDC_OPTIONS_MISC_CUSTOM_PASV,"Button",BS_AUTOCHECKBOX | 350 WS_TABSTOP,13,33,109,10 351 LTEXT "IP Address",IDC_STATIC,13,52,35,8 352 EDITTEXT IDC_CUSTOM_PASV_IP,53,48,68,14,ES_AUTOHSCROLL 353 LTEXT "---.---.---.---",IDC_STATIC,125,51,31,8 354 LTEXT "Port range",IDC_STATIC,13,70,34,8 355 CTEXT "-",IDC_STATIC,83,68,8,8 356 EDITTEXT IDC_CUSTOM_PASV_MIN_PORT,53,66,27,14,ES_AUTOHSCROLL 357 EDITTEXT IDC_CUSTOM_PASV_MAX_PORT,94,66,27,14,ES_AUTOHSCROLL 358 LTEXT "(1-65535)",IDC_STATIC,126,69,31,8 359 EDITTEXT IDC_CUSTOM_PASV_TEXT,160,27,113,54,ES_MULTILINE | 360 ES_READONLY | ES_WANTRETURN | NOT WS_BORDER | WS_VSCROLL, 361 WS_EX_STATICEDGE 347 362 END 348 363 349 364 … … 585 600 ID_LOCK "Lock server, no new connections will be accepted" 586 601 END 587 602 588 #endif // Deutsch (Deutschland) resources 603 STRINGTABLE DISCARDABLE 604 BEGIN 605 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." 606 END 607 608 #endif // German (Germany) resources 589 609 ///////////////////////////////////////////////////////////////////////////// 590 610 591 611 592 612 ///////////////////////////////////////////////////////////////////////////// 593 // Englis ch (USA) resources613 // English (U.S.) resources 594 614 595 615 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 596 616 #ifdef _WIN32 … … 657 677 END 658 678 #endif // APSTUDIO_INVOKED 659 679 660 #endif // Englis ch (USA) resources680 #endif // English (U.S.) resources 661 681 ///////////////////////////////////////////////////////////////////////////// 662 682 663 683 -
source/Options.cpp
RCS file: /cvsroot/filezilla/FileZilla Server/source/Options.cpp,v retrieving revision 1.2 diff -u -r1.2 Options.cpp
62 62 m_OptionsSecurityPage.m_bOutFxpStrict=GetOptionVal(OPTION_NOOUTFXPSTRICT); 63 63 64 64 m_OptionsMiscPage.m_bDontShowPass=GetOptionVal(OPTION_LOGSHOWPASS)?FALSE:TRUE; 65 m_OptionsMiscPage.m_bEnableCustomPASV=GetOptionVal(OPTION_CUSTOMPASVENABLE)?TRUE:FALSE; 66 m_OptionsMiscPage.m_sCustomPASVString=GetOption(OPTION_CUSTOMPASVIP); 67 m_OptionsMiscPage.m_sCustomPASVMinPort=GetOptionVal(OPTION_CUSTOMPASVMINPORT); 68 m_OptionsMiscPage.m_sCustomPASVMaxPort=GetOptionVal(OPTION_CUSTOMPASVMAXPORT); 65 69 66 70 DoModal(); 67 71 … … 78 82 SetOption(OPTION_NOOUTFXPSTRICT,m_OptionsSecurityPage.m_bOutFxpStrict); 79 83 80 84 SetOption(OPTION_LOGSHOWPASS,m_OptionsMiscPage.m_bDontShowPass?0:1); 85 SetOption(OPTION_CUSTOMPASVENABLE,m_OptionsMiscPage.m_bEnableCustomPASV?1:0); 86 SetOption(OPTION_CUSTOMPASVIP,m_OptionsMiscPage.m_sCustomPASVString); 87 SetOption(OPTION_CUSTOMPASVMINPORT,m_OptionsMiscPage.m_sCustomPASVMinPort); 88 SetOption(OPTION_CUSTOMPASVMAXPORT,m_OptionsMiscPage.m_sCustomPASVMaxPort); 81 89 } 82 90 83 91 BOOL COptions::OnInitDialog() … … 90 98 91 99 char keyname[][30]={"Serverport", "Number of Threads", "Maximum user count","Timeout", 92 100 "No Transfer Timeout","Allow Incoming FXP","Allow outgoing FXP","No Strict In Fxp", 93 "No Strict Out Fxp", "Login Timeout", "Show Pass in log"}; 101 "No Strict Out Fxp", "Login Timeout", "Show Pass in log", 102 "Custom PASV Enable", "Custom PASV IP", "Custom PASV min port", "Custom PASV max port" }; 94 103 95 104 void COptions::SetOption(int OptionID,int value) 96 105 { -
source/Options.h
RCS file: /cvsroot/filezilla/FileZilla Server/source/Options.h,v retrieving revision 1.2 diff -u -r1.2 Options.h
68 68 #define OPTION_NOOUTFXPSTRICT 9 69 69 #define OPTION_LOGINTIMEOUT 10 70 70 #define OPTION_LOGSHOWPASS 11 71 #define OPTION_CUSTOMPASVENABLE 12 72 #define OPTION_CUSTOMPASVIP 13 73 #define OPTION_CUSTOMPASVMINPORT 14 74 #define OPTION_CUSTOMPASVMAXPORT 15 71 75 72 76 73 77 //{{AFX_INSERT_LOCATION}} -
source/OptionsMiscPage.cpp
RCS file: /cvsroot/filezilla/FileZilla Server/source/OptionsMiscPage.cpp,v retrieving revision 1.1 diff -u -r1.1 OptionsMiscPage.cpp
21 21 //{{AFX_DATA_INIT(COptionsMisc) 22 22 m_bDontShowPass = FALSE; 23 23 //}}AFX_DATA_INIT 24 m_bEnableCustomPASV = FALSE; 25 m_sCustomPASVString = ""; 26 m_sCustomPASVMinPort = 1024; 27 m_sCustomPASVMaxPort = 65535; 28 m_sCustomPASVHelp = CString((LPCTSTR)IDC_CUSTOM_PASV_TEXT); 24 29 } 25 30 26 31 … … 30 35 //{{AFX_DATA_MAP(COptionsMiscPage) 31 36 DDX_Check(pDX, IDC_OPTIONS_MISC_DONTSHOWPASS, m_bDontShowPass); 32 37 //}}AFX_DATA_MAP 38 DDX_Check(pDX, IDC_OPTIONS_MISC_CUSTOM_PASV, m_bEnableCustomPASV); 39 DDX_Text(pDX, IDC_CUSTOM_PASV_IP, m_sCustomPASVString); 40 DDX_Text(pDX, IDC_CUSTOM_PASV_MIN_PORT, m_sCustomPASVMinPort); 41 DDX_Text(pDX, IDC_CUSTOM_PASV_MAX_PORT, m_sCustomPASVMaxPort); 42 DDX_Text(pDX, IDC_CUSTOM_PASV_TEXT, m_sCustomPASVHelp); 33 43 } 34 44 35 45 -
source/OptionsMiscPage.h
RCS file: /cvsroot/filezilla/FileZilla Server/source/OptionsMiscPage.h,v retrieving revision 1.1 diff -u -r1.1 OptionsMiscPage.h
21 21 enum { IDD = IDD_OPTIONS_MISC }; 22 22 BOOL m_bDontShowPass; 23 23 //}}AFX_DATA 24 BOOL m_bEnableCustomPASV; 25 CString m_sCustomPASVString; 26 UINT m_sCustomPASVMinPort; 27 UINT m_sCustomPASVMaxPort; 28 CString m_sCustomPASVHelp; 29 24 30 25 31 26 32 // Überschreibungen -
source/resource.h
RCS file: /cvsroot/filezilla/FileZilla Server/source/resource.h,v retrieving revision 1.5 diff -u -r1.5 resource.h
54 54 #define IDC_PORT 1023 55 55 #define IDC_MAXUSERS 1024 56 56 #define IDC_THREADNUM 1025 57 #define IDC_CUSTOM_PASV_MAX_PORT 1025 57 58 #define IDC_MAXUSERBYPASS 1026 58 59 #define IDC_MAXCONNCOUNT 1027 59 60 #define IDC_IPLIMIT 1028 … … 71 72 #define IDC_MAIL 1039 72 73 #define IDC_HOMEPAGE 1040 73 74 #define IDC_OPTIONS_MISC_DONTSHOWPASS 1041 75 #define IDC_OPTIONS_MISC_CUSTOM_PASV 1042 76 #define IDC_CUSTOM_PASV_IP 1043 77 #define IDC_CUSTOM_PASV_MIN_PORT 1044 78 #define IDC_CUSTOM_PASV_TEXT 1045 74 79 #define ID_OUTPUTCONTEXT_CLEARALL 32770 75 80 #define ID_USERMENU_ADD 32771 76 81 #define ID_TRAY_RESTORE 32771 … … 103 108 #define _APS_3D_CONTROLS 1 104 109 #define _APS_NEXT_RESOURCE_VALUE 143 105 110 #define _APS_NEXT_COMMAND_VALUE 32785 106 #define _APS_NEXT_CONTROL_VALUE 104 2111 #define _APS_NEXT_CONTROL_VALUE 1046 107 112 #define _APS_NEXT_SYMED_VALUE 101 108 113 #endif 109 114 #endif