mirror of
https://github.com/curl/curl.git
synced 2026-07-23 14:57:19 +03:00
parent
5357686fdf
commit
c988ec9f41
1 changed files with 17 additions and 30 deletions
|
|
@ -2911,47 +2911,34 @@ static void sftp_quote_stat(struct Curl_easy *data)
|
|||
}
|
||||
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_UIDGID;
|
||||
}
|
||||
else if(strncasecompare(cmd, "atime", 5)) {
|
||||
else if(strncasecompare(cmd, "atime", 5) ||
|
||||
strncasecompare(cmd, "mtime", 5)) {
|
||||
time_t date = Curl_getdate_capped(sshc->quote_path1);
|
||||
bool fail = FALSE;
|
||||
if(date == -1) {
|
||||
failf(data, "incorrect date format for %.*s", 5, cmd);
|
||||
fail = TRUE;
|
||||
}
|
||||
#if SIZEOF_TIME_T > 4
|
||||
else if(date > 0xffffffff) {
|
||||
failf(data, "date overflow");
|
||||
fail = TRUE; /* avoid setting a capped time */
|
||||
}
|
||||
#endif
|
||||
if(fail) {
|
||||
Curl_safefree(sshc->quote_path1);
|
||||
Curl_safefree(sshc->quote_path2);
|
||||
failf(data, "Syntax error: incorrect access date format");
|
||||
state(data, SSH_SFTP_CLOSE);
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||
return;
|
||||
}
|
||||
#if SIZEOF_TIME_T > 4
|
||||
if(date > 0xffffffff)
|
||||
; /* avoid setting a capped time */
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(strncasecompare(cmd, "atime", 5))
|
||||
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(data, SSH_SFTP_CLOSE);
|
||||
sshc->nextstate = SSH_NO_STATE;
|
||||
sshc->actualcode = CURLE_QUOTE_ERROR;
|
||||
return;
|
||||
}
|
||||
#if SIZEOF_TIME_T > 4
|
||||
if(date > 0xffffffff)
|
||||
; /* avoid setting a capped time */
|
||||
else
|
||||
#endif
|
||||
{
|
||||
else /* mtime */
|
||||
sshc->quote_attrs->mtime = (uint32_t)date;
|
||||
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
|
||||
}
|
||||
|
||||
sshc->quote_attrs->flags |= SSH_FILEXFER_ATTR_ACMODTIME;
|
||||
}
|
||||
|
||||
/* Now send the completed structure... */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue