Ë
    oj�  ã                   óp   — d Z ddlmZmZ ddgZ G d„ d«      Z G d„ d«      Z G d„ d	«      Z G d
„ d«      Zy)zM
L{twisted.python.fakepwd} provides a fake implementation of the L{pwd} API.
é    )ÚListÚOptionalÚUserDatabaseÚShadowDatabasec                   óJ   — e Zd ZdZdededededededed	d
fd„Zd	efd„Zd„ Zy
)Ú_UserRecordzÉ
    L{_UserRecord} holds the user data for a single user in L{UserDatabase}.
    It corresponds to the C{passwd} structure from the L{pwd} module.
    See that module for attribute documentation.
    ÚnameÚpasswordÚuidÚgidÚgecosÚhomeÚshellÚreturnNc                 óf   — || _         || _        || _        || _        || _        || _        || _        y ©N©Úpw_nameÚ	pw_passwdÚpw_uidÚpw_gidÚpw_gecosÚpw_dirÚpw_shell)Úselfr	   r
   r   r   r   r   r   s           ú8/usr/lib/python3/dist-packages/twisted/python/fakepwd.pyÚ__init__z_UserRecord.__init__   s5   € ð ˆŒØ!ˆŒØˆŒØˆŒØˆŒØˆŒØˆ�ó    c                  ó   — y)Né   © ©r   s    r   Ú__len__z_UserRecord.__len__'   ó   € Ør   c                 ó¦   — | j                   | j                  | j                  | j                  | j                  | j
                  | j                  f|   S r   r   ©r   Úindexs     r   Ú__getitem__z_UserRecord.__getitem__*   sG   € à�L‰LØ�N‰NØ�K‰KØ�K‰KØ�M‰MØ�K‰KØ�M‰Mð
ð ñð 	r   ©	Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚintr   r#   r(   r!   r   r   r   r      sk   „ ñðàðð ðð ð	ð
 ðð ðð ðð ðð 
óð$˜ó ó	r   r   c                   óº   — e Zd ZU dZee   ed<   dZeed<   dZ	eed<   dd	„Z
	 	 	 	 	 	 dded
edee   dee   dedededdfd„Zdedefd„Zdedefd„Zdee   fd„Zy)r   zí
    L{UserDatabase} holds a traditional POSIX user data in memory and makes it
    available via the same API as L{pwd}.

    @ivar _users: A C{list} of L{_UserRecord} instances holding all user data
        added to this database.
    Ú_usersiu'  Ú_lastUIDiêN  Ú_lastGIDr   Nc                 ó   — g | _         y r   ©r1   r"   s    r   r   zUserDatabase.__init__C   ó	   € Øˆ�r   r
   Úusernamer   r   r   r   r   c           	      óè   — |€!| j                   }| xj                   dz  c_         |€!| j                  }| xj                  dz  c_        t        |||||||«      }| j                  j	                  |«       y)aâ  
        Add a new user record to this database.

        @param username: The value for the C{pw_name} field of the user
            record to add.

        @param password: The value for the C{pw_passwd} field of the user
            record to add.

        @param uid: The value for the C{pw_uid} field of the user record to
            add.

        @param gid: The value for the C{pw_gid} field of the user record to
            add.

        @param gecos: The value for the C{pw_gecos} field of the user record
            to add.

        @param home: The value for the C{pw_dir} field of the user record to
            add.

        @param shell: The value for the C{pw_shell} field of the user record to
            add.
        Né   )r2   r3   r   r1   Úappend)	r   r7   r
   r   r   r   r   r   ÚnewUsers	            r   ÚaddUserzUserDatabase.addUserF   se   € ðD ˆ;Ø—-‘-ˆCØ�MŠM˜QÑ�MØˆ;Ø—-‘-ˆCØ�MŠM˜QÑ�MÜ˜h¨°#°s¸EÀ4ÈÓOˆØ�‰×Ñ˜7Õ#r   c                 ó^   — | j                   D ]  }|j                  |k(  sŒ|c S  t        «       ‚)zH
        Return the user record corresponding to the given uid.
        )r1   r   ÚKeyError)r   r   Úentrys      r   ÚgetpwuidzUserDatabase.getpwuidq   s2   € ð —[‘[ò 	ˆEØ�|‰|˜sÓ"Ø’ð	ô ‹jÐr   r	   c                 ó¬   — t        |t        «      st        dt        |«      › �«      ‚| j                  D ]  }|j
                  |k(  sŒ|c S  t        «       ‚)zM
        Return the user record corresponding to the given username.
        z%getpwuam() argument must be str, not )Ú
isinstancer.   Ú	TypeErrorÚtyper1   r   r>   )r   r	   r?   s      r   ÚgetpwnamzUserDatabase.getpwnamz   sS   € ô ˜$¤Ô$ÜÐCÄDÈÃJÀ<ÐPÓQÐQØ—[‘[ò 	ˆEØ�}‰} Ó$Ø’ð	ô ‹jÐr   c                 ó   — | j                   S )z4
        Return a list of all user records.
        r5   r"   s    r   ÚgetpwallzUserDatabase.getpwall…   ó   € ð �{‰{Ðr   ©r   N)r
   NNÚ rJ   z/bin/sh)r*   r+   r,   r-   r   r   Ú__annotations__r2   r/   r3   r   r.   r   r<   r@   rE   rG   r!   r   r   r   r   6   sÔ   … ñð �ÑÓØ€HˆcÓØ€HˆcÓóð #Ø!Ø!ØØØñ)$àð)$ð ð)$ð �c‰]ð	)$ð
 �c‰]ð)$ð ð)$ð ð)$ð ð)$ð 
ó)$ðV˜Cð  Kó ð	˜Sð 	 [ó 	ð˜$˜{Ñ+ô r   c                   óR   — e Zd ZdZdededededededed	ed
eddfd„Zdefd„Zd„ Zy)Ú_ShadowRecordzº
    L{_ShadowRecord} holds the shadow user data for a single user in
    L{ShadowDatabase}.  It corresponds to C{spwd.struct_spwd}.  See that class
    for attribute documentation.
    r7   r
   Ú
lastChangeÚminÚmaxÚwarnÚinactÚexpireÚflagr   Nc
                 ó‚   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y r   ©	Úsp_namÚsp_pwdÚ	sp_lstchgÚsp_minÚsp_maxÚsp_warnÚsp_inactÚ	sp_expireÚsp_flag©
r   r7   r
   rN   rO   rP   rQ   rR   rS   rT   s
             r   r   z_ShadowRecord.__init__“   sC   € ð ˆŒØˆŒØ#ˆŒØˆŒØˆŒØˆŒØˆŒØˆŒØˆ�r   c                  ó   — y)Né	   r!   r"   s    r   r#   z_ShadowRecord.__len__©   r$   r   c           	      óÒ   — | j                   | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  f	|   S r   rV   r&   s     r   r(   z_ShadowRecord.__getitem__¬   sU   € à�K‰KØ�K‰KØ�N‰NØ�K‰KØ�K‰KØ�L‰LØ�M‰MØ�N‰NØ�L‰Lð

ð ñ
ð 
	r   r)   r!   r   r   rM   rM   Œ   s   „ ñðàðð ðð ð	ð
 ðð ðð ðð ðð ðð ðð 
óð,˜ó ór   rM   c                   óp   — e Zd ZU dZee   ed<   dd„Zdedede	d	e	d
e	de	de	de	de	ddfd„Z
dedefd„Zd„ Zy)r   zý
    L{ShadowDatabase} holds a shadow user database in memory and makes it
    available via the same API as C{spwd}.

    @ivar _users: A C{list} of L{_ShadowRecord} instances holding all user data
        added to this database.

    @since: 12.0
    r1   r   Nc                 ó   — g | _         y r   r5   r"   s    r   r   zShadowDatabase.__init__Ç   r6   r   r7   r
   rN   rO   rP   rQ   rR   rS   rT   c
                 ó\   — | j                   j                  t        |||||||||	«	      «       y)a‘  
        Add a new user record to this database.

        @param username: The value for the C{sp_nam} field of the user record to
            add.

        @param password: The value for the C{sp_pwd} field of the user record to
            add.

        @param lastChange: The value for the C{sp_lstchg} field of the user
            record to add.

        @param min: The value for the C{sp_min} field of the user record to add.

        @param max: The value for the C{sp_max} field of the user record to add.

        @param warn: The value for the C{sp_warn} field of the user record to
            add.

        @param inact: The value for the C{sp_inact} field of the user record to
            add.

        @param expire: The value for the C{sp_expire} field of the user record
            to add.

        @param flag: The value for the C{sp_flag} field of the user record to
            add.
        N)r1   r:   rM   r`   s
             r   r<   zShadowDatabase.addUserÊ   s2   € ðP 	�‰×ÑÜØ˜( J°°S¸$ÀÀvÈtóõ	
r   c                 ó®   — t        |t        «      st        dt        |«      › �«      ‚| j                  D ]  }|j
                  |k(  sŒ|c S  t        |«      ‚)zT
        Return the shadow user record corresponding to the given username.
        z%getspnam() argument must be str, not )rB   r.   rC   rD   r1   rW   r>   )r   r7   r?   s      r   ÚgetspnamzShadowDatabase.getspnamø   sW   € ô ˜(¤CÔ(ÜÐCÄDÈÃNÐCSÐTÓUÐUØ—[‘[ò 	ˆEØ�|‰|˜xÓ'Ø’ð	ô �xÓ Ð r   c                 ó   — | j                   S )z;
        Return a list of all shadow user records.
        r5   r"   s    r   ÚgetspallzShadowDatabase.getspall  rH   r   rI   )r*   r+   r,   r-   r   rM   rK   r   r.   r/   r<   rh   rj   r!   r   r   r   r   º   s™   … ñð �ÑÓóð,
àð,
ð ð,
ð ð	,
ð
 ð,
ð ð,
ð ð,
ð ð,
ð ð,
ð ð,
ð 
ó,
ð\	! ð 	!¨ó 	!ór   N)	r-   Útypingr   r   Ú__all__r   r   rM   r   r!   r   r   ú<module>rm      sI   ðñ
÷ "àÐ+Ð
,€÷%ñ %÷PSñ S÷l+ñ +÷\Mò Mr   