Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/plugins/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pyc


[XMc@sdZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZd	Zd
efdYZdZd
efdYZeZdS(s%
Cred plugin for UNIX user accounts.
i(t
implements(tplugin(tICheckerFactory(tICredentialsChecker(tIUsernamePassword(tUnauthorizedLogin(tdefercCs|ddkr*d|jdd}n
|d }yddl}Wntk
r]d}nX|dkrytdn|j|||kS(Nit$s$1$iis(cred_unix not supported on this platform(tsplittcrypttImportErrortNonetNotImplementedError(tcryptedtpwtsaltR	((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pytverifyCryptedPasswords


tUNIXCheckercBs<eZdZeeefZdZdZdZ	RS(s
    A credentials checker for a UNIX server. This will check that
    an authenticating username/password is a valid user on the system.

    Does not work on Windows.

    Right now this supports Python's pwd and spwd modules, if they are
    installed. It does not support PAM.
    cCshy|j|d}Wntk
r7tjtSX|dkrHdSt||rdtj|SdS(Nit*tx(RR(tgetpwnamtKeyErrorRtfailRRRtsucceed(tselftpwdtusernametpasswordtcryptedPass((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pytcheckPwd3s
cCsXy|j|d}Wntk
r7tjtSXt||rTtj|SdS(Ni(tgetspnamRRRRRR(RtspwdRRR((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pyt	checkSpwd@s
cCs|j|j}}yddl}Wntk
r<d}nX|dk	rq|j|||}|dk	rq|Snyddl}Wntk
rd}nX|dk	r|j|||}|dk	r|Sntj	t
S(Ni(RRRR
RRRR RRR(RtcredentialsRRRtcheckedR((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pytrequestAvatarIdJs$



(
t__name__t
__module__t__doc__RRRtcredentialInterfacesRR R#(((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pyR%s	
		
	
s
This checker will attempt to use every resource available to
authenticate against the list of users on the local UNIX system.
(This does not support Windows servers for very obvious reasons.)

Right now, this includes support for:

  * Python's pwd module (which checks /etc/passwd)
  * Python's spwd module (which checks /etc/shadow)

Future versions may include support for PAM authentication.
tUNIXCheckerFactorycBsBeZdZeeejdZeZ	dZ
ejZdZ
RS(s'
    A factory for L{UNIXChecker}.
    tunixsNo argstring required.cCstS(s
        This checker factory ignores the argument string. Everything
        needed to generate a user database is pulled out of the local
        UNIX environment.
        (R(Rt	argstring((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pytgenerateCheckers(R$R%R&RRRtIPlugintauthTypetunixCheckerFactoryHelptauthHelptargStringFormatRR'R+(((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pyR(us	N(R&tzope.interfaceRttwistedRttwisted.cred.strcredRttwisted.cred.checkersRttwisted.cred.credentialsRttwisted.cred.errorRttwisted.internetRRtobjectRR.R(ttheUnixCheckerFactory(((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pyt<module>s	L