^cT6dZddlZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z e jZe jZdZdxaxaaiZe jeZedd d edd d eddd dZdZdZeedZdZdS)ahttp 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. N)_)setattr)procutil)errorhttpconnection registrarurlutilfactotum executables/bin/auth/factotum)default mountpoints /mnt/factotumserviceshgc|js!tjt dd|vrd|z}d|z}t jtjdt|fzdS)Nsfactotum not interactivesuser=s%s user?s %s !password?s %s -g '%s') ui interactiverAbortrossystemr tonativestr _executable)selfparamss 0/usr/lib/python3/dist-packages/hgext/factotum.py auth_getkeyrXs{ 7   :k!788999vv%  &FIh"=K3H#HIIJJJJJcd|z} tjdtztj} tj|d|ztj|t }|ddkrtj|dtj|t dd\}}}|dkr|d rU| d r|d d  d d }n!tj td ||ftj|Sn6#tt f$r"tj tdwxYwtj|n#tj|wxYw|||)Ns proto=pass %sTs%s/rpcsstart %srsoksread's''smalformed password stringsfactotum not responding)ropen _mountpointO_RDWRwritereadERRMAXsplit startswithendswithreplacerrrcloseOSErrorIOError)rgetkeyrfdlstatususerpasswds rauth_getuserpasswdr6as  &F WY,bi 8 8  HRv- . . .F##))++Atu}}W%%%')wr6':':'@'@q'I'I$fU??((..O!??400O%+AbD\%9%9%%F%FFF"'+a0L.M.M"N"NN &> HRLLLL! = = =+a :;;<< < = HRLLLLBHRLLLLtV'sD EF3FFF0cfd}|S)Nc4t|j||S)N)r__name__)funcclss r decoratorz%monkeypatch_method..decoratorzsT]D))) r)r;r<s` rmonkeypatch_methodr>ys$ rcf|j||\}}|r|r|||||fSd}tj|j||}|rD|\}}|d}|d|d}}|r|s]|s-|dd}dt|fz} |rd| |fz} t|t| \}}| |||||||||fS) Nrsprefixsusernamespassword rsservice=%s prefix=%ss %s user=%s) passwddbfind_user_password _writedebugrreadauthforurirgetr)lower_servicer6r add_password) rrealmauthurir4r5prefixresrauthrs rrBrBsZ=33E7CCLD&  v&&&f~ F  '$ ? ?C D4)$$xx ,,dhh{.C.Cf EvE 2[[&&q)//11F(Hf+==  4"fd^3F)$ VDD feWdF333T6""" &>rc|dda|dda|ddadS)Nr r rr)configrr$rG)rs ruisetuprPs?))K77K))K77Kyyj11HHHr)__doc__rmercurial.i18nrmercurial.pycompatrmercurial.utilsr mercurialrrrr r urlreq passwordmgrr(rr$rG configtable configitemrr6r>rBrPr=rrrZs&< &&&&&&$$$$$$ o '++ +kH !Y !+ . .  !      KKK0K  ! 222222r