HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/python/__pycache__/fakepwd.cpython-38.pyc
U


W[��@s`dZddlmZmZddgZGdd�de�ZGdd�de�ZGdd	�d	e�ZGd
d�de�Z	dS)zM
L{twisted.python.fakepwd} provides a fake implementation of the L{pwd} API.
�)�absolute_import�division�UserDatabase�ShadowDatabasec@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_UserRecordz�
    L{_UserRecord} holds the user data for a single user in L{UserDatabase}.
    It corresponds to L{pwd.struct_passwd}.  See that class for attribute
    documentation.
    cCs.||_||_||_||_||_||_||_dS�N��pw_nameZ	pw_passwd�pw_uidZpw_gidZpw_gecos�pw_dirZpw_shell)�self�name�password�uid�gid�gecos�home�shell�r�8/usr/lib/python3/dist-packages/twisted/python/fakepwd.py�__init__sz_UserRecord.__init__cCsdS)N�r�rrrr�__len__sz_UserRecord.__len__cCs$|j|j|j|j|j|j|jf|Srr�r�indexrrr�__getitem__"s��z_UserRecord.__getitem__N��__name__�
__module__�__qualname__�__doc__rrrrrrrrs
rc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rz�
    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.
    cCs
g|_dSr��_usersrrrrr1szUserDatabase.__init__c
Cs |j�t|||||||��dS)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.
        @type username: C{str}

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

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

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

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

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

        @param shell: The value for the C{pw_shell} field of the user record to
            add.
        @type shell: C{str}
        N)r#�appendr)r�usernamerrrrrrrrr�addUser5s �zUserDatabase.addUsercCs(|jD]}|j|kr|Sqt��dS)zH
        Return the user record corresponding to the given uid.
        N)r#r
�KeyError)rr�entryrrr�getpwuidYs


zUserDatabase.getpwuidcCs(|jD]}|j|kr|Sqt��dS)zM
        Return the user record corresponding to the given username.
        N)r#r	r')rr
r(rrr�getpwnamcs


zUserDatabase.getpwnamcCs|jS)z4
        Return a list of all user records.
        r"rrrr�getpwallmszUserDatabase.getpwallN)	rrr r!rr&r)r*r+rrrrr)s$

c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
_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.
    c

Cs:||_||_||_||_||_||_||_||_|	|_dSr�	�sp_namZsp_pwdZ	sp_lstchgZsp_minZsp_maxZsp_warnZsp_inactZ	sp_expireZsp_flag�
rr%rZ
lastChange�min�max�warnZinactZexpire�flagrrrr{sz_ShadowRecord.__init__cCsdS)N�	rrrrrr�sz_ShadowRecord.__len__c	Cs,|j|j|j|j|j|j|j|j|jf	|Srr-rrrrr�s��z_ShadowRecord.__getitem__Nrrrrrr,us
r,c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rz�
    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
    cCs
g|_dSrr"rrrrr�szShadowDatabase.__init__c

Cs$|j�t|||||||||	�	�dS)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.
        @type username: C{str}

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

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

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

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

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

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

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

        @param flag: The value for the C{sp_flag} field of the user record to
            add.
        @type flag: C{int}
        N)r#r$r,r/rrrr&�s'�zShadowDatabase.addUsercCs&|jD]}|j|kr|Sqt�dS)zT
        Return the shadow user record corresponding to the given username.
        N)r#r.r')rr%r(rrr�getspnam�s


zShadowDatabase.getspnamcCs|jS)z;
        Return a list of all shadow user records.
        r"rrrr�getspall�szShadowDatabase.getspallN)rrr r!rr&r5r6rrrrr�s
	,
N)
r!Z
__future__rr�__all__�objectrrr,rrrrr�<module>sL