Родитель
88b1ca7cba
Коммит
fab5185275
|
@ -26,6 +26,10 @@ itself before sending them to the server. File names may be quoted
|
|||
shell-style to embed spaces or special characters. Following is the list of
|
||||
all supported SFTP quote commands:
|
||||
.RS
|
||||
.IP "atime date file"
|
||||
The atime command sets the last access time of the file named by the file
|
||||
operand. The <date expression> can be all sorts of date strings, see the
|
||||
\fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
|
||||
.IP "chgrp group file"
|
||||
The chgrp command sets the group ID of the file named by the file operand to
|
||||
the group ID specified by the group operand. The group operand is a decimal
|
||||
|
@ -42,6 +46,10 @@ The ln and symlink commands create a symbolic link at the target_file location
|
|||
pointing to the source_file location.
|
||||
.IP "mkdir directory_name"
|
||||
The mkdir command creates the directory named by the directory_name operand.
|
||||
.IP "mtime date file"
|
||||
The mtime command sets the last modification time of the file named by the
|
||||
file operand. The <date expression> can be all sorts of date strings, see the
|
||||
\fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
|
||||
.IP "pwd"
|
||||
The pwd command returns the absolute pathname of the current working directory.
|
||||
.IP "rename source target"
|
||||
|
|
|
@ -43,6 +43,10 @@ mandatory commands).
|
|||
|
||||
The valid SFTP commands are:
|
||||
.RS
|
||||
.IP "atime date file"
|
||||
The atime command sets the last access time of the file named by the file
|
||||
operand. The <date expression> can be all sorts of date strings, see the
|
||||
\fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
|
||||
.IP "chgrp group file"
|
||||
The chgrp command sets the group ID of the file named by the file operand to
|
||||
the group ID specified by the group operand. The group operand is a decimal
|
||||
|
@ -59,6 +63,10 @@ The ln and symlink commands create a symbolic link at the target_file location
|
|||
pointing to the source_file location.
|
||||
.IP "mkdir directory_name"
|
||||
The mkdir command creates the directory named by the directory_name operand.
|
||||
.IP "mtime date file"
|
||||
The mtime command sets the last modification time of the file named by the
|
||||
file operand. The <date expression> can be all sorts of date strings, see the
|
||||
\fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
|
||||
.IP "pwd"
|
||||
The pwd command returns the absolute pathname of the current working directory.
|
||||
.IP "rename source target"
|
||||
|
|
|
@ -2692,7 +2692,9 @@ static void sftp_quote(struct connectdata *conn)
|
|||
*/
|
||||
if(strncasecompare(cmd, "chgrp ", 6) ||
|
||||
strncasecompare(cmd, "chmod ", 6) ||
|
||||
strncasecompare(cmd, "chown ", 6)) {
|
||||
strncasecompare(cmd, "chown ", 6) ||
|
||||
strncasecompare(cmd, "atime ", 6) ||
|
||||
strncasecompare(cmd, "mtime ", 6)) {
|
||||
/* attribute change */
|
||||
|
||||
/* sshc->quote_path1 contains the mode to set */
|
||||
|
@ -2702,7 +2704,7 @@ static void sftp_quote(struct connectdata *conn)
|
|||
if(result == CURLE_OUT_OF_MEMORY)
|
||||
failf(data, "Out of memory");
|
||||
else
|
||||
failf(data, "Syntax error in chgrp/chmod/chown: "
|
||||
failf(data, "Syntax error in chgrp/chmod/chown/atime/mtime: "
|
||||
"Bad second parameter");
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
|
@ -2863,6 +2865,34 @@ static void sftp_quote_stat(struct connectdata *conn)
|
|||
}
|
||||
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID;
|
||||
}
|
||||
else if(strncasecompare(cmd, "atime", 5)) {
|
||||
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
||||
if(date == -1) {
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
Curl_safefree(sshc->quote_path2);
|
||||
failf(data, "Syntax error: incorrect access date format");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||
return;
|
||||
}
|
||||
sshc->quote_attrs->atime = (uint32_t)date;
|
||||
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
|
||||
}
|
||||
else if(strncasecompare(cmd, "mtime", 5)) {
|
||||
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
||||
if(date == -1) {
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
Curl_safefree(sshc->quote_path2);
|
||||
failf(data, "Syntax error: incorrect modification date format");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||
return;
|
||||
}
|
||||
sshc->quote_attrs->mtime = (uint32_t)date;
|
||||
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
|
||||
}
|
||||
|
||||
/* Now send the completed structure... */
|
||||
state(conn, SSH_SFTP_QUOTE_SETSTAT);
|
||||
|
|
|
@ -1390,7 +1390,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||
*/
|
||||
if(strncasecompare(cmd, "chgrp ", 6) ||
|
||||
strncasecompare(cmd, "chmod ", 6) ||
|
||||
strncasecompare(cmd, "chown ", 6) ) {
|
||||
strncasecompare(cmd, "chown ", 6) ||
|
||||
strncasecompare(cmd, "atime ", 6) ||
|
||||
strncasecompare(cmd, "mtime ", 6)) {
|
||||
/* attribute change */
|
||||
|
||||
/* sshc->quote_path1 contains the mode to set */
|
||||
|
@ -1587,6 +1589,34 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if(strncasecompare(cmd, "atime", 5)) {
|
||||
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
||||
if(date == -1) {
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
Curl_safefree(sshc->quote_path2);
|
||||
failf(data, "Syntax error: incorrect access date format");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
sshc->quote_attrs.atime = (unsigned long)date;
|
||||
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
||||
}
|
||||
else if(strncasecompare(cmd, "mtime", 5)) {
|
||||
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
||||
if(date == -1) {
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
Curl_safefree(sshc->quote_path2);
|
||||
failf(data, "Syntax error: incorrect modification date format");
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||
break;
|
||||
}
|
||||
sshc->quote_attrs.mtime = (unsigned long)date;
|
||||
sshc->quote_attrs.flags = LIBSSH2_SFTP_ATTR_ACMODTIME;
|
||||
}
|
||||
|
||||
/* Now send the completed structure... */
|
||||
state(conn, SSH_SFTP_QUOTE_SETSTAT);
|
||||
|
|
Загрузка…
Ссылка в новой задаче