File: //usr/lib/python2.7/dist-packages/hgext/factotum.pyc
ó
ÛXc @@ s· d Z d d l m Z d d l Z d d l m Z d d l m Z m Z m Z m
Z
e
j Z e j Z d Z
d a a a d „ Z d „ Z d „ Z e e ƒ d
„ ƒ Z d „ Z d S( 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=<prefix> user=<username> !password=<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 absolute_importN( t _( t errort httpconnectiont urlt utili€ c C@ se | j j ƒ s' t j t d ƒ ƒ ‚ n d | k r@ d | } n d | } t j d t | f ƒ d S( Ns factotum not interactives user=s %s user?s
%s !password?s
%s -g '%s'( t uit interactiveR t AbortR t ost systemt _executable( t selft params( ( s2 /usr/lib/python2.7/dist-packages/hgext/factotum.pyt auth_getkeyB s
c C@ sg d | } xVt rbt j d t t j ƒ } zyâ t j | d | ƒ t j | t ƒ j ƒ } | d d k rt j | d ƒ t j | t ƒ j d d ƒ \ } } } | d k r| j
d ƒ r| j d ƒ rë | d d
!j d d ƒ } qt
j t d ƒ ƒ ‚ n | | f Sn Wn, t t f k
r?t
j t d
ƒ ƒ ‚ n XWd t j | ƒ X| | | ƒ q
Wd S( Ns
proto=pass %ss %s/rpcs start %si t okt readi t 'i iÿÿÿÿs ''s malformed password strings factotum not responding( t TrueR t opent _mountpointt O_RDWRt writeR t ERRMAXt splitt Nonet
startswitht endswitht replaceR R R t OSErrort IOErrort close( R t getkeyR
t fdt lt statust usert passwd( ( s2 /usr/lib/python2.7/dist-packages/hgext/factotum.pyt auth_getuserpasswdJ s(
'c @ s ‡ f d † } | S( Nc @ s t ˆ | j | ƒ | S( N( t setattrt __name__( t func( t cls( s2 /usr/lib/python2.7/dist-packages/hgext/factotum.pyt decoratorb s ( ( R* R+ ( ( R* s2 /usr/lib/python2.7/dist-packages/hgext/factotum.pyt monkeypatch_methoda s c
C@ sF | j j | | ƒ \ } } | rA | rA | j | | ƒ | | f Sd } t j | j | | ƒ } | r¢ | \ } } | j d ƒ } | j d ƒ | j d ƒ } } n | s° | r| sÒ | j d ƒ d j ƒ } n d t | f } | rû d | | f } n t
| t | ƒ \ } } n | j | | | | ƒ | j | | ƒ | | f S( Nt t prefixt usernamet passwordt i s service=%s prefix=%ss
%s user=%s(
t passwddbt find_user_passwordt _writedebugR t readauthforuriR t getR t lowert _serviceR&