ó œçƒQc@s—dZddlmZddlmZddlmZmZddlZddl Z dZ d„Z d„Z d „Z e eƒd „ƒZd „ZdS( sâhttp authentication with factotum This extension allows the factotum(4) facility on Plan 9 from Bell Labs platforms to provide authentication information for HTTP access. Configuration entries specified in the auth section as well as authentication information provided in the repository URL are fully supported. If no prefix is specified, a value of "*" will be assumed. By default, keys are specified as:: proto=pass service=hg prefix= user= !password= If the factotum extension is unable to read the required key, one will be requested interactively. A configuration section is available to customize runtime behavior. By default, these entries are:: [factotum] executable = /bin/auth/factotum mountpoint = /mnt/factotum service = hg The executable entry defines the full path to the factotum binary. The mountpoint entry defines the path to the factotum file service. Lastly, the service entry controls the service name used when reading keys. iÿÿÿÿ(t_(t passwordmgr(thttpconnectiontutilNi€cCse|jjƒs'tjtdƒƒ‚nd|kr@d|}nd|}tjdt|fƒdS(Nsfactotum not interactivesuser=s%s user?s %s !password?s %s -g '%s'(tuit interactiveRtAbortRtostsystemt _executable(tselftparams((s2/sys/lib/python2.7/site-packages/hgext/factotum.pyt auth_getkey7s    cCsd|}x÷trtjdttjƒ}z¶yƒtj|d|ƒtj|tƒjƒ}|ddkr±tj|dƒtj|tƒjƒ}|ddkr±|dSnWn,t t fk ràt j t dƒƒ‚nXWdtj|ƒX|||ƒq WdS( Ns proto=pass %ss%s/rpcsstart %sitoktreadisfactotum not responding(tTrueRtopent _mountpointtO_RDWRtwriteRtERRMAXtsplittOSErrortIOErrorRRRtclose(R tgetkeyR tfdtl((s2/sys/lib/python2.7/site-packages/hgext/factotum.pytauth_getuserpasswd?s   cs‡fd†}|S(Ncstˆ|j|ƒ|S(N(tsetattrt__name__(tfunc(tcls(s2/sys/lib/python2.7/site-packages/hgext/factotum.pyt decoratorSs((R R!((R s2/sys/lib/python2.7/site-packages/hgext/factotum.pytmonkeypatch_methodRsc Cs6tjj|||ƒ\}}|rD|rD|j||ƒ||fSd}tj|j||ƒ}|r¥|\}}|jdƒ}|jdƒ|jdƒ}}n| s³| r|sÂd}ndt|f} |rëd| |f} nt |t | ƒ\}}n|j ||||ƒ|j||ƒ||fS(Nttprefixtusernametpasswordt*sservice=%s prefix=%ss %s user=%s( turllib2tHTTPPasswordMgrWithDefaultRealmtfind_user_passwordt _writedebugRtreadauthforuriRtgett_serviceRR t add_password( R trealmtauthuritusertpasswdR$tresRtauthR ((s2/sys/lib/python2.7/site-packages/hgext/factotum.pyR*Xs*    " cCsC|jdddƒa|jdddƒa|jdddƒadS(Ntfactotumt executables/bin/auth/factotumt mountpoints /mnt/factotumtservicethg(tconfigR RR.(R((s2/sys/lib/python2.7/site-packages/hgext/factotum.pytuisetuprs(t__doc__tmercurial.i18nRt mercurial.urlRt mercurialRRRR(RR RR"R*R<(((s2/sys/lib/python2.7/site-packages/hgext/factotum.pyt.s