%PDF- %PDF-
Direktori : /lib/python3/dist-packages/paramiko/__pycache__/ |
Current File : //lib/python3/dist-packages/paramiko/__pycache__/server.cpython-312.pyc |
� �ec�v � � � d Z ddlZddlmZ ddlmZmZmZmZm Z ddl mZ G d� de� Z G d� d e� Z G d � dej � Zy)zD `.ServerInterface` is an interface to override for server support. � N)�util)�DEBUG�ERROR�'OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED�AUTH_FAILED�AUTH_SUCCESSFUL)�string_typesc � � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z ed fd �Zed fd�Z d� Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zy )�ServerInterfacea This class defines an interface for controlling the behavior of Paramiko in server mode. Methods on this class are called from Paramiko's primary thread, so you shouldn't do too much work in them. (Certainly nothing that blocks or sleeps.) c � � t S )a. Determine if a channel request of a given type will be granted, and return ``OPEN_SUCCEEDED`` or an error code. This method is called in server mode when the client requests a channel, after authentication is complete. If you allow channel requests (and an ssh server that didn't would be useless), you should also override some of the channel request methods below, which are used to determine which services will be allowed on a given channel: - `check_channel_pty_request` - `check_channel_shell_request` - `check_channel_subsystem_request` - `check_channel_window_change_request` - `check_channel_x11_request` - `check_channel_forward_agent_request` The ``chanid`` parameter is a small number that uniquely identifies the channel within a `.Transport`. A `.Channel` object is not created unless this method returns ``OPEN_SUCCEEDED`` -- once a `.Channel` object is created, you can call `.Channel.get_id` to retrieve the channel ID. The return value should either be ``OPEN_SUCCEEDED`` (or ``0``) to allow the channel request, or one of the following error codes to reject it: - ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED`` - ``OPEN_FAILED_CONNECT_FAILED`` - ``OPEN_FAILED_UNKNOWN_CHANNEL_TYPE`` - ``OPEN_FAILED_RESOURCE_SHORTAGE`` The default implementation always returns ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``. :param str kind: the kind of channel the client would like to open (usually ``"session"``). :param int chanid: ID of the channel :return: an `int` success or failure code (listed above) �r )�self�kind�chanids �1/usr/lib/python3/dist-packages/paramiko/server.py�check_channel_requestz%ServerInterface.check_channel_request- s � �V 7�6� c � � y)a\ Return a list of authentication methods supported by the server. This list is sent to clients attempting to authenticate, to inform them of authentication methods that might be successful. The "list" is actually a string of comma-separated names of types of authentication. Possible values are ``"password"``, ``"publickey"``, and ``"none"``. The default implementation always returns ``"password"``. :param str username: the username requesting authentication. :return: a comma-separated `str` of authentication types �password� �r �usernames r �get_allowed_authsz!ServerInterface.get_allowed_authsZ s � � r c � � t S )a Determine if a client may open channels with no (further) authentication. Return ``AUTH_FAILED`` if the client must authenticate, or ``AUTH_SUCCESSFUL`` if it's okay for the client to not authenticate. The default implementation always returns ``AUTH_FAILED``. :param str username: the username of the client. :return: ``AUTH_FAILED`` if the authentication fails; ``AUTH_SUCCESSFUL`` if it succeeds. :rtype: int �r r s r �check_auth_nonezServerInterface.check_auth_nonek s � �"