ó [³XMc@s¾dZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZd „Zd efd „ƒYZd Zd efd„ƒYZeƒZdS(s% Cred plugin for UNIX user accounts. iÿÿÿÿ(t implements(tplugin(tICheckerFactory(tICredentialsChecker(tIUsernamePassword(tUnauthorizedLogin(tdefercCs|ddkr*d|jdƒd}n |d }yddl}Wntk r]d}nX|dkrytdƒ‚n|j||ƒ|kS(Nit$s$1$iiÿÿÿÿs(cred_unix not supported on this platform(tsplittcryptt ImportErrortNonetNotImplementedError(tcryptedtpwtsaltR ((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pytverifyCryptedPasswords    t UNIXCheckercBs<eZdZeeƒefZd„Zd„Zd„Z 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 r7tjtƒƒSX|dkrHdSt||ƒrdtj|ƒSdS(Nit*tx(RR(tgetpwnamtKeyErrorRtfailRR Rtsucceed(tselftpwdtusernametpasswordt cryptedPass((s=/usr/lib/python2.7/dist-packages/twisted/plugins/cred_unix.pytcheckPwd3s  cCsXy|j|ƒd}Wntk r7tjtƒƒSXt||ƒ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 ršd}nX|dk rÏ|j|||ƒ}|dk rÏ|Sntj t ƒƒS(Niÿÿÿÿ( RRRR R RRR RRR(Rt credentialsRRRtcheckedR((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. tUNIXCheckerFactorycBsBeZdZeeejƒdZeZ dZ e j Z d„Z RS(s' A factory for L{UNIXChecker}. tunixsNo argstring required.cCstƒS(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.pyts L