a
    “I_ç  ã                   @   s8   d dl mZ d dlZd dlZd dlZdd„ Zdd„ ZdS )é    )ÚxattrNc              	   C   sN   t jdfD ]>}z&tj | t j¡}tj |t j|¡ W q
 tyF   Y q
0 q
dS )z8Copy ACL related attributes from a path to another path.zsystem.posix_acl_accessN)r   ZXATTR_NTACL_NAMEÚsambaZxattr_nativeZwrap_getxattrZwrap_setxattrÚ	Exception)ZfrompathZtopathZ	attr_nameZ	attribute© r   ú-/usr/lib/python3/dist-packages/samba/xattr.pyÚ	copyattrs   s    ÿþr   c                 C   sœ   t  | ¡}t  |¡ |D ]h}t j | |¡}t j ||¡}t j |¡r\t  |¡}t  ||¡ qt j |¡rtt	||ƒ qt
 ||¡ qt
 | |¡ t| |ƒ dS )zÌRecursively copy a directory tree using shutil.copy2(), preserving xattrs.

    The destination directory must not already exist.
    If exception(s) occur, an Error is raised with a list of reasons.
    N)ÚosÚlistdirÚmakedirsÚpathÚjoinÚislinkÚreadlinkÚsymlinkÚisdirÚcopytree_with_xattrsÚshutilZcopy2Zcopystatr   )ÚsrcZdstÚnamesÚnameZsrcnameZdstnameZlinktor   r   r   r   '   s    


r   )Zsamba.dcerpcr   r   Zsamba.xattr_nativer   r   r   r   r   r   r   r   Ú<module>   s
   