mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-25 19:21:09 +00:00
Merge pull request #352 from terrafrost/sftp-stream-changes
SFTP Stream changes * terrafrost/sftp-stream-changes: SFTP/Stream: fix capatilization SFTP/Stream: add explanation as to why nlist() is used here SFTP/Stream: use $scheme instead of 'sftp'
This commit is contained in:
commit
6805704b4f
@ -180,24 +180,24 @@ class Net_SFTP_Stream
|
||||
if (isset($this->context)) {
|
||||
$context = stream_context_get_options($this->context);
|
||||
}
|
||||
if (isset($context['sftp']['session'])) {
|
||||
$sftp = $context['sftp']['session'];
|
||||
if (isset($context[$scheme]['session'])) {
|
||||
$sftp = $context[$scheme]['session'];
|
||||
}
|
||||
if (isset($context['sftp']['sftp'])) {
|
||||
$sftp = $context['sftp']['sftp'];
|
||||
if (isset($context[$scheme]['sftp'])) {
|
||||
$sftp = $context[$scheme]['sftp'];
|
||||
}
|
||||
if (isset($sftp) && is_object($sftp) && get_class($sftp) == 'Net_SFTP') {
|
||||
$this->sftp = $sftp;
|
||||
return $path;
|
||||
}
|
||||
if (isset($context['sftp']['username'])) {
|
||||
$user = $context['sftp']['username'];
|
||||
if (isset($context[$scheme]['username'])) {
|
||||
$user = $context[$scheme]['username'];
|
||||
}
|
||||
if (isset($context['sftp']['password'])) {
|
||||
$pass = $context['sftp']['password'];
|
||||
if (isset($context[$scheme]['password'])) {
|
||||
$pass = $context[$scheme]['password'];
|
||||
}
|
||||
if (isset($context['sftp']['privkey']) && is_object($context['sftp']['privkey']) && get_Class($context['sftp']['privkey']) == 'Crypt_RSA') {
|
||||
$pass = $context['sftp']['privkey'];
|
||||
if (isset($context[$scheme]['privkey']) && is_object($context[$scheme]['privkey']) && get_Class($context[$scheme]['privkey']) == 'Crypt_RSA') {
|
||||
$pass = $context[$scheme]['privkey'];
|
||||
}
|
||||
|
||||
if (!isset($user) || !isset($pass)) {
|
||||
@ -517,7 +517,20 @@ class Net_SFTP_Stream
|
||||
* Open directory handle
|
||||
*
|
||||
* The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and
|
||||
* removed in 5.4 I'm just going to ignore it
|
||||
* removed in 5.4 I'm just going to ignore it.
|
||||
*
|
||||
* Also, nlist() is the best that this function is realistically going to be able to do. When an SFTP client
|
||||
* sends a SSH_FXP_READDIR packet you don't generally get info on just one file but on multiple files. Quoting
|
||||
* the SFTP specs:
|
||||
*
|
||||
* The SSH_FXP_NAME response has the following format:
|
||||
*
|
||||
* uint32 id
|
||||
* uint32 count
|
||||
* repeats count times:
|
||||
* string filename
|
||||
* string longname
|
||||
* ATTRS attrs
|
||||
*
|
||||
* @param String $path
|
||||
* @param Integer $options
|
||||
|
Loading…
Reference in New Issue
Block a user