HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/mac_xattr.cpython-310.pyc
o

�N�g��@s>dZddlZddlZe�e�ZdZdd�Zdd�Zdd	�Z	dS)
ae
Allows you to manage extended attributes on files or directories
================================================================

Install, enable and disable assistive access on macOS minions

.. code-block:: yaml

    /path/to/file:
      xattr.exists:
        - attributes:
            - com.file.attr=test
            - com.apple.quarantine=0x00001111
�NZxattrcCstddvrtSdS)z
    Only work on Mac OS
    �os)ZMacOS�Darwin)FzOnly supported on Mac OS)Z
__grains__�__virtualname__�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/mac_xattr.py�__virtual__src
Cs|ddid�}tj�|�sd|d<d|d<|Std|�}|��}|D]X}|�d	�\}}|�d
�}|rPtd||dd��d
d��dd�||<|dd��d
d�}||vrWd}	n|||kpd|od|||k}	||vrl|	rlq#||d|<td||||�q#t|d���dkr�d|d<|S)ap
    Make sure the given attributes exist on the file/directory

    name
        The path to the file/directory

    attributes
        The attributes that should exist on the file/directory, this is accepted as
        an array, with key and value split with an equals sign, if you want to specify
        a hex value then add 0x to the beginning of the value.

    T���name�result�comment�changesFr�File or directory doesn't existr�
xattr.list�=�0xz
xattr.read)�hex� �
�Nr
zxattr.writerzAll values existed correctly.)	r�path�exists�__salt__�keys�split�
startswith�replace�len)
r
�
attributes�ret�
current_attrs�current_ids�attrZattr_idZattr_valZattr_hexZ
value_matchesrrrr!s8

��rcCs�|ddid�}tj�|�sd|d<d|d<|Std|�}|��}|D]}||vr6td	||�d
|d|<q#t|d���dkrEd
|d<|S)z�
    Make sure the given attributes are deleted from the file/directory

    name
        The path to the file/directory

    attributes
        The attributes that should be removed from the file/directory, this is accepted as
        an array.
    Trr	Frrrrzxattr.delete�deleter
rz$All attributes were already deleted.)rrrrrr)r
rrr r!r"rrrr#Xs�r#)
�__doc__�loggingr�	getLogger�__name__�logrrrr#rrrr�<module>s
	7