Patch level : 10.0
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Aggiunto parametro in campo.ini [Server] ftp=Active Per permettere accesso a server ftp in modalità Active invece della solita Passive di default. git-svn-id: svn://10.65.10.50/branches/R_10_00@22368 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cac3c0166b
commit
03cf81559c
@ -1813,6 +1813,18 @@ long xvt_fsys_get_file_attr(const FILE_SPEC* fs, long attr)
|
||||
// File system
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
static bool xvt_sys_ftp_passive_mode(const char* server)
|
||||
{
|
||||
static char pasv = ' ';
|
||||
if (pasv <= ' ')
|
||||
{
|
||||
char str[16] = "";
|
||||
xvt_sys_get_profile_string(xvt_fsys_get_campo_ini(), "Server", "ftp", "Passive", str, sizeof(str));
|
||||
pasv = toupper(str[0]);
|
||||
}
|
||||
return pasv != 'A';
|
||||
}
|
||||
|
||||
SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
|
||||
{
|
||||
SLIST list = xvt_slist_create();
|
||||
@ -1844,6 +1856,8 @@ SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
|
||||
ftp.SetUser(strUser);
|
||||
ftp.SetPassword(strPwd);
|
||||
}
|
||||
ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost));
|
||||
|
||||
const bool bConnected = ftp.Connect(strHost);
|
||||
if (bConnected && ftp.ChDir(fnDir))
|
||||
{
|
||||
@ -1852,6 +1866,7 @@ SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
|
||||
|
||||
wxArrayString files;
|
||||
ftp.GetList(files, fnName, true);
|
||||
|
||||
for (size_t i = 0; i < files.GetCount(); i++)
|
||||
{
|
||||
const int type = files[i][0] == 'd' ? 2 : 1;
|
||||
@ -1905,17 +1920,13 @@ BOOLEAN xvt_fsys_set_dir(const DIRECTORY *dirp)
|
||||
BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest)
|
||||
{
|
||||
wxURL orig_url(orig);
|
||||
wxInputStream * input = orig_url.GetInputStream();
|
||||
|
||||
if (input == NULL && orig_url.GetScheme() == "ftp")
|
||||
if (orig_url.GetScheme() == "ftp")
|
||||
{
|
||||
wxFTP& ftp = (wxFTP&)orig_url.GetProtocol();
|
||||
ftp.SetPassive(false);
|
||||
input = orig_url.GetInputStream();
|
||||
if (input == NULL)
|
||||
return FALSE;
|
||||
ftp.SetPassive(xvt_sys_ftp_passive_mode(orig_url.GetServer()));
|
||||
}
|
||||
|
||||
wxInputStream * input = orig_url.GetInputStream();
|
||||
|
||||
wxURL dest_url(dest);
|
||||
wxOutputStream* output = NULL;
|
||||
wxString scheme = dest_url.GetScheme();
|
||||
@ -1937,7 +1948,8 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest)
|
||||
ftp.SetUser(strUser);
|
||||
ftp.SetPassword(strPwd);
|
||||
}
|
||||
|
||||
ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost));
|
||||
|
||||
if (ftp.Connect(strHost))
|
||||
if (ftp.SetBinary())
|
||||
if (ftp.ChDir(fnDir))
|
||||
@ -3777,6 +3789,7 @@ int xvt_fsys_access(const char *pathname, int mode)
|
||||
ftp.SetUser(strUser);
|
||||
ftp.SetPassword(strPwd);
|
||||
}
|
||||
ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost));
|
||||
return ftp.Connect(strHost) && ftp.ChDir(fnDir) ? 0 : EACCES;
|
||||
}
|
||||
}
|
||||
@ -3827,6 +3840,7 @@ BOOLEAN xvt_fsys_remove_file(const char *pathname)
|
||||
ftp.SetUser(strUser);
|
||||
ftp.SetPassword(strPwd);
|
||||
}
|
||||
ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost));
|
||||
|
||||
if (ftp.Connect(strHost))
|
||||
if (ftp.ChDir(fnDir))
|
||||
|
Loading…
x
Reference in New Issue
Block a user