mň á¸Ec@sůdZddd!ZdkZdkZdkZdkZdkZdkZdkZydk l Z Wne j o dZ nXd„Z d„Z d„Zd d d „Zd d d „Zd efd „ƒYZd„ZedjoeeiƒndS(sZope user bootstrap systems$Revision: 1.5 $ i iţ˙˙˙N(scryptcCs d}ti|ƒti|ƒS(s-Generate a salt value for the crypt function.s@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./N(t salt_choicestrandomtchoice(R((t9/data/zmath/zope/lib/python/Zope2/Startup/misc/zpasswd.pyt generate_saltscCs…|iƒ}|djo*dtiti|ƒiƒƒd }n?|djodt |t ƒƒ}n|djo |}n|S(NtSHAs{SHA}i˙˙˙˙tCRYPTs{CRYPT}t CLEARTEXT( tencodingtuppertbinasciit b2a_base64tshatnewtpasswordtdigesttpwtcryptR(RRR((Rtgenerate_passwd s  *   cCs„d}t|dƒ}d}x'tdƒD]}|ti|ƒ}q(W|i d|t |dƒfƒ|i ƒt id|ƒ|S(Ns?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!twtis%s:%sRs chmod 644 %s(t pw_choicestopentac_pathtacfileRtrangetiRRtwritetusernameRtclosetostsystem(thomeRRRRRR((Rtwrite_generated_password+s   RcCs~tii|dƒ}tii|ƒpRddGHdGHt||dƒ}d|ti fGHdk }|i |||ƒndS(Ntaccesst-iNscreating default access filet emergencysćNote: The emergency user name and password are 'emergency' and '%s'. You can change the emergency name and password with the zpasswd script. To find out more, type: %s zpasswd.py (RtpathtjoinR RtexistsR!Rtsyst executabletdotchtusertgroup(R R,R-R*RR((Rt write_access8s  cCsutii|dƒ}tii|ƒpIddGHdGHt||dƒ}d|GHdk}|i |||ƒndS(NtinituserR#iNscreating default inituser filetadminsÉNote: The initial user name and password are 'admin' and '%s'. You can change the name and password through the web interface or using the 'zpasswd.py' script. ( RR%R&R RR'R!RR*R+R,R-(R R,R-R*RR((Rtwrite_inituserJs  tCommandLineErrorcBstZRS(N(t__name__t __module__(((RR2[scCs+d} ddddg} d|d}y¸t|ƒdjo td ‚ntitid | | ƒ\} }t|ƒd jo td ‚nt |dd ƒ}t| ƒdjo*d }d}d } xŇ| D]Ę}|ddjp|ddjo|d }qĘ|ddjp|ddjo|d }qĘ|ddjp|ddjo|d }qĘ|ddjp|ddjod|d } qĘqĘW| p| o td‚n|i|dt||ƒ| ƒnx#tdƒ}|d joPqŢqŢWxDtidƒ}tidƒ}||joPqd }}dGHqWxOdGHtdƒ}|d jo d}Pn|iƒddd gjoPqKqKWtd!ƒ} | od| } n|i|dt||ƒ| ƒWnFtj o:} tii|ƒtiid"| ƒtid ƒnXdS(#Ns :u:p:e:d:s username=s password=s encoding=sdomains=s¨Usage: %s [options] filename If this program is called without command-line options, it will prompt for all necessary information. The available options are: -u / --username= Set the username to be used for the initial user or the emergency user -p / --password= Set the password -e / --encoding= Set the encryption/encoding rules. Defaults to SHA-1. OPTIONAL -d / --domains= Set the domain names that the user user can log in from. Defaults to any. OPTIONAL. Filename is required and should be the name of the file to store the information in (usually "inituser" or "access"). Copyright (C) 1999, 2000 Digital Creations, Inc. iisNot enough arguments!isOnly one filename allowed!RRRs-us --usernames-ps --passwords-es --encodings-ds --domainst:s#Must specify username and password.s Username: s Password: sVerify password: s&Password mismatch, please try again...s Please choose a format from: SHA - SHA-1 hashed password (default) CRYPT - UNIX-style crypt password CLEARTEXT - no protection s Encoding: RRsDomain restrictions: s %s(t short_optionst long_optionstargvtusagetlenR2tgetoptR(toptlisttargsRt access_fileRRtdomainstoptRRRt raw_inputtgetpasstverifyR tvtstderrtexit(R8R@RRCR9RR>R=RR<R7RDR?R6((Rtmain^sr " """" &          &t__main__(t__doc__t __version__R(R R RR;RBRRt ImportErrortNoneRRR!R.R1t ExceptionR2RGR3R8(RBRGR2R!RRRR R(R RR1R;R.RJR((Rt?s ?    n