o
    ¯bÄ  ã                   @   sn   d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ddl
mZmZmZ G dd„ dejejƒZd	d
„ ZdS )z>
I am the support module for making a ftp server with twistd.
é    N)Úinternet)ÚcheckersÚportalÚstrcred)Úftp)Ú	deprecateÚusageÚversionsc                   @   sR   e Zd ZdZg d¢g d¢g d¢gZejdejdd�id�Zd	Z	d
d„ Z
dd„ ZdS )ÚOptionszP[options].
    WARNING: This FTP server is probably INSECURE do not use it.
    )ÚportÚpÚ2121zset the port number)ÚrootÚrz/usr/local/ftpz define the root of the ftp-site.)ÚuserAnonymousÚ Ú	anonymouszName of the anonymous user.r   zroot of the ftp site)Údescr)Ú
optActionsr   c                 O   s,   t jj| g|¢R i |¤Ž |  t ¡ ¡ d S )N)r   r
   Ú__init__Ú
addCheckerr   ÚAllowAnonymousAccess)ÚselfÚaÚkw© r   ú1/usr/lib/python3/dist-packages/twisted/tap/ftp.pyr   "   s   zOptions.__init__c              	   C   sJ   || d< t  | jt dddd¡¡}tj|tdd� |  t	j
|dd	�¡ d
S )z•
        Specify a file containing username:password login info for
        authenticated connections. (DEPRECATED; see --help-auth instead)
        zpassword-fileÚTwistedé   é   r   é   )ÚcategoryÚ
stacklevelT)ÚcacheN)r   ÚgetDeprecationWarningStringÚopt_password_filer	   ÚVersionÚwarningsÚwarnÚDeprecationWarningr   r   ÚFilePasswordDB)r   ÚfilenameÚmsgr   r   r   r%   &   s   ÿzOptions.opt_password_fileN)Ú__name__Ú
__module__Ú__qualname__ÚsynopsisÚoptParametersr   ÚCompletionsÚCompleteDirsÚcompDataÚlongdescr   r%   r   r   r   r   r
      s    ýÿr
   c                 C   s€   t  ¡ }t  | d ¡}t ||  dg ¡¡}| d |_| d |_||_t j|_	zt
| d ƒ}W n ty9   d}Y nw t ||¡S )Nr   ÚcredCheckersr   r   iI  )r   Ú
FTPFactoryÚFTPRealmr   ÚPortalÚgetÚtldr   ÚFTPÚprotocolÚintÚKeyErrorr   Ú	TCPServer)ÚconfigÚfr   r   Úportnor   r   r   ÚmakeService3   s   

ÿrD   )Ú__doc__r'   Útwisted.applicationr   Útwisted.credr   r   r   Útwisted.protocolsr   Útwisted.pythonr   r   r	   r
   ÚAuthOptionMixinrD   r   r   r   r   Ú<module>   s   !