pssht  latest
SSH server library written in PHP
REQUEST.php
1 <?php
2 
3 /*
4 * This file is part of pssht.
5 *
6 * (c) François Poirotte <clicky@erebot.net>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 
13 
15 
20 {
23 
30  public function __construct(\fpoirotte\Pssht\Handlers\USERAUTH\REQUEST $methods)
31  {
32  $this->userAuthRequestHandler = $methods;
33  }
34 
35  // SSH_MSG_SERVICE_REQUEST = 5
36  public function handle(
37  $msgType,
38  \fpoirotte\Pssht\Wire\Decoder $decoder,
39  \fpoirotte\Pssht\Transport $transport,
40  array &$context
41  ) {
43  $service = $message->getServiceName();
44 
45  if ($service === 'ssh-userauth') {
46  $response = new \fpoirotte\Pssht\Messages\SERVICE\ACCEPT($service);
47  $transport->setHandler(
48  \fpoirotte\Pssht\Messages\USERAUTH\REQUEST\Base::getMessageId(),
49  $this->userAuthRequestHandler
50  );
51  } else {
52  $response = new DISCONNECT(
54  'No such service'
55  );
56  }
57  $transport->writeMessage($response);
58  return true;
59  }
60 }
const SSH_DISCONNECT_SERVICE_NOT_AVAILABLE
Disconnected because the requested service is not available.
Definition: DISCONNECT.php:38
handle($msgType,\fpoirotte\Pssht\Wire\Decoder $decoder,\fpoirotte\Pssht\Transport $transport, array &$context)
Definition: REQUEST.php:36
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: Base.php:44
$userAuthRequestHandler
User authentication request handler.
Definition: REQUEST.php:22
__construct(\fpoirotte\Pssht\Handlers\USERAUTH\REQUEST $methods)
Definition: REQUEST.php:30