Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/twisted/python/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/twisted/python/__pycache__/fakepwd.cpython-37.pyc

B

�'�\��@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_name�	pw_passwd�pw_uid�pw_gid�pw_gecos�pw_dir�pw_shell)�self�name�password�uid�gid�gecos�home�shell�r�I/opt/alt/python37/lib64/python3.7/site-packages/twisted/python/fakepwd.py�__init__sz_UserRecord.__init__cCsdS)N�r)rrrr�__len__sz_UserRecord.__len__cCs$|j|j|j|j|j|j|jf|S)N)rrr	r
rrr
)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|_dS)N)�_users)rrrrr1szUserDatabase.__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(x|jD]}|j|kr|SqWt��dS)zH
        Return the user record corresponding to the given uid.
        N)r!r	�KeyError)rr�entryrrr�getpwuidYs
zUserDatabase.getpwuidcCs(x|jD]}|j|kr|SqWt��dS)zM
        Return the user record corresponding to the given username.
        N)r!rr%)rrr&rrr�getpwnamcs
zUserDatabase.getpwnamcCs|jS)z4
        Return a list of all user records.
        )r!)rrrr�getpwallmszUserDatabase.getpwallN)	rrrr 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:||_||_||_||_||_||_||_||_|	|_dS)N)	�sp_nam�sp_pwd�	sp_lstchg�sp_min�sp_max�sp_warn�sp_inact�	sp_expire�sp_flag)
rr#r�
lastChange�min�max�warn�inact�expire�flagrrrr{sz_ShadowRecord.__init__cCsdS)N�	r)rrrrr�sz_ShadowRecord.__len__c	Cs,|j|j|j|j|j|j|j|j|jf	|S)N)	r+r,r-r.r/r0r1r2r3)rrrrrr�sz_ShadowRecord.__getitem__N)rrrr rrrrrrrr*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|_dS)N)r!)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*)
rr#rr4r5r6r7r8r9r:rrrr$�s'zShadowDatabase.addUsercCs&x|jD]}|j|kr|SqWt�dS)zT
        Return the shadow user record corresponding to the given username.
        N)r!r+r%)rr#r&rrr�getspnam�s
zShadowDatabase.getspnamcCs|jS)z;
        Return a list of all shadow user records.
        )r!)rrrr�getspall�szShadowDatabase.getspallN)rrrr rr$r<r=rrrrr�s
	,
N)
r �
__future__rr�__all__�objectrrr*rrrrr�<module>sL