U
    ¹~HjÄ  ã                   @   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                   @   s^   e Zd ZdZddddgdddd	gd
dddg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ÚpZ2121zset the port numberÚrootÚrz/usr/local/ftpz define the root of the ftp-site.ÚuserAnonymousÚ Z	anonymouszName of the anonymous user.zroot of the ftp site)Údescr)Z
optActionsc                 O   s&   t jj| f|ž|Ž |  t ¡ ¡ d S )N)r   r
   Ú__init__Ú
addCheckerr   ZAllowAnonymousAccess)ÚselfÚaÚkw© r   ú3/tmp/pip-unpacked-wheel-ewod1tgb/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-fileZTwistedé   é   r   é   )ÚcategoryÚ
stacklevelT)ÚcacheN)r   ZgetDeprecationWarningStringÚopt_password_filer	   ÚVersionÚwarningsÚwarnÚDeprecationWarningr   r   ZFilePasswordDB)r   ÚfilenameÚmsgr   r   r   r   &   s     ÿzOptions.opt_password_fileN)Ú__name__Ú
__module__Ú__qualname__ZsynopsisZoptParametersr   ZCompletionsÚCompleteDirsZcompDataZ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k
rt   d}Y nX t ||¡S )Nr   ZcredCheckersr   r   iI  )r   Z
FTPFactoryZFTPRealmr   ZPortalÚgetÚtldr   ÚFTPÚprotocolÚintÚKeyErrorr   Ú	TCPServer)ÚconfigÚfr   r   Zportnor   r   r   ÚmakeService3   s    


r3   )Ú__doc__r!   Ztwisted.applicationr   Ztwisted.credr   r   r   Ztwisted.protocolsr   Ztwisted.pythonr   r   r	   r
   ZAuthOptionMixinr3   r   r   r   r   Ú<module>   s   !