Renamed constants classes

This commit is contained in:
Jack Worman 2022-02-03 12:49:50 -06:00
parent 61f2bc1c06
commit dcf3528c8d
12 changed files with 194 additions and 176 deletions

View File

@ -43,6 +43,7 @@ use phpseclib3\Net\SFTP\OpenFlag;
use phpseclib3\Net\SFTP\OpenFlag5;
use phpseclib3\Net\SFTP\PacketType;
use phpseclib3\Net\SFTP\StatusCode;
use phpseclib3\Net\Ssh2\MessageType as Ssh2MessageType;
/**
* Pure-PHP implementations of SFTP.
@ -380,7 +381,7 @@ class SFTP extends SSH2
$packet = Strings::packSSH2(
'CsN3',
SshMsg::CHANNEL_OPEN,
Ssh2MessageType::CHANNEL_OPEN,
'session',
self::CHANNEL,
$this->window_size,
@ -389,7 +390,7 @@ class SFTP extends SSH2
$this->send_binary_packet($packet);
$this->channel_status[self::CHANNEL] = SshMsg::CHANNEL_OPEN;
$this->channel_status[self::CHANNEL] = Ssh2MessageType::CHANNEL_OPEN;
$response = $this->get_channel_packet(self::CHANNEL, true);
if ($response === true && $this->isTimeout()) {
@ -398,7 +399,7 @@ class SFTP extends SSH2
$packet = Strings::packSSH2(
'CNsbs',
SshMsg::CHANNEL_REQUEST,
Ssh2MessageType::CHANNEL_REQUEST,
$this->server_channels[self::CHANNEL],
'subsystem',
true,
@ -406,7 +407,7 @@ class SFTP extends SSH2
);
$this->send_binary_packet($packet);
$this->channel_status[self::CHANNEL] = SshMsg::CHANNEL_REQUEST;
$this->channel_status[self::CHANNEL] = Ssh2MessageType::CHANNEL_REQUEST;
$response = $this->get_channel_packet(self::CHANNEL, true);
if ($response === false) {
@ -418,7 +419,7 @@ class SFTP extends SSH2
// is redundant
$packet = Strings::packSSH2(
'CNsCs',
SshMsg::CHANNEL_REQUEST,
Ssh2MessageType::CHANNEL_REQUEST,
$this->server_channels[self::CHANNEL],
'exec',
1,
@ -426,7 +427,7 @@ class SFTP extends SSH2
);
$this->send_binary_packet($packet);
$this->channel_status[self::CHANNEL] = SshMsg::CHANNEL_REQUEST;
$this->channel_status[self::CHANNEL] = Ssh2MessageType::CHANNEL_REQUEST;
$response = $this->get_channel_packet(self::CHANNEL, true);
if ($response === false) {
@ -436,7 +437,7 @@ class SFTP extends SSH2
return false;
}
$this->channel_status[self::CHANNEL] = SshMsg::CHANNEL_DATA;
$this->channel_status[self::CHANNEL] = Ssh2MessageType::CHANNEL_DATA;
$this->send_sftp_packet(PacketType::INIT, "\0\0\0\3");
$response = $this->get_sftp_packet();
@ -3190,7 +3191,7 @@ class SFTP extends SSH2
while (strlen($this->packet_buffer) < 4) {
$temp = $this->get_channel_packet(self::CHANNEL, true);
if ($temp === true) {
if ($this->channel_status[self::CHANNEL] === SshMsg::CHANNEL_CLOSE) {
if ($this->channel_status[self::CHANNEL] === Ssh2MessageType::CHANNEL_CLOSE) {
$this->channel_close = true;
}
$this->packet_type = false;

View File

@ -3,6 +3,9 @@
namespace phpseclib3\Net\SFTP;
/**
* http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1
* the order, in this case, matters quite a lot - see \phpseclib3\Net\SFTP::_parseAttributes() to understand why
*
* @internal
*/
abstract class Attribute

View File

@ -3,6 +3,9 @@
namespace phpseclib3\Net\SFTP;
/**
* http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2
* see \phpseclib3\Net\SFTP::_parseLongname() for an explanation
*
* @internal
*/
abstract class FileType

View File

@ -3,6 +3,10 @@
namespace phpseclib3\Net\SFTP;
/**
* http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3
* the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name
* the array for that $this->open5_flags and similarly alter the constant names.
*
* @internal
*/
abstract class OpenFlag

View File

@ -3,6 +3,8 @@
namespace phpseclib3\Net\SFTP;
/**
* SFTPv5+ changed the flags up: https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-8.1.1.3
*
* @internal
*/
abstract class OpenFlag5

View File

@ -20,7 +20,7 @@ namespace phpseclib3\Net\SFTP;
use phpseclib3\Crypt\Common\PrivateKey;
use phpseclib3\Net\SFTP;
use phpseclib3\Net\SSH2;
use phpseclib3\Net\SshMsg;
use phpseclib3\Net\Ssh2\MessageType as Ssh2MessageType;
/**
* SFTP Stream Wrapper
@ -232,10 +232,10 @@ class Stream
call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
if (!$this->sftp->login($user, $pass)) {
call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', SshMsg::USERAUTH_FAILURE, 0, 0);
call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', Ssh2MessageType::USERAUTH_FAILURE, 0, 0);
return false;
}
call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', SshMsg::USERAUTH_SUCCESS, 0, 0);
call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', Ssh2MessageType::USERAUTH_SUCCESS, 0, 0);
} else {
if (!$this->sftp->login($user, $pass)) {
return false;

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
<?php
namespace phpseclib3\Net;
namespace phpseclib3\Net\Ssh2;
/**
* @internal
*/
abstract class SshOpen
abstract class ChannelConnectionFailureReason
{
const ADMINISTRATIVELY_PROHIBITED = 1;
const CONNECT_FAILED = 2;

View File

@ -1,13 +1,13 @@
<?php
namespace phpseclib3\Net;
namespace phpseclib3\Net\Ssh2;
use phpseclib3\Common\ConstantUtilityTrait;
/**
* @internal
*/
abstract class SshDisconnect
abstract class DisconnectReason
{
use ConstantUtilityTrait;

View File

@ -1,13 +1,13 @@
<?php
namespace phpseclib3\Net;
namespace phpseclib3\Net\Ssh2;
use phpseclib3\Common\ConstantUtilityTrait;
/**
* @internal
*/
abstract class SshMsg
abstract class MessageType
{
use ConstantUtilityTrait;

View File

@ -1,11 +1,11 @@
<?php
namespace phpseclib3\Net;
namespace phpseclib3\Net\Ssh2;
/**
* @internal
*/
abstract class SshMsgCustom
abstract class MessageTypeExtra
{
const KEXDH_INIT = 30;
const KEXDH_REPLY = 31;

View File

@ -1,6 +1,6 @@
<?php
namespace phpseclib3\Net;
namespace phpseclib3\Net\Ssh2;
/**
* @internal