§
    Ètºf�  ã                   óŠ   — 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dS )zM
L{twisted.python.fakepwd} provides a fake implementation of the L{pwd} API.
é    )ÚListÚOptionalÚUserDatabaseÚShadowDatabasec                   óL   — 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d
S )Ú_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                 óh   — || _         || _        || _        || _        || _        || _        || _        d S ©N©Úpw_nameÚ	pw_passwdÚpw_uidÚpw_gidÚpw_gecosÚpw_dirÚpw_shell)Úselfr	   r
   r   r   r   r   r   s           úU/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/fakepwd.pyÚ__init__z_UserRecord.__init__   s9   € ð ˆŒØ!ˆŒØˆŒØˆŒØˆŒØˆŒØˆŒˆˆó    c                 ó   — dS )Né   © ©r   s    r   Ú__len__z_UserRecord.__len__'   ó   € Øˆqr   c                 óf   — | j         | j        | j        | j        | j        | j        | j        f|         S r   r   ©r   Úindexs     r   Ú__getitem__z_UserRecord.__getitem__*   s9   € àŒLØŒNØŒKØŒKØŒMØŒKØŒMð
ð ôð 	r   ©	Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚintr   r#   r(   r!   r   r   r   r      sª   € € € € € ðð ðàðð ðð ð	ð
 ðð ðð ðð ðð 
ðð ð ð ð$˜ð ð ð ð ð	ð 	ð 	ð 	ð 	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dS )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 | _         d S r   ©r1   r"   s    r   r   zUserDatabase.__init__C   ó   € ØˆŒˆˆr   r
   Ú ú/bin/shÚusernamer   r   r   r   r   c           	      óÈ   — |€| j         }| xj         dz  c_         |€| j        }| xj        dz  c_        t          |||||||¦  «        }| j                             |¦  «         dS )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   r9   r
   r   r   r   r   r   ÚnewUsers	            r   ÚaddUserzUserDatabase.addUserF   sr   € ðD ˆ;Ø”-ˆCØˆMŒM˜QÑˆMŒMØˆ;Ø”-ˆCØˆMŒM˜QÑˆMŒMÝ˜h¨°#°s¸EÀ4ÈÑOÔOˆØŒ×Ò˜7Ñ#Ô#Ð#Ð#Ð#r   c                 óP   — | j         D ]}|j        |k    r|c S Œt          ¦   «         ‚)zH
        Return the user record corresponding to the given uid.
        )r1   r   ÚKeyError)r   r   Úentrys      r   ÚgetpwuidzUserDatabase.getpwuidq   s:   € ð ”[ð 	ð 	ˆEØŒ|˜sÒ"Ð"Ø���ð #å‰jŒjÐr   r	   c                 ó¸   — t          |t          ¦  «        st          dt          |¦  «        › �¦  «        ‚| j        D ]}|j        |k    r|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	   rA   s      r   ÚgetpwnamzUserDatabase.getpwnamz   sj   € õ ˜$¥Ñ$Ô$ð 	RÝÐPÅDÈÁJÄJÐPÐPÑQÔQÐQØ”[ð 	ð 	ˆEØŒ} Ò$Ð$Ø���ð %å‰jŒjÐr   c                 ó   — | j         S )z4
        Return a list of all user records.
        r5   r"   s    r   ÚgetpwallzUserDatabase.getpwall…   ó   € ð Œ{Ðr   ©r   N)r
   NNr7   r7   r8   )r*   r+   r,   r-   r   r   Ú__annotations__r2   r/   r3   r   r.   r   r>   rB   rG   rI   r!   r   r   r   r   6   sO  € € € € € € ðð ð �ÔÐÐÑØ€HˆcÐÐÑØ€HˆcÐÐÑðð ð ð ð #Ø!Ø!ØØØð)$ð )$àð)$ð ð)$ð �cŒ]ð	)$ð
 �cŒ]ð)$ð ð)$ð ð)$ð ð)$ð 
ð)$ð )$ð )$ð )$ðV˜Cð  Kð ð ð ð ð	˜Sð 	 [ð 	ð 	ð 	ð 	ð˜$˜{Ô+ð ð ð ð ð ð r   c                   óT   — 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dS )Ú_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.
    r9   r
   Ú
lastChangeÚminÚmaxÚwarnÚinactÚexpireÚflagr   Nc
                 ó„   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        d S r   ©	Úsp_namÚsp_pwdÚ	sp_lstchgÚsp_minÚsp_maxÚsp_warnÚsp_inactÚ	sp_expireÚsp_flag©
r   r9   r
   rO   rP   rQ   rR   rS   rT   rU   s
             r   r   z_ShadowRecord.__init__“   sG   € ð ˆŒØˆŒØ#ˆŒØˆŒØˆŒØˆŒØˆŒØˆŒØˆŒˆˆr   c                 ó   — dS )Né	   r!   r"   s    r   r#   z_ShadowRecord.__len__©   r$   r   c           	      ó~   — | j         | j        | j        | j        | j        | j        | j        | j        | j        f	|         S r   rW   r&   s     r   r(   z_ShadowRecord.__getitem__¬   sC   € àŒKØŒKØŒNØŒKØŒKØŒLØŒMØŒNØŒLð

ð ô
ð 
	r   r)   r!   r   r   rN   rN   Œ   s¾   € € € € € ðð ðàðð ðð ð	ð
 ðð ðð ðð ðð ðð ðð 
ðð ð ð ð,˜ð ð ð ð ðð ð ð ð r   rN   c                   óx   — 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dS )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 | _         d S r   r5   r"   s    r   r   zShadowDatabase.__init__Ç   r6   r   r9   r
   rO   rP   rQ   rR   rS   rT   rU   c
                 ód   — | j                              t          |||||||||	¦	  «	        ¦  «         dS )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<   rN   ra   s
             r   r>   zShadowDatabase.addUserÊ   sI   € ðP 	Œ×ÒÝØ˜( J°°S¸$ÀÀvÈtñô ñ	
ô 	
ð 	
ð 	
ð 	
r   c                 óº   — t          |t          ¦  «        st          dt          |¦  «        › �¦  «        ‚| j        D ]}|j        |k    r|c S Œt          |¦  «        ‚)zT
        Return the shadow user record corresponding to the given username.
        z%getspnam() argument must be str, not )rD   r.   rE   rF   r1   rX   r@   )r   r9   rA   s      r   ÚgetspnamzShadowDatabase.getspnamø   sn   € õ ˜(¥CÑ(Ô(ð 	VÝÐTÅDÈÁNÄNÐTÐTÑUÔ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  rJ   r   rK   )r*   r+   r,   r-   r   rN   rL   r   r.   r/   r>   ri   rk   r!   r   r   r   r   º   sï   € € € € € € ðð ð �ÔÐÐÑðð ð ð ð,
àð,
ð ð,
ð ð	,
ð
 ð,
ð ð,
ð ð,
ð ð,
ð ð,
ð ð,
ð 
ð,
ð ,
ð ,
ð ,
ð\	! ð 	!¨ð 	!ð 	!ð 	!ð 	!ðð ð ð ð r   N)	r-   Útypingr   r   Ú__all__r   r   rN   r   r!   r   r   ú<module>rn      só   ðð
ð ð "Ð !Ð !Ð !Ð !Ð !Ð !Ð !àÐ+Ð
,€ð%ð %ð %ð %ð %ñ %ô %ð %ðPSð Sð Sð Sð Sñ Sô Sð Sðl+ð +ð +ð +ð +ñ +ô +ð +ð\Mð Mð Mð Mð Mñ Mô Mð Mð Mð Mr   