%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/SSSDConfig/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/SSSDConfig/__pycache__/__init__.cpython-312.pyc

�

Acf5����dZddlZddlZddlZddlmZddlmZGd�de�Z	Gd�d	e�Z
Gd
�de	�ZGd�d
e	�ZGd�de	�Z
Gd�de	�ZGd�de	�ZGd�de	�ZGd�de	�ZGd�de	�ZGd�de	�ZGd�de	�ZGd�de	�ZGd �d!e	�ZGd"�d#e	�ZGd$�d%e	�Zd&�Zd'�ZGd(�d)e�ZGd*�d+e�ZGd,�d-e�ZGd.�d/e�ZGd0�d1e�Z y)2z,
Created on Sep 18, 2009

@author: sgallagh
�N�)�SSSDOptions)�SSSDChangeConfc��eZdZy)�SSSDConfigExceptionN��__name__�
__module__�__qualname__���5/usr/lib/python3/dist-packages/SSSDConfig/__init__.pyrr��r
rc��eZdZy)�ParsingErrorNrrr
rrrrr
rc��eZdZy)�AlreadyInitializedErrorNrrr
rrrrr
rc��eZdZy)�NotInitializedErrorNrrr
rrrrr
rc��eZdZy)�NoOutputFileErrorNrrr
rrrrr
rc��eZdZy)�NoServiceErrorNrrr
rrrrr
rc��eZdZy)�NoSectionErrorNrrr
rrrrr
rc��eZdZy)�
NoOptionErrorNrrr
rrrrr
rc��eZdZy)�ServiceNotRecognizedErrorNrrr
rrrrr
rc��eZdZy)�ServiceAlreadyExistsNrrr
rr!r!rr
r!c��eZdZy)�
NoDomainErrorNrrr
rr#r#rr
r#c��eZdZy)�DomainNotRecognizedNrrr
rr%r%rr
r%c��eZdZy)�DomainAlreadyExistsErrorNrrr
rr'r'rr
r'c��eZdZy)�NoSuchProviderErrorNrrr
rr)r)rr
r)c��eZdZy)�NoSuchProviderSubtypeErrorNrrr
rr+r+rr
r+c��eZdZy)�ProviderSubtypeInUseNrrr
rr-r-rr
r-c�H�|D�cgc]}|j���c}Scc}w�N)�strip)�l�xs  r�	striplistr3s�� �!�!�A�G�G�I�!�"��!s�c�D�g}|D]}||vs�|j|��|Sr/)�append)�options1�options2�overlap�options    r�options_overlapr:"s1���G��#���X���N�N�6�"�#��Nr
c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�SSSDConfigSchemac�0�tj|�|sd}|sd}	t|d�5}|j|�ddd�t	d�tj|��D]-}t|dz|z�5}|j|�ddd��/	tttjddk(rtnttt t"dd�|_d	d
d�|_y#1swY��xYw#1swY��xYw#t$r�t$rt�wxYw)Nz/usr/share/sssd/sssd.api.confz/usr/share/sssd/sssd.api.d�rc�.�tjd|�S)Nz^sssd-.*\.conf$)�re�search)�fs r�<lambda>z+SSSDConfigSchema.__init__.<locals>.<lambda>7s�����3E�q�)I�r
�/r�)�bool�int�long�float�str�list�NoneFT)�false�true)r�__init__�open�readfp�filter�os�listdir�IOError�SyntaxErrorrrFrG�sys�version_inforHrIrJrK�type_lookup�bool_lookup)�self�
schemafile�schemaplugindir�fd�files     rrOzSSSDConfigSchema.__init__*s������%��8�J��:�O�	��j�#�&�
 �"����B��
 ��I�)+���O�)D�F�
$���/�3�.��5�6�$�"��K�K��O�$�$�
$��� �-�-�a�0�A�5�T�3�������������1
 �
 ��
$�$���	���	���	�s9�C<�C$�<C<�9C0�
C<�$C-�)C<�0C9	�5C<�<Dc	���|j|�st�|j|�}d}d}d}d}i}|j|�D�]h}|d}	t	|	jd��}
t
|
�}|j|
|}|j|
|}
|j|
|}|dtjvrtj|d}nd}|dk(r||
||df||d<��|dk(�rt|
|�|k(r||
|||
|f||d<��|tk(r�t|
|�|
k(r||
|||
|gf||d<��	|
tk(rBt|
|�tk(r-||
|||j|
|j�gf||d<n||
|||
|
|�gf||d<��^	|tk(rAt|
|�tk(r,||
|||j|
|j�f||d<n||
||||
|�f||d<���|dkDr�|tk7rt"�g}|
|dD]w}t|�|
k7rU	|
tk(r0t|�tk(r|j|j�}n|
|�}|j%|g��f|j%|g��y||
|||f||d<��et"�|S#t $rt"�wxYw#t $rt"�wxYw#t $rt"�wxYw)	NrrrE��value�,�name�)�has_sectionr�options�strip_comments_emptyr3�split�lenrYrZr�option_strings�typerKrFrJ�lower�
ValueErrorr�extend)r[�sectionrg�PRIMARY_TYPE�SUBTYPE�	MANDATORY�DEFAULT�parsed_optionsr9�unparsed_option�split_option�	optionlen�primarytype�subtype�	mandatory�desc�
fixed_optionsr2�newvalues                   r�get_optionszSSSDConfigSchema.get_optionsQs�������(� � ��,�,�w�'�������	������/�/��8�e	#�F�$�W�o�O�$�_�%:�%:�3�%?�@�L��L�)�I��*�*�<��+E�F�K��&�&�|�G�'<�=�G��(�(��i�)@�A�I��f�~��!;�!;�;�"�1�1�&��.�A�����A�~�!�����	��v�f�~�.��a����W�-�.�+�=�$� �"��%�g�.�	0�#�6�&�>�2�!�D�(��\�'�2�3�w�>�(�$�&�!�*�7�3�4�	6�'�v�f�~�6�/�&�$�� ��g�!6�7�3�>�%0�%,�%.�%)�&*�&6�&6�|�G�7L�7R�7R�7T�&U�%V�	%X�!/�v�f�~� >�&1�%,�%.�%)�&-�l�7�.C�&D�%E�	%G�!/�v�f�~� >��+�&�$�.� ��g�!6�7�3�>�%0�%,�%.�%)�%)�%5�%5�l�7�6K�6Q�6Q�6S�%T�	%V�!/�v�f�~� >�"-�!(�!*�!%�!,�\�'�-B�!C�	!E�+�6�&�>�:���Q���4�'�&�&� "�
�%�g�h�/�2�A��A�w�'�)�/� '�4��D��G�s�N�+/�+;�+;�A�G�G�I�+F��+2�1�:��)�0�0�(��<�&�,�,�a�S�1�2�!����"�	$��v�f�~�.�#�"�Ke	#�N���a *�/�".�.�/��&&�+�*�*�+�� *�/�".�.�/�s'�>A"J2�#A K�2AK�2K�K�K(c��|j|�st|��|j||�std|�d|�d���|j	|�|S)N�	Section [�] has no option [�])rfr�
has_optionrr)r[rpr9s   r�
get_optionzSSSDConfigSchema.get_option�sX������(� ��)�)����w��/��!(�&�!2�3�
3�����(��0�0r
c���|j|�st|��|j|�}t|j	�D�cgc]}||ddk7r
|||df��c}�}|Scc}w)Nre)rfrr�dict�keys)r[rp�schema_optionsr2�defaultss     r�get_defaultszSSSDConfigSchema.get_defaults�s�������(� ��)�)��)�)�'�2���"0�"5�"5�"7�:��*�1�-�a�0�D�8��N�1�-�a�0�1�:�;�����	:s�A*c��|j�D�cgc]7}|ddk7r-|djd�s|djd�s|d��9}}|Scc}w)Nrd�service�domain�provider)�sections�
startswith�r[r2�service_lists   r�get_serviceszSSSDConfigSchema.get_services�se��+/�=�=�?�>�a��V�9�	�1��f�I�0�0��:��f�I�0�0��<��&�	�>��>����	>s�<Ac�,�i}|j�D]X}|djd�}|ddk(s� t|�dk(s�/|d|vrg||d<||dj|dg��Z|j	�D]}t||�||<�|S)NrdrDrr�rarrE)r�rirjror��tuple)r[�	providersrp�splitsection�keys     r�
get_providerszSSSDConfigSchema.get_providers�s����	��}�}��	I�G�"�6�?�0�0��5�L��Q��:�-��|�$��)�#�A��i�7�57�	�,�q�/�2��l�1�o�.�5�5�|�A��6G�H�
	I��>�>�#�	3�C�"�9�S�>�2�I�c�N�	3��r
N)	r	r
rrOrr�r�r�r�rr
rr<r<)s#��%�Nt�l1�	��r
r<c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�SSSDConfigObjectc� �d|_i|_yr/)rdrg�r[s rrOzSSSDConfigObject.__init__�s����	���r
c��|jS)z�
        Return the name of the object

        === Returns ===
        The domain name

        === Errors ===
        No errors
        )rdr�s r�get_namezSSSDConfigObject.get_name�s���y�y�r
c�n�||jj�vr|j|St|��)a
        Return the value of an service option

        optionname:
          The option to get.

        === Returns ===
        The value for the requested option.

        === Errors ===
        NoOptionError:
          The specified option was not listed in the service
        )rgr�r�r[�
optionnames  rr�zSSSDConfigObject.get_options3������*�*�,�,��<�<�
�+�+��J�'�'r
c��|jS)z�
        Return a dictionary of name/value pairs for this object

        === Returns ===
        A dictionary of name/value pairs currently in use for this object

        === Errors ===
        No errors
        �rgr�s r�get_all_optionsz SSSDConfigObject.get_all_optionss���|�|�r
c�<�||jvr|j|=yy)z�
        Remove an option from the object. If the option does not exist, it is ignored.

        === Returns ===
        No return value.

        === Errors ===
        No errors
        Nr�r�s  r�
remove_optionzSSSDConfigObject.remove_options!������%����Z�(�&r
N)r	r
rrOr�r�r�r�rr
rr�r��s���
�(�$
�)r
r�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�SSSDServicez3
    Object to manipulate SSSD service options
    c���tj|�t|t�rt	|�t
k7rt�|j|�st|��||_	||_
i|_g|_|jj|jjd��|jj|jj|j��y)a\
        Create a new SSSDService, setting its defaults to those found in the
        schema. This constructor should not be used directly. Use
        SSSDConfig.new_service() instead.

        name:
          The service name
        apischema:
          An SSSDConfigSchema? object created by SSSDConfig.__init__()

        === Returns ===
        The newly-created SSSDService object.

        === Errors ===
        TypeError:
          The API schema passed in was unusable or the name was not a string.
        ServiceNotRecognizedError:
          The service was not listed in the schema
        r�N)r�rO�
isinstancer<rlrJ�	TypeErrorrfrrd�schemarg�hidden_options�updater�)r[�servicename�	apischemas   rrOzSSSDService.__init__0s���(	�!�!�$�'��)�%5�6�$�{�:K�s�:R��O��$�$�[�1�+�K�8�8���	�������!���	
�����D�K�K�4�4�Y�?�@�	
�����D�K�K�4�4�T�Y�Y�?�@r
c���i}|jjd�}|j|�|jj|j�}|j|�|S)aI
        List options for the service, including the mandatory flag.

        === Returns ===
        A dictionary of configurable options. This dictionary is keyed on the
        option name with a tuple of the variable type, subtype ('None' if the
        type is not  a collection type), whether it is mandatory, the
        translated option description, and the default value (or 'None') as
        the value.

        Example:
        { 'enumerate' :
          (bool, None, False, u'Enable enumerating all users/groups', True) }

        === Errors ===
        No errors
        r�)r�rr�rd)r[rgr�s   r�list_options_with_mandatoryz'SSSDService.list_options_with_mandatory[sT��$�����0�0��;�����~�&����0�0����;�����~�&��r
c��|j�}i}|j�D]#}||d||d||d||df||<�%|S)a
        List all options that apply to this service

        === Returns ===
        A dictionary of configurable options. This dictionary is keyed on the
        option name with a tuple of the variable type, subtype ('None' if the
        type is not  a collection type), the translated option description, and
        the default value (or 'None') as the value.

        Example:
        { 'services' :
          (list, str, u'SSSD Services to start', ['nss', 'pam']) }

        === Errors ===
        No Errors
        rrrare�r�r��r[rg�filtered_optionsr�s    r�list_optionszSSSDService.list_optionsx�s��"�2�2�4�����<�<�>�	i�C�%,�S�\�!�_�g�c�l�1�o�w�s�|�TU��X_�`c�Xd�ef�Xg�$h��S�!�	i� �r
c��|j�}i}|j�D],}||ds�||d||d||d||df||<�.|S)a
        List all mandatory options that apply to this service

        === Returns ===
        A dictionary of configurable options. This dictionary is keyed on the
        option name with a tuple of the variable type, subtype ('None' if the
        type is not  a collection type), the translated option description, and
        the default value (or 'None') as the value.

        Example:
        { 'services' :
          (list, str, u'SSSD Services to start', ['nss', 'pam']) }

        === Errors ===
        No Errors
        rErrrarer�r�s    r�list_mandatory_optionsz"SSSDService.list_mandatory_options����"�2�2�4�����<�<�>�	m�C��s�|�A��)0���a��'�#�,�q�/�7�SV�<�XY�?�\c�dg�\h�ij�\k�(l� ��%�	m� �r
c
��|jj|j|�r'|jj|j|�}ns|jjd|�r|jjd|�}n:||jvr||j
|<yt
d|j�d|�d���|dk(r|j|�yd}|dtk(rBt|�tk7r0t|�tk(rt|jd��}n|g}t|�|dk7r�	|dtk(r:t|�tk(r(|jj|j�}n6|dt k(rt|�tk(r
t!|d�}n|d|�}|r t'd
|d�d|�dt|�����t|�tk(r�	g}|D]s}|d
tk(rJt|�tk(r8|j)|jj|j�g��Y|j)|d
|�g��u	|rt'd|d
z��}||j
|<y#t"$rd	}Y��t$$rd	}Y��wxYw#t"$rd	}Y�Ot$$rd	}Y�[wxYw)a
        Set a service option to the specified value (or values)

        optionname:
          The option to change
        value:
          The value to set. This may be a single value or a list of values. If
          it is set to None, it resets the option to its default.

        === Returns ===
        No return value

        === Errors ===
        NoOptionError:
          The specified option is not listed in the schema
        TypeError:
          The value specified was not of the expected type
        r�Nr�r�r�FrrcT�	Expected � for �, received r�Expected %s)r�r�rdr�r�rgrr�rKrlrJr3rirFrZrmrGrn�KeyErrorr�ro)r[r�rb�
option_schema�raise_errorr~r2s       r�
set_optionzSSSDService.set_option�s���&�;�;�!�!�$�)�)�Z�8� �K�K�2�2�4�9�9�j�I�M�
�[�[�
#�
#�I�z�
:� �K�K�2�2�9�j�I�M�
�4�.�.�
.�',�D�L�L��$���T�Y�Y�PZ� [�\�\��D�=����z�*����
���t�#��U��t�(;��E�{�c�!�!�%�+�+�c�"2�3�������;�-��*�*�
#� ��#�t�+��U��s�0B� �K�K�3�3�E�K�K�M�B�E�"�1�%��,��e���1C���q�M�E�,�M�!�,�U�3�E���!.�q�!1�:�t�E�{�!L�M�M���;�$��
#����?�A�$�Q�'�4�/���G�s�N� ������)@�)@�����)K�(L�M� ���)9��q�)9�!�)<�(=�>�?���
�
�a�0@� @�A�A��E�#(����Z� ��=�
#�"���
#�"��
#��$�
#�"���
#�"��
#�s2�:A<J�+A:J(�J%�
J%�$J%�(K�5
K�KN)	r	r
r�__doc__rOr�r�r�r�rr
rr�r�+s#���)A�V�: �6 �8U)r
r�c�T�eZdZdZd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zy)�
SSSDDomainz2
    Object to manipulate SSSD domain options
    c��tj|�t|t�rt	|�t
k7rt�||_||_d|_	d|_
g|_i|_|jj|jjd��|jj|jjd��y)a
        Creates a new, empty SSSDDomain. This domain is inactive by default.
        This constructor should not be used directly. Use
        SSSDConfig.new_domain() instead.

        name:
          The domain name.
        apischema:
          An SSSDConfigSchema object created by SSSDConfig.__init__()

        === Returns ===
        The newly-created SSSDDomain object.

        === Errors ===
        TypeError:
          apischema was not an SSSDConfigSchema object or domainname was not
         a string
        FNr�r�)r�rOr�r<rlrJr�rdr��active�oldnamer�rgr�r�)r[�
domainnamer�s   rrOzSSSDDomain.__init__
s���&	�!�!�$�'��)�%5�6�$�z�:J�c�:Q��O���	����������������	
�����D�K�K�4�4�Z�@�A������D�K�K�4�4�X�>�?r
c�$�t|�|_y)ad
        Enable or disable this domain

        active:
          Boolean value. If True, this domain will be added to the active
          domains list when it is saved. If False, it will be removed from the
          active domains list when it is saved.

        === Returns ===
        No return value

        === Errors ===
        No errors
        N)rFr�)r[r�s  r�
set_activezSSSDDomain.set_active/s���6�l��r
c��i}|j|jjd��|j|jjd��|jD]f\}}|jjd|z�}|j|�|jjd|�d|���}|j|��h|S)ag
        List options for the currently-configured providers, including the
        mandatory flag

        === Returns ===
        A dictionary of configurable options. This dictionary is keyed on the
        option name with a tuple of the variable type, subtype ('None' if the
        type is not  a collection type), whether it is mandatory, the
        translated option description, and the default value (or 'None') as
        the value.

        Example:
        { 'enumerate' :
          (bool, None, False, u'Enable enumerating all users/groups', True) }

        === Errors ===
        No errors
        r�r��provider/%s�	provider/rD)r�r�rr�)r[rgr��providertyper�s     rr�z&SSSDDomain.list_options_with_mandatory@s���&�����t�{�{�.�.�z�:�;����t�{�{�.�.�x�8�9�)-���	+�$�X�|�!�[�[�4�4�]�7?�6@�A�N��N�N�>�*�!�[�[�4�4�8@�,�6P�Q�N��N�N�>�*�
	+��r
c��|j�}i}|j�D]#}||d||d||d||df||<�%|S)a$
        List options available for the currently-configured providers.

        === Returns ===
        A dictionary of configurable options. This dictionary is keyed on the
        option name with a tuple of the variable type, subtype ('None' if the
        type is not  a collection type), the translated option description, and
        the default value (or 'None') as the value.

        Example:
        { 'enumerate' :
          (bool, None, u'Enable enumerating all users/groups', True) }

        === Errors ===
        No errors
        rrrarer�r�s    rr�zSSSDDomain.list_optionsdr�r
c��|j�}i}|j�D],}||ds�||d||d||d||df||<�.|S)a$
        List mandatory options for the currently-configured providers.

        === Returns ===
        A dictionary of configurable options. This dictionary is keyed on the
        option name with a tuple of the variable type, subtype ('None' if the
        type is not  a collection type), the translated option description, and
        the default value (or 'None') as the value.

        Example:
        { 'enumerate' :
          (bool, None, u'Enable enumerating all users/groups', True) }

        === Errors ===
        No errors
        rErrrarer�r�s    rr�z!SSSDDomain.list_mandatory_optionsr�r
Nc� �|jjd|z�}|r2|j|jjd|�d|����|S|j�}||D]#}|j|j	||���%|S)a�
        If provider_type is specified, list all options applicable to that
        target, otherwise list all possible options available for a provider.

        type:
            Provider backend type. (e.g. local, ldap, krb5, etc.)
        provider_type:
            Subtype of the backend type. (e.g. id, auth, access, chpass)

        === Returns ===

        A dictionary of configurable options for the specified provider type.
        This dictionary is keyed on the option name with a tuple of the
        variable type, subtype ('None' if the type is not  a collection type),
        the translated option description, and the default value (or 'None')
        as the value.

        === Errors ===

        NoSuchProviderError:
            The specified provider is not listed in the schema or plugins
        NoSuchProviderSubtypeError:
            The specified provider subtype is not listed in the schema
        r�r�rD)r�rr��list_providers�list_provider_options)r[r��
provider_typerg�known_providerss     rr�z SSSDDomain.list_provider_options�s���6�+�+�)�)�-�(�*B�C����N�N�4�;�;�2�2�4<�m�4M�N�
O���	#�1�1�3�O�!0��!:�
J�
����t�9�9�(�:G� I�J�
J��r
c�6�|jj�S)a>
        Return a dictionary of providers.

        === Returns ===
        Returns a dictionary of providers, keyed on the primary type, with the
        value being a tuple of the subtypes it supports.

        Example:
        { 'ldap' : ('id', 'auth', 'chpass') }

        === Errors ===
        No Errors
        )r�r�r�s rr�zSSSDDomain.list_providers�s���{�{�(�(�*�*r
c
��|j�}||j�vrtd|j�d|�d���|dk(r|j	|�y||}d}|dt
k(rBt
|�t
k7r0t
|�tk(rt|jd��}n|g}t
|�|dk7r�	|dtk(r:t
|�tk(r(|jj|j�}n6|dtk(rt
|�tk(r
t|d�}n|d|�}|r t#d	|d�d
|�dt
|�����t
|�t
k(r�	g}|D]s}|dtk(rJt
|�tk(r8|j%|jj|j�g��Y|j%|d|�g��u	|rt#d
|dz��}|j'd�}|dkDr|d|}		|j)||	�y||j,|<y#t$rd}Y��t $rd}Y��wxYw#t$rd}Y��t $rd}Y��wxYw#t*$rt�wxYw)a
        Set a domain option to the specified value (or values)

        option:
          The option to change.
        value:
          The value to set. This may be a single value or a list of values.
          If it is set to None, it resets the option to its default.

        === Returns ===
        No return value.

        === Errors ===
        NoOptionError:
            The specified option is not listed in the schema
        TypeError:
            The value specified was not of the expected type
        r�r�r�NFrrcTr�r�r�rr��	_provider)r�r�rrdr�rKrlrJr3rirFr�rZrmrGrnr�r�ro�rfind�add_providerr)rg)
r[r9rbrgr�r�r~r2�is_providerr�s
          rr�zSSSDDomain.set_option�s���&�#�#�%���'�,�,�.�(��!%���F�!4�5�
5��D�=����v�&�����
���
���t�#��U��t�(;��E�{�c�!�!�%�+�+�c�"2�3�������;�-��*�*�
#� ��#�t�+��U��s�"� �K�K�3�3�E�K�K�M�B�E�"�1�%��,��e���1C���q�M�E�,�M�!�,�U�3�E���!.�q�!1�6�4��;�!H�I�I���;�$��
#����?�A�$�Q�'�4�/���G�s�N� ������)@�)@�����)K�(L�M� ���)9��q�)9�!�)<�(=�>�?���
�
�a�0@� @�A�A��E��l�l�;�/���!�O��l�{�+�H�
$��!�!�%��2�$)�D�L�L�� ��M�
#�"���
#�"��
#��$�
#�"���
#�"��
#��'�
$�#�#�
$�s>�=A<H=�.A:I�I9�=I�
I�I�I6�)
I6�5I6�9J	c�|�t|�tk7rt�|js|j|_||_y)z�
        Change the name of the domain

        newname:
          New name for this domain

        === Returns ===
        No return value.

        === Errors ===
        TypeError:
          newname was not a string
        N)rlrJr�r�rd)r[�newnames  r�set_namezSSSDDomain.set_name-s.����=�C���O��|�|��9�9�D�L���	r
c��|j�}||j�vr|||vrt|��t�|jD�cgc]
}|d|k(s�|��}}t|�dkDrt�t|�dk(r|dd|k7r/t
|dd��|jj||fg�d|z}||j|<|jj|jjd|z��|jj|jjd|�d|����ycc}w)aH
        Add a new provider type to the domain

        type:
          Provider backend type. (e.g. local, ldap, krb5, etc.)
        subtype:
          Subtype of the backend type. (e.g. id, auth, chpass)

        === Returns ===
        No return value.

        === Errors ===
        ProviderSubtypeInUse:
          Another backend is already providing this subtype
        NoSuchProviderError:
          The specified provider is not listed in the schema or plugins
        NoSuchProviderSubtypeError:
          The specified provider subtype is not listed in the schema
        rr�%s_providerr�r�rDN)r�r�r+r)r�rjr-rorgr�r�r�)r[r�r��configured_providersr2�with_this_type�option_names       rr�zSSSDDomain.add_providerDsH��* $�2�2�4���+�0�0�2�2��$8��$B�B�0��?�?�%�%�&*�^�^�M��q��t�}�7L�!�M��M��~���"�&�&��~��!�#��a� ��#�x�/�*�>�!�+<�Q�+?�@�@��N�N�!�!�H�m�#<�"=�>�#�m�3��$,����[�!�	
�����D�K�K�4�4�]�5=�6>�?�	@������D�K�K�4�4�6>�6C�6E�F�	G��!Ns�	
D?�D?c���d}|jD]\}}||k(rnd}�|sy|j||�}|jD]S\}}||f||fk(r�|j||�}t|j�|j��}|D]}||=��U|D]}	|	|jvs�|j|	=� d|z}	|	|jvr
|j|	=|jj||f�y)a
        Remove a provider from the domain. If the provider is not present, it
        is ignored.

        provider_type:
          Subtype of the backend type. (e.g. id, auth, chpass)

        === Returns ===
        No return value.

        === Errors ===
        No Errors
        Nr�)r�r�r:r�rg�remove)
r[r�r��ptyperg�prov�provider_optionsr8�optr9s
          r�remove_providerzSSSDDomain.remove_providerus#����!%���	��X�u��
�%���H�	����,�,�X�}�E��"�^�^�	!�M�T�5��e�}��=� 9�9��#�9�9�$��F��%�g�l�l�n�6F�6K�6K�6M�N�G��
!���C�L�
!�	!��	)�F�����%��L�L��(�	)�
��.���T�\�\�!����V�$������x��7�8r
r/)r	r
rr�rOr�r�r�r�r�r�r�r�r�r�rr
rr�r�sF���#@�J#�""�H �6 �8%�N+� Y)�v�./G�b39r
r�c��eZdZdZdd�Zdd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
SSSDConfigzQ
    class SSSDConfig
    Primary class for operating on SSSD configurations
    Nc�z�tj|�t||�|_d|_d|_d|_y)a+
        Initialize the SSSD config parser/editor. This constructor does not
        open or create a config file. If the schemafile and schemaplugindir
        are not passed, it will use the system defaults.

        schemafile:
          The path to the API schema config file. Usually
          /usr/share/sssd/sssd.api.conf
        schemaplugindir:
          The path the directory containing the provider schema config files.
          Usually /usr/share/sssd/sssd.api.d

        === Returns ===
        The newly-created SSSDConfig object.

        === Errors ===
        IOError:
          Exception raised when the schema file could not be opened for
          reading.
        ParsingError:
          The main schema file or one of those in the plugin directory could
          not be parsed.
        NFrE)rrOr<r��
configfile�initialized�API_VERSION)r[r\r]s   rrOzSSSDConfig.__init__�s7��0	����%�&�z�?�C������ �����r
c�`�|jrt�|sd}t|d�5}	|j|�	ddd�||_d|_	t|jdd��|jk7rtd��y#t$rt
�wxYw#1swY�_xYw#t$rYywxYw)a�
        Read in a config file, populating all of the service and domain
        objects with the read values.

        configfile:
          The path to the SSSD config file. If not specified, use the system
          default, usually /etc/sssd.conf

        === Returns ===
        No return value

        === Errors ===
        IOError:
          Exception raised when the file could not be opened for reading
        ParsingError:
          Exception raised when errors occur attempting to parse a file.
        AlreadyInitializedError:
          This SSSDConfig object was already initialized by a call to
          import_config() or new_config()
        z/etc/sssd/sssd.confr>NT�sssd�config_file_versionzWrong config_file_version)r�rrPrQ�	Exceptionrr�rG�getr�r�)r[r�r^s   r�
import_configzSSSDConfig.import_config�s���*���)�)��.�J�
�*�c�
"�	#�b�
#����B��	#�%������	��4�8�8�F�$9�:�;�t�?O�?O�O�"�#>�?�?�P���
#�"�"�
#��	#�	#���	�
�	�s.�B�B�3B!�B�B�B�!	B-�,B-c��|jrt�d|_|jj�D]}|j	|�}�y)a/
        Initialize the SSSDConfig object with the defaults from the schema.

        === Returns ===
        No return value

        === Errors ===
        AlreadyInitializedError:
          This SSSDConfig object was already initialized by a call to
          import_config() or new_config()
        TN)r�rr�r��new_service)r[r�r�s   r�
new_configzSSSDConfig.new_config�sI�����)�)���� �;�;�3�3�5�	4�K��&�&�{�3�G�	4r
c�b�|jst�|dk(r!|jdk(rt�|j}t	j
d�}t
|d�5}|j|j�}|j|�ddd�t	j
|�y#1swY�xYw)a�
        Write out the configuration to a file.

        outputfile:
          The path to write the new config file. If it is not specified, it
          will use the path specified by the import() call.
        === Returns ===
        No return value

        === Errors ===
        IOError:
          Exception raised when the file could not be opened for writing
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        NoOutputFileError:
          No outputfile was specified and this SSSDConfig object was not
          initialized by import()
        N��w)
r�rr�rrS�umaskrP�dump�opts�write)r[�
outputfile�	old_umask�of�outputs     rrzSSSDConfig.writes���(���%�%�������$�&�'�'����J��H�H�U�O�	�
�*�c�
"�	�b��Y�Y�t�y�y�)�F��H�H�V��	�	�����	�	�s�-B%�%B.c�H�|jst�|jdd�r{t|j	dd�jd��}tj|�}d|vr|d=|j�}t|�D]
}||vs�||=�t|�}|Sg}|S)a
        Return a list of all active services.

        === Returns ===
        The list of active services.

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        r��servicesrc�)
r�rr�r3r�rir��fromkeys�
list_servicesrK)r[�active_services�service_dict�configured_services�srvs     r�list_active_serviceszSSSDConfig.list_active_services3s������%�%��O�O�F�J�/�'������(D�(J�(J�3�(O�P�O��=�=��9�L��\�!� ��$�#'�"4�"4�"6���L�)�
*���1�1�$�S�)�
*�#�<�0�O���!�O��r
c���|jst�|jdd�r+t|j	dd�jd��}ng}|j
�D�cgc]}||vr|��
}}|Scc}w)a
        Return a list of all disabled services.

        === Returns ===
        The list of inactive services.

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        r�rrc)r�rr�r3r�rir)r[rr2rs    r�list_inactive_servicesz!SSSDConfig.list_inactive_servicesUs}�����%�%��O�O�F�J�/�'������(D�(J�(J�3�(O�P�O� �O�#�1�1�3�0�!���.��0��0����0s�$
A5c��|jst�|j�D�cgc]}|djd�s|d��}}|Scc}w)a
        Retrieve a list of known services.

        === Returns ===
        The list of known services.

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        rdr��r�rr�r�r�s   rrzSSSDConfig.list_servicesmsZ�����%�%�+/�=�=�?�@�a� ��y�3�3�H�=��&�	�@��@����@s� A	c��|jst�|j|�st�t	||j
�}|j
|j|��D]}	|j|d|d��|S#t$rY�+wxYw)a�
        Get an SSSDService object to edit a service.

        name:
          The name of the service to return.

        === Returns ===
        An SSSDService instance containing the current state of a service in
        the SSSDConfig

        === Errors ===
        NoServiceError:
          There is no such service with the specified name in the SSSDConfig.
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        rdrb)
r�rrfrr�r�rhrgr�r)r[rdr�r�s    r�get_servicezSSSDConfig.get_service�s���$���%�%�����%� � ��d�D�K�K�0���,�,�T�\�\�$�-?�@�	�C�
��"�"�3�v�;��G��=�	����!�
��
�s�$B�	B�Bc��|jst�|j|�rt|��t	||j
�}|j
|�|S)a�
        Create a new service from the defaults and return the SSSDService
        object for it. This function will also add this service to the list of
        active services in the [SSSD] section.

        name:
          The name of the service to create and return.

        === Returns ===
        The newly-created SSSDService object

        === Errors ===
        ServiceNotRecognizedError:
          There is no such service in the schema.
        ServiceAlreadyExistsError:
          The service being created already exists in the SSSDConfig object.
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        )r�rrfr!r�r��save_service)r[rdr�s   rr�zSSSDConfig.new_service�sO��*���%�%����T�"�&�t�,�,��d�D�K�K�0�����'�"��r
c��|jst�||j�vrt�|j	dd�d}|s|jdd|�ytjt|djd���}d|vr|d=d||<|jdddj|j���y)	a�
        Activate a service

        name:
          The name of the service to activate

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        NoServiceError:
          There is no such service with the specified name in the SSSDConfig.
        r�rrNrbrcr�, �r�rrr�get_option_index�setr�r
r3ri�joinr��r[rd�itemrs    r�activate_servicezSSSDConfig.activate_service�s���$���%�%��t�)�)�+�+� � ��$�$�V�Z�8��;����H�H�V�J��-��
�}�}�Y�t�G�}�/B�/B�3�/G�%H�I��
����R� �"��T��	
����
�D�I�I�l�.?�.?�.A�$B�Cr
c��|jst�||j�vrt�|j	dd�d}|s|jddd�ytjt|djd���}d|vr|d=||vr||=|jdddj|j���y)	a�
        Deactivate a service

        name:
          The name of the service to deactivate

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        NoServiceError:
          There is no such service with the specified name in the SSSDConfig.
        r�rrrNrbrcrrr"s    r�deactivate_servicezSSSDConfig.deactivate_service�s���$���%�%��t�)�)�+�+� � ��$�$�V�Z�8��;����H�H�V�J��+��
�}�}�Y�t�G�}�/B�/B�3�/G�%H�I��
����R� ��<���T�"�	
����
�D�I�I�l�.?�.?�.A�$B�Cr
c�L�|jst�|jd|�y)a�
        Remove a service from the SSSDConfig object. This function will also
        remove this service from the list of active services in the [SSSD]
        section. Has no effect if the service does not exist.

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        rpN)r�r�
delete_option�r[rds  r�delete_servicezSSSDConfig.delete_services#�����%�%����9�d�+r
c��|jst�t|t�st�|j�}|j
d|�}g}|j�j�D]\\}}t|�tk(rdj|�}|dk(r|j|�}|jd|t|�d���^|j|||�y)a�
        Save the changes made to the service object back to the SSSDConfig
        object.

        service_object:
          The SSSDService object to save to the configuration.

        === Returns ===
        No return value
        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        TypeError:
          service_object was not of the type SSSDService
        rpr�debug_levelr9)rlrdrbN)r�rr�r�r�r�r(r��itemsrlrKr!�_get_debug_level_valr5rJ�add_section)r[r�rd�index�addkwr9rbs       rrzSSSDConfig.save_service&s���"���%�%��'�;�/��O����!���"�"�9�d�3����#�3�3�5�;�;�=�	5�L�F�5��U��t�#��	�	�%�(����&��1�1�%�8���L�L�h�&,�&)�%�j�3�
5�	5�	
����u�e�,r
c��|jst�|jdd�rRt|j	dd�jd��}tj|�}d|vr|d=t|�}ng}|j�}|j�D]n}|jd|zd�rA|j	d|zd�dk(s�1|j|�||vs�G|j|��Y||vs�^|j|��p|S)a
        Return a list of all active domains.

        === Returns ===
        The list of configured, active domains.

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        r��domainsrcr�	domain/%s�enabledrM�r�rr�r3r�rir�r
rK�list_domainsr��r[�sssd_domains�domain_dictr3�doms     r�list_active_domainszSSSDConfig.list_active_domainsPs������%�%��O�O�F�I�.�$�T�X�X�f�i�%@�%F�%F�s�%K�L�L��-�-��5�K��[� ���O���,�L��L��#�#�%���$�$�&�		(�C����{�S�0�)�<��8�8�K�#�-�y�9�W�D��N�N�3�'��l�*�$�+�+�C�0��l�*��N�N�3�'�		(��r
c���|jst�|jdd�rRt|j	dd�jd��}tj|�}d|vr|d=t|�}ng}|j�}|j�D]X}|jd|zd�r+|j	d|zd�dk(s�1|j|��C||vs�H|j|��Z|S)a.
        Return a list of all configured, but disabled domains.

        === Returns ===
        The list of configured, inactive domains.

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        r�r3rcrr4r5rNr6r8s     r�list_inactive_domainsz SSSDConfig.list_inactive_domainsvs������%�%��O�O�F�I�.�$�T�X�X�f�i�%@�%F�%F�s�%K�L�L��-�-��5�K��[� ���O���,�L��L��#�#�%���$�$�&�	(�C����{�S�0�)�<��8�8�K�#�-�y�9�V�C��N�N�3�'��,�&��N�N�3�'�	(��r
c��|jst�|j�D�cgc]}|djd�s�|ddd��!}}|Scc}w)aL
        Return a list of all configured domains, including inactive domains.

        === Returns ===
        The list of configured domains, both active and inactive.

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        rdzdomain/�Nr)r[r2r3s   rr7zSSSDConfig.list_domains�sS�����%�%�*.�-�-�/�]�Q�Q�v�Y�=Q�=Q�R[�=\�1�V�9�Q�R�=�]��]����^s
�A
�
A
c�
�|jst�|jd|z�st|��t	||j
�}|j
|jd|z��D�cgc]#}|djd�dkDr
|d|df��%}}ddddddddddd	�
}|j�}|D�cgc]}|d��	}}d
|vr|jd�|j�D]l\}}	||vr�|	|vs�||j|	�}
|
d|j�vs�:|d|jd�||
dvs�W|j||
df��n|D]\}}	|j||��|j
|jd|z��D](}
|
d|
df|vs�	|j|
d|
d��*|j!|�|_|Scc}wcc}w#t$rY��wxYw#t$rY�gwxYw)
a�
        Get an SSSDDomain object to edit a domain.

        name:
          The name of the domain to return.

        === Returns ===
        An SSSDDomain instance containing the current state of a domain in the
        SSSDConfig

        === Errors ===
        NoDomainError:
          There is no such domain with the specified name in the SSSDConfig.
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        r4rdr�rrbN�id_provider�
auth_provider)
rB�
sudo_providerrC�chpass_provider�autofs_provider�selinux_provider�subdomains_provider�session_provider�hostid_provider�resolver_provider�access_provider)rL�permitr)r�rrfr#r�r�rhrgr�r�r5r-r0r�r�r�is_domain_activer�)r[rdr�r2r��default_providersr��providers_listr��default_provider�default_provider_valuer9rbr�s              r�
get_domainzSSSDConfig.get_domain�s{��$���%�%�����d� 2�3���%�%��D�$�+�+�.��7;�6O�6O�PT�P\�P\�]h�ko�]o�Pp�6q�:���&�	����4�q�8���y��7��,�:�	�:�
 �*�*�.�,� -�#0� -�,�!.�
�� &�4�4�6��(1�2�1�!�A�$�2��2��N�2����:�;�*;�*A�*A�*C�	P�&�H�&��>�)���>�1�)2�>�3G�3G�HX�3Y�)Z�&�)�!�,�0D�0I�0I�0K�K�� <�����!<�=�AU�Vl�mn�Vo�Ap�p�!�(�(�(�4J�1�4M�)N�O�	P� )�	�O�V�U�
��!�!�&�%�0�	��,�,�T�\�\�+��:L�-M�N�	�C��F��S��\�*�)�;���%�%�c�&�k�3�w�<�@�	��-�-�d�3��
��
��m:��$3��$!�
��
��%����s0�-(G�8G"�#G'�+G6�'	G3�2G3�6	H�Hc��|jst�|jd|z�rt�t	||j
�}|j
|�|S)a�
        Create a new, empty domain and return the SSSDDomain object for it.

        name:
          The name of the domain to create and return.

        === Returns ===
        The newly-created SSSDDomain object

        === Errors ===
        DomainAlreadyExistsError:
          The service being created already exists in the SSSDConfig object.
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        r4)r�rrfr'r�r��save_domain)r[rdr�s   r�
new_domainzSSSDConfig.new_domain�sO��"���%�%����K�$�.�/�*�*��D�$�+�+�.������ ��
r
c�z�|jst�||j�vrt�||j	�vS)a�
        Is a particular domain set active

        name:
          The name of the configured domain to check

        === Returns ===
        True if the domain is active, False if it is inactive

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        NoDomainError:
          No domain by this name is configured
        )r�rr7r#r<r)s  rrNzSSSDConfig.is_domain_actives>��$���%�%��t�(�(�*�*����t�/�/�1�1�1r
c��|jst�||j�vrt�|j	dd�d}|s|jdd|�ytjt|djd���}d|vr|d=d||<|jdddj|j���y)	a�
        Activate a configured domain

        name:
          The name of the configured domain to activate

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        NoDomainError:
          No domain by this name is configured
        r�r3rNrbrcrr�r�rr7r#rr r�r
r3rir!r��r[rdr#r:s    r�activate_domainzSSSDConfig.activate_domain2s���$���%�%��t�(�(�*�*����$�$�V�Y�7��:����H�H�V�I�t�,��
�m�m�I�d�7�m�.A�.A�#�.F�$G�H��
����B��!��D��	
����	�4�9�9�[�-=�-=�-?�#@�Ar
c��|jst�||j�vrt�|j	dd�d}|s|jddd�ytjt|djd���}d|vr|d=||vr||=|jdddj|j���y)	a�
        Deactivate a configured domain

        name:
          The name of the configured domain to deactivate

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        NoDomainError:
          No domain by this name is configured
        r�r3rrNrbrcrrYrZs    r�deactivate_domainzSSSDConfig.deactivate_domain\s���$���%�%��t�(�(�*�*����$�$�V�Y�7��:����H�H�V�I�r�*��
�m�m�I�d�7�m�.A�.A�#�.F�$G�H��
����B���;���D�!�	
����	�4�9�9�[�-=�-=�-?�#@�Ar
c�t�|jst�|j|�|jdd|z�y)a�
        Remove a domain from the SSSDConfig object. This function will also
        remove this domain from the list of active domains in the [SSSD]
        section, if it is there.

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        rpr4N)r�rr]r(r)s  r�
delete_domainzSSSDConfig.delete_domain�s8�����%�%�	
���t�$����9�k�D�&8�9r
c��|jst�t|t�st�|j�}d}|jrP|j|k7rA|j|j�|jdd|jz�}d|_d|z}|j|jd|�\}}||j�vr|j|g�|j|�dd}|D];}|ddk(s�|d|j�vs�"|j|dd|dd��=|j�j!�D]Z\}}	t#|	�t$k(rd	j'|	�}	|d
k(r|j)|	�}	|j+||t-|	���\|j.r|j1|�y|j|�y)a9
        Save the changes made to the domain object back to the SSSDConfig
        object. If this domain is marked active, ensure it is present in the
        active domain list in the [SSSD] section

        domain_object:
          The SSSDDomain object to save to the configuration.

        === Returns ===
        No return value

        === Errors ===
        NotInitializedError:
          This SSSDConfig object has not had import_config() or new_config()
          run on it yet.
        TypeError:
          domain_object was not of type SSSDDomain
        Nrpr4rlr9rdrbTrr,)r�rr�r�r�r�r�r]r(�findOptsrr7r/rgr��delete_option_subtreer-rlrKr!r.r rJr�r[)
r[r�rd�oldindex�sectionname�no�section_subtree�section_optionsr9rbs
          rrUzSSSDConfig.save_domain�s���&���%�%��&�*�-��O���� �����>�>�f�n�n��4�
�"�"�6�>�>�2��)�)�)�[�*0�.�.�69�:�H�
"�F�N�!�D�(�� $�
�
�d�i�i��K� P���_��t�(�(�*�*����[�"�-��,�,�{�3�A�6��%�	i�F��f�~��)��&�>��)?�)?�)A�A��.�.��w�/G��SY�Z`�Sa�cg�h�	i�
#�2�2�4�:�:�<�	6�L�F�5��U��t�#��	�	�%�(����&��1�1�%�8���H�H�[�&�#�e�*�5�	6��=�=�� � ��&��"�"�4�(r
)NNr/)r	r
rr�rOr�r�rrrrrr�r$r&r*rr<r>r7rSrVrNr[r]r_rUrr
rr�r��s�����<+�Z4�*"�H �D�0�& �D�<(D�T(D�T,�$(-�T$�L"�H�"Q�f�42�4(B�T(B�T:�*=)r
r�)!r�rSr@rW�sssdoptionsr�
ipachangeconfrr�rrrrrrrrrr!r#r%r'r)r+r-r3r:r<�objectr�r�r�r�rr
r�<module>rks����
�	�
�$�)�+�)�*�#�9�#�8�1�8�4�-�4�2�+�2�/�(�/�/�(�/�.�'�.�:� 3�:�5�.�5�.�'�.�4�-�4�9�2�9�4�-�4�;�!4�;�5�.�5�#��D�~�D�L:)�v�:)�xY)�"�Y)�vb9�!�b9�H
n)��n)r

Zerion Mini Shell 1.0