mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
- logs now contain timing information
- fixed a potential E_NOTICE error (thanks, Wang Xiaoguang!) git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@43 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
5025807abf
commit
df8844d12b
@ -48,7 +48,7 @@
|
|||||||
* @author Jim Wigginton <terrafrost@php.net>
|
* @author Jim Wigginton <terrafrost@php.net>
|
||||||
* @copyright MMIX Jim Wigginton
|
* @copyright MMIX Jim Wigginton
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt
|
* @license http://www.gnu.org/licenses/lgpl.txt
|
||||||
* @version $Id: SFTP.php,v 1.6 2009-08-23 03:40:50 terrafrost Exp $
|
* @version $Id: SFTP.php,v 1.7 2009-08-29 19:23:25 terrafrost Exp $
|
||||||
* @link http://phpseclib.sourceforge.net
|
* @link http://phpseclib.sourceforge.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1176,12 +1176,17 @@ class Net_SFTP extends Net_SSH2 {
|
|||||||
pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) :
|
pack('NCNa*', strlen($data) + 5, $type, $this->request_id, $data) :
|
||||||
pack('NCa*', strlen($data) + 1, $type, $data);
|
pack('NCa*', strlen($data) + 1, $type, $data);
|
||||||
|
|
||||||
|
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
|
||||||
|
$result = $this->_send_binary_packet(pack('CN2a*', NET_SSH2_MSG_CHANNEL_DATA, $this->server_channels[$this->client_channel], strlen($data), $data));
|
||||||
|
$stop = strtok(microtime(), ' ') + strtok('');
|
||||||
|
|
||||||
if (defined('NET_SFTP_LOGGING')) {
|
if (defined('NET_SFTP_LOGGING')) {
|
||||||
$this->packet_type_log[] = '-> ' . $this->packet_types[$type];
|
$this->packet_type_log[] = '-> ' . $this->packet_types[$type] .
|
||||||
|
' (' . round($stop - $start, 4) . 's)';
|
||||||
$this->packet_log[] = $data;
|
$this->packet_log[] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_send_binary_packet(pack('CN2a*', NET_SSH2_MSG_CHANNEL_DATA, $this->server_channels[$this->client_channel], strlen($data), $data));
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1195,6 +1200,8 @@ class Net_SFTP extends Net_SSH2 {
|
|||||||
*/
|
*/
|
||||||
function _get_sftp_packet()
|
function _get_sftp_packet()
|
||||||
{
|
{
|
||||||
|
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
|
||||||
|
|
||||||
$packet = $this->_get_channel_packet();
|
$packet = $this->_get_channel_packet();
|
||||||
if (is_bool($packet)) {
|
if (is_bool($packet)) {
|
||||||
$this->packet_type = false;
|
$this->packet_type = false;
|
||||||
@ -1228,8 +1235,11 @@ class Net_SFTP extends Net_SSH2 {
|
|||||||
$length-= strlen($temp);
|
$length-= strlen($temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$stop = strtok(microtime(), ' ') + strtok('');
|
||||||
|
|
||||||
if (defined('NET_SFTP_LOGGING')) {
|
if (defined('NET_SFTP_LOGGING')) {
|
||||||
$this->packet_type_log[] = '<- ' . $this->packet_types[$this->packet_type];
|
$this->packet_type_log[] = '<- ' . $this->packet_types[$this->packet_type] .
|
||||||
|
' (' . round($stop - $start, 4) . 's)';
|
||||||
$this->packet_log[] = $packet;
|
$this->packet_log[] = $packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
* @author Jim Wigginton <terrafrost@php.net>
|
* @author Jim Wigginton <terrafrost@php.net>
|
||||||
* @copyright MMVII Jim Wigginton
|
* @copyright MMVII Jim Wigginton
|
||||||
* @license http://www.gnu.org/licenses/lgpl.txt
|
* @license http://www.gnu.org/licenses/lgpl.txt
|
||||||
* @version $Id: SSH2.php,v 1.19 2009-08-23 03:40:50 terrafrost Exp $
|
* @version $Id: SSH2.php,v 1.20 2009-08-29 19:23:25 terrafrost Exp $
|
||||||
* @link http://phpseclib.sourceforge.net
|
* @link http://phpseclib.sourceforge.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1212,7 +1212,7 @@ class Net_SSH2 {
|
|||||||
$this->debug_info.= "\r\n\r\nSSH_MSG_USERAUTH_PASSWD_CHANGEREQ:\r\n" . utf8_decode($this->_string_shift($response, $length));
|
$this->debug_info.= "\r\n\r\nSSH_MSG_USERAUTH_PASSWD_CHANGEREQ:\r\n" . utf8_decode($this->_string_shift($response, $length));
|
||||||
return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER);
|
return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER);
|
||||||
case NET_SSH2_MSG_USERAUTH_FAILURE:
|
case NET_SSH2_MSG_USERAUTH_FAILURE:
|
||||||
list(, $length) = unpack('Nlength', $this->_string_shift($response, 4));
|
list(, $length) = unpack('N', $this->_string_shift($response, 4));
|
||||||
$this->debug_info.= "\r\n\r\nSSH_MSG_USERAUTH_FAILURE:\r\n" . $this->_string_shift($response, $length);
|
$this->debug_info.= "\r\n\r\nSSH_MSG_USERAUTH_FAILURE:\r\n" . $this->_string_shift($response, $length);
|
||||||
return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER);
|
return $this->_disconnect(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER);
|
||||||
case NET_SSH2_MSG_USERAUTH_SUCCESS:
|
case NET_SSH2_MSG_USERAUTH_SUCCESS:
|
||||||
@ -1383,7 +1383,9 @@ class Net_SSH2 {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
|
||||||
$raw = fread($this->fsock, $this->decrypt_block_size);
|
$raw = fread($this->fsock, $this->decrypt_block_size);
|
||||||
|
$stop = strtok(microtime(), ' ') + strtok('');
|
||||||
|
|
||||||
if ($this->decrypt !== false) {
|
if ($this->decrypt !== false) {
|
||||||
$raw = $this->decrypt->decrypt($raw);
|
$raw = $this->decrypt->decrypt($raw);
|
||||||
@ -1423,7 +1425,8 @@ class Net_SSH2 {
|
|||||||
$this->get_seq_no++;
|
$this->get_seq_no++;
|
||||||
|
|
||||||
if (defined('NET_SSH2_LOGGING')) {
|
if (defined('NET_SSH2_LOGGING')) {
|
||||||
$this->message_number_log[] = '<- ' . $this->message_numbers[ord($payload[0])];
|
$this->message_number_log[] = '-> ' . $this->message_numbers[ord($payload[0])] .
|
||||||
|
' (' . round($stop - $start, 4) . 's)';
|
||||||
$this->message_log[] = $payload;
|
$this->message_log[] = $payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1599,11 +1602,6 @@ class Net_SSH2 {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined('NET_SSH2_LOGGING')) {
|
|
||||||
$this->message_number_log[] = '-> ' . $this->message_numbers[ord($data[0])];
|
|
||||||
$this->message_log[] = $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if ($this->compress) {
|
//if ($this->compress) {
|
||||||
// // the -4 removes the checksum:
|
// // the -4 removes the checksum:
|
||||||
// // http://php.net/function.gzcompress#57710
|
// // http://php.net/function.gzcompress#57710
|
||||||
@ -1634,7 +1632,17 @@ class Net_SSH2 {
|
|||||||
|
|
||||||
$packet.= $hmac;
|
$packet.= $hmac;
|
||||||
|
|
||||||
return strlen($packet) == fputs($this->fsock, $packet);
|
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
|
||||||
|
$result = strlen($packet) == fputs($this->fsock, $packet);
|
||||||
|
$stop = strtok(microtime(), ' ') + strtok('');
|
||||||
|
|
||||||
|
if (defined('NET_SSH2_LOGGING')) {
|
||||||
|
$this->message_number_log[] = '-> ' . $this->message_numbers[ord($data[0])] .
|
||||||
|
' (' . round($stop - $start, 4) . 's)';
|
||||||
|
$this->message_log[] = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user