Work around BeOS ftpd (sets 640) + robinhood (doesn't like 640) by adding Chmod() support.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23298 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -245,6 +245,8 @@ FtpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
_GetReply(replyString, code, codeType);
|
_GetReply(replyString, code, codeType);
|
||||||
rc = codeType <= 2;
|
rc = codeType <= 2;
|
||||||
|
// at least BeOS' ftpd forces 640 which RobinHood doesn't like...
|
||||||
|
Chmod(remote, "644");
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -357,6 +359,31 @@ FtpClient::MoveFile(const string& oldPath, const string& newPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
FtpClient::Chmod(const string& path, const string& mod)
|
||||||
|
{
|
||||||
|
bool rc = false;
|
||||||
|
int code, codeType;
|
||||||
|
string cmd = "SITE CHMOD ", replyString;
|
||||||
|
|
||||||
|
cmd += mod;
|
||||||
|
cmd += " ";
|
||||||
|
cmd += path;
|
||||||
|
|
||||||
|
if (path.length() == 0)
|
||||||
|
cmd += '/';
|
||||||
|
printf("cmd: '%s'\n", cmd.c_str());
|
||||||
|
if (_SendRequest(cmd) == true) {
|
||||||
|
if (_GetReply(replyString, code, codeType) == true) {
|
||||||
|
printf("reply: %d, %d\n", code, codeType);
|
||||||
|
if (codeType == 2)
|
||||||
|
rc = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FtpClient::SetPassive(bool on)
|
FtpClient::SetPassive(bool on)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class FtpClient {
|
|||||||
bool ChangeDir(const string& dir);
|
bool ChangeDir(const string& dir);
|
||||||
bool PrintWorkingDir(string& dir);
|
bool PrintWorkingDir(string& dir);
|
||||||
bool ListDirContents(string& listing);
|
bool ListDirContents(string& listing);
|
||||||
|
bool Chmod(const string& path, const string& mod);
|
||||||
|
|
||||||
void SetPassive(bool on);
|
void SetPassive(bool on);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user