HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/duplicity/backends/__pycache__/lftpbackend.cpython-310.pyc
o

�~�_*'�@s�ddlmZe��ddlZddlZddlZddlZddlZddl	Zzddl
mZWne
y9ddlmZYnwddlZddlmZddlmZddlmZddlmZGdd	�d	ejj�Zej�d
e�ej�de�ej�de�ej�d
e�ej�de�ej�de�ej�de�ej�de�ej�de�ej�de�ej�de�ej�de�ej�de�ejj�gd��dS)�)�standard_libraryN)�quote)�config)�log)�tempdir)�utilc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�LFTPBackendz4Connect to remote store using File Transfer Protocolc	Cs�tjj�||�zt�d�}|��}|��}Wn	ty Ynw|s+t	�
dt	jj�|�
d�d�
d�d�
�d}t	�d|�||_tj�|jd���|_t�d	d
|j�|_|jd|j|_|jro|jd|j7_t�d
d|j�|_t|j�dkr�d|_|jddkr�|jd7_d|_|jjr�|jj|_|��|_d|j|jf|_tj dkr�d|_!nd|_!tj"|_#|jdkr�tj$s�gd�}|j#s�|D]}tj�%|�}tj�&|�r�||_#nq�t'�(��)�\|_*|_+t�,|j*d�|_-|j-�.dtj$r�dndd�|j#�r|j-�.dt/|j#�d�tj0�r"|j-�.dt/tj0�d�|jjdk�r<|j-�.d�|j-�.d�|j-�.d �n |jjd!k�rV|j-�.d"�|j-�.d#�|j-�.d$�n|j-�.d%�|j-�.d&�|j-�.d'tj1�|j-�.d(tj2�|j-�.d)|j!�t	�3�t	j4k�r�|j-�.d*�|jjd!k�r�|j-�.d+|j|j�5d!d,�f�n|j-�.d+|j|jf�|j-��t	�3�t	j4k�r�t6|j+d-�}t	�7d.|���dSdS)/Nzlftp --versionz%LFTP not found:  Please install LFTP.�
rz | �zLFTP version is %s�lftpz^webdav�httpz://z:%sz^/��/���z
-u '%s,%s'�regular�off�on�https)z~/.duplicity/cacert.pemz~/duplicity_cacert.pemz/etc/duplicity/cacert.pem�wzset ssl:verify-certificate �false�truezset ssl:ca-file zset ssl:ca-path �ftpszset ftp:ssl-allow true
zset ftp:ssl-protect-data true
zset ftp:ssl-protect-list true
�ftpeszset ftp:ssl-force on
zset ftp:ssl-protect-data on
zset ftp:ssl-protect-list on
zset ftp:ssl-allow false
zset http:use-propfind true
zset net:timeout %s
zset net:max-retries %s
zset ftp:passive-mode %s
zdebug
zopen %s %s
�ftp�rz
SETTINGS: 
%s)8�	duplicity�backend�Backend�__init__�os�popen�read�close�	Exceptionr�
FatalError�	ErrorCode�ftps_lftp_missing�split�Notice�
parsed_url�strip_prefix�scheme�lower�re�sub�hostname�
url_string�port�path�remote_path�len�authflag�username�get_password�passwordr�ftp_connection�conn_opt�ssl_cacert_file�cacert_file�ssl_no_check_certificate�
expanduser�isfiler�default�mkstemp�tempfd�tempname�fdopen�tempfile�write�	cmd_quote�ssl_cacert_path�timeout�num_retries�getverbosity�DEBUG�replace�open�Debug)	�selfr)�p�fout�ret�version�cacert_candidatesr2�f�rW�@/usr/lib/python3/dist-packages/duplicity/backends/lftpbackend.pyr2s�
�� 


���"

��zLFTPBackend.__init__cCs�t|dj�rt�|�}d|jt|j�t|j�t|j�t�|�f}t�	d|�|�
|�\}}}t�	d|�t�	d|�t�	d|�dS)N�z.lftp -c "source %s; mkdir -p %s; put %s -o %s"�CMD: %sz
STATUS: %s�
STDERR:
%s�
STDOUT:
%s)�
isinstance�	__class__r�fsdecoderCrGr3�uc_namerrO�subprocess_popen)rP�source_path�remote_filename�commandline�s�l�erWrWrX�_put�s"
��
�zLFTPBackend._putcCsxt|dj�rt�|�}dt|j�t|j�|t|j�f}t�	d|�|�
|�\}}}t�	d|�t�	d|�dS)NrYz!lftp -c "source %s; get %s -o %s"rZr[r\)r]r^rr_rGrCr3r`rrOra)rPrc�
local_pathrd�_rfrgrWrWrX�_get�s
��
�zLFTPBackend._getcCs~tj�|jj�}t|j�}dt|j�|||f}t�	d|�|�
|�\}}}t�	d|�t�	d|�dd�|�d�D�S)NzFlftp -c "source %s; ( cd %s && ls ) || ( mkdir -p %s && cd %s && ls )"rZr[r\cSs"g|]
}|rt�|��d��qS)r)r�fsencoder')�.0�xrWrWrX�
<listcomp>�s"z%LFTPBackend._list.<locals>.<listcomp>r	)�urllib�parse�unquoter)r2rGr3rCrrOrar')rP�
remote_dir�quoted_pathrdrjrfrgrWrWrX�_list�s
���zLFTPBackend._listcCsbdt|j�t|j�tt�|��f}t�d|�|�|�\}}}t�d|�t�d|�dS)Nz!lftp -c "source %s; cd %s; rm %s"rZr[r\)rGrCr3rr_rrOra)rP�filenamerdrjrfrgrWrWrX�_delete�s��
�zLFTPBackend._deleteN)	�__name__�
__module__�__qualname__�__doc__rrhrkrurwrWrWrWrXr0sbrrr�fishr�lftp+ftp�	lftp+ftps�	lftp+fish�
lftp+ftpes�	lftp+sftp�lftp+webdav�lftp+webdavs�	lftp+http�
lftp+https)
rrr|rr}r~rr�r�r�r�r�r�)�futurer�install_aliasesr�os.pathr-�urllib.requestrp�urllib.parse�urllib.error�shlexrrG�ImportError�pipes�duplicity.backendrrrrrrrr�register_backend�uses_netloc�extendrWrWrWrX�<module>sD�(