%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/auth/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/auth/pam.pyc

�
���^c@@s
dZddlmZmZmZddlZddlmZmZm	Z	m
Z
mZmZm
Z
ddlmZmZmZmZmZddlmZddlZddlmZddlmZeje�Zy[eed	��ZejZ ee _!eege _"ej#Z$ege$_%ee�e$_!Wn*e&k
r\ej'd
de(�e)Z*nXe(Z*dZ+d
Z,dZ-dZ.de	fd��YZ/de	fd��YZ0de	fd��YZ1e
eeeee0��eee1��e�Z2de	fd��YZ3y�eed��Z4e4j5Z6ee6_!eeee3�ee/�ge6_"e4j7Z8ee8_!e/ege8_"e4j9Z:ee:_!e/ege:_"e4j;Z<ee<_!e/ege<_"Wn*e&k
r�ej'dde(�e)Z=nXe(Z=d�Z>d�Z?d�Z@d�ZAdS(u�
Authenticate against PAM

Provides an authenticate function that will allow the caller to authenticate
a user against the Pluggable Authentication Modules (PAM) on the system.

Implemented using ctypes, so no compilation is necessary.

There is one extra configuration option for pam.  The `pam_service` that is
authenticated against.  This defaults to `login`

.. code-block:: yaml

    auth.pam.service: login

.. note:: Solaris-like (SmartOS, OmniOS, ...) systems may need ``auth.pam.service`` set to ``other``.

.. note:: PAM authentication will not work for the ``root`` user.

    The Python interface to PAM does not support authenticating as ``root``.

.. note:: Using PAM groups with SSSD groups on python2.

    To use sssd with the PAM eauth module and groups the `pysss` module is
    needed.  On RedHat/CentOS this is `python-sss`.

    This should not be needed with python >= 3.3, because the `os` modules has the
    `getgrouplist` function.

i(tabsolute_importtprint_functiontunicode_literalsN(tCDLLtPOINTERt	Structuret	CFUNCTYPEtcasttpointertsizeof(tc_void_ptc_uinttc_char_ptc_chartc_int(tfind_library(trange(tsixucu Failed to load libc using ctypestexc_infoiiiit	PamHandlecB@s&eZdZdefgZd�ZRS(u(
    Wrapper class for pam_handle_t
    uhandlecC@stj|�d|_dS(Ni(Rt__init__thandle(tself((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyRUs
(t__name__t
__module__t__doc__R
t_fields_R(((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyRMst
PamMessagecB@s/eZdZdefdefgZd�ZRS(u1
    Wrapper class for pam_message structure
    u	msg_styleumsgcC@sdj|j|j�S(Nu<PamMessage {0} '{1}'>(tformatt	msg_styletmsg(R((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyt__repr__cs(RRRRRRR(((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyRZs	tPamResponsecB@s/eZdZdefdefgZd�ZRS(u2
    Wrapper class for pam_response structure
    urespuresp_retcodecC@sdj|j|j�S(Nu<PamResponse {0} '{1}'>(Rtresp_retcodetresp(R((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyRps(RRRRRRR(((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyR gs	tPamConvcB@s&eZdZdefdefgZRS(u.
    Wrapper class for pam_conv structure
    uconvuappdata_ptr(RRRt	CONV_FUNCR
R(((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyR#|s	upamuFailed to load pam using ctypescC@s
to	tS(u$
    Only load on Linux systems
    (tHAS_LIBCtHAS_PAM(((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyt__virtual__�sc@s+tjdd�}t|tj�r6|jt�}nt�tj�rZ�jt��nt|tj�r~|jt�}nt�fd��}t�}t	|d�}t
||t|�t|��}|dkr�t||�t
St|d�}|dkrt|d�nt|d�|dkS(u�
    Returns True if the given username and password authenticate for the
    given service.  Returns False otherwise

    ``username``: the username to authenticate

    ``password``: the password in plain text
    uauth.pam.serviceuloginc@s�t|tt��}t|tt��|d<xbt|�D]T}||jjtkr;t	��}t|t
�|j|_d|j|_q;q;WdS(u�
        Simple conversation function that responds to any
        prompt where the echo is off with the supplied password
        i(
tCALLOCR	R RRRtcontentsRtPAM_PROMPT_ECHO_OFFtSTRDUPRR"R!(t
n_messagestmessagest
p_responsetapp_datataddrtitpw_copy(tpassword(s1/usr/lib/python2.7/site-packages/salt/auth/pam.pytmy_conv�si(t__opts__tgett
isinstanceRt	text_typetencodet__salt_system_encoding__R$RR#t	PAM_STARTRtPAM_ENDtFalsetPAM_AUTHENTICATEt
PAM_ACCT_MGMT(tusernameR3tserviceR4Rtconvtretval((R3s1/usr/lib/python2.7/site-packages/salt/auth/pam.pytauthenticate�s&		!

cK@s
t||�S(u
    Authenticate via pam
    (RD(R@R3tkwargs((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pytauth�scO@stjjj|�S(uY
    Retrieve groups for a given user for this auth provider

    Uses system groups
    (tsalttutilstusertget_group_list(R@targsRE((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pytgroups�s(BRt
__future__RRRtloggingtctypesRRRRRRR	R
RRR
Rtctypes.utilRtsalt.utils.userRGtsalt.ext.six.movesRtsalt.extRt	getLoggerRtlogtLIBCtcallocR(trestypetargtypeststrdupR+t	argstypest	ExceptionttracetTrueR=R%R*tPAM_PROMPT_ECHO_ONt
PAM_ERROR_MSGt
PAM_TEXT_INFORRR R$R#tLIBPAMt	pam_startR;tpam_authenticateR>t
pam_acct_mgmtR?tpam_endR<R&R'RDRFRL(((s1/usr/lib/python2.7/site-packages/salt/auth/pam.pyt<module>$sx4(			




	
									

		3	

Zerion Mini Shell 1.0