%PDF- %PDF-
| Direktori : /usr/lib/python3/dist-packages/samba/__pycache__/ |
| Current File : //usr/lib/python3/dist-packages/samba/__pycache__/safe_tarfile.cpython-312.pyc |
�
��d� � �b � d dl Z d dlZd dlmZ d dlmZmZmZ G d� de� Zej Zy)� N)�Path)�ExtractError�TarInfo�TarFilec � � � e Zd ZdZ eej � Z� xZS # e$ r* ddd�� fd�Z d
dd�� fd�Z
d� Zd� Zd� Z
d � Zd
� Zd� ZY � xZS w xY w)r z�This TarFile implementation is trying to ameliorate CVE-2007-4559,
where tarfile.TarFiles can step outside of the target directory
using '../../'.
F��
numeric_ownerc �L �� | j � t �| � ||||�� y )N)� set_attrsr )�_safetarfile_check�super�extract)�self�member�pathr r � __class__s ��4/usr/lib/python3/dist-packages/samba/safe_tarfile.pyr zTarFile.extract$ s) �� ��#�#�%��G�O�F�D�I�*7�
�
9� c �J �� | j � t �| � |||�� y )Nr )r r
�
extractall)r r �membersr r s �r r zTarFile.extractall* s( �� ��#�#�%��G��t�W�-:�
�
<r c �* � | j � D ]� }| j |�� rt d|j � �� �| j |�� rt d|j
� �� �| j
|�� s�jt d|j
� �� � y )N)�tarinfoz*Attempted directory traversal for member: z6Attempted directory traversal via symlink for member: z3Attempted directory traversal via link for member: )�__iter__�_is_traversal_attemptr �name�_is_unsafe_symlink�linkname�_is_unsafe_link�r r s r r zTarFile._safetarfile_check/ s� � ��=�=�?�
7���-�-�g�-�>�&�#�#*�<�<�.�2�3� 3� �*�*�7�*�;�&�#�#*�#3�#3�"4�6�7� 7� �'�'��'�8�&�#�#*�#3�#3�"4�6�7� 7�
7r c �z � t j j t j j |� � S �N)�osr �realpath�abspath)r r s r �
_resolve_pathzTarFile._resolve_path>