1
0
mirror of https://github.com/danog/phpseclib.git synced 2025-01-22 04:51:19 +01:00

Merge branch '3.0'

This commit is contained in:
terrafrost 2020-02-10 21:26:55 -06:00
commit 562371a0ec

View File

@ -1012,7 +1012,6 @@ class SFTP extends SSH2
return $order === SORT_DESC ? -$result : $result; return $order === SORT_DESC ? -$result : $result;
} }
break; break;
case 'permissions':
case 'mode': case 'mode':
$a[$sort]&= 07777; $a[$sort]&= 07777;
$b[$sort]&= 07777; $b[$sort]&= 07777;
@ -1477,7 +1476,7 @@ class SFTP extends SSH2
switch ($this->packet_type) { switch ($this->packet_type) {
case NET_SFTP_ATTRS: case NET_SFTP_ATTRS:
$attrs = $this->parseAttributes($response); $attrs = $this->parseAttributes($response);
return $attrs['permissions']; return $attrs['mode'];
case NET_SFTP_STATUS: case NET_SFTP_STATUS:
$this->logError($response); $this->logError($response);
return false; return false;
@ -2493,7 +2492,7 @@ class SFTP extends SSH2
*/ */
public function fileperms($path) public function fileperms($path)
{ {
return $this->get_stat_cache_prop($path, 'permissions'); return $this->get_stat_cache_prop($path, 'mode');
} }
/** /**
@ -2684,7 +2683,7 @@ class SFTP extends SSH2
* @return array * @return array
* @access private * @access private
*/ */
private function parseAttributes(&$response) protected function parseAttributes(&$response)
{ {
$attr = []; $attr = [];
list($flags) = Strings::unpackSSH2('N', $response); list($flags) = Strings::unpackSSH2('N', $response);
@ -2707,11 +2706,8 @@ class SFTP extends SSH2
list($attr['uid'], $attr['gid']) = Strings::unpackSSH2('NN', $response); list($attr['uid'], $attr['gid']) = Strings::unpackSSH2('NN', $response);
break; break;
case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004 case NET_SFTP_ATTR_PERMISSIONS: // 0x00000004
list($attr['permissions']) = Strings::unpackSSH2('N', $response); list($attr['mode']) = Strings::unpackSSH2('N', $response);
// mode == permissions; permissions was the original array key and is retained for bc purposes. $fileType = $this->parseMode($attr['mode']);
// mode was added because that's the more industry standard terminology
$attr+= ['mode' => $attr['permissions']];
$fileType = $this->parseMode($attr['permissions']);
if ($fileType !== false) { if ($fileType !== false) {
$attr+= ['type' => $fileType]; $attr+= ['type' => $fileType];
} }
@ -2958,7 +2954,7 @@ class SFTP extends SSH2
'packet_type' => $this->packet_type, 'packet_type' => $this->packet_type,
'packet' => $packet 'packet' => $packet
); );
return $this->_get_sftp_packet($request_id); return $this->get_sftp_packet($request_id);
} }
return $packet; return $packet;