mς MγΈEc@sadZdkZdkZdkZdkZdkZdkZd„Zd„Zddd„Z dS(sΥUpdate a user's authentication tokens for a ZEO server. usage: python zeopasswd.py [options] username [password] Specify either a configuration file: -C/--configuration -- ZConfig configuration file or the individual options: -f/--filename -- authentication database filename -p/--protocol -- authentication protocol name -r/--realm -- authentication database realm Additional options: -d/--delete -- delete user instead of updating password NcCstGH|GHtidƒdS(Ni(t__doc__tmsgtsystexit(R((t,/data/zmath/zope/lib/python/ZEO/zeopasswd.pytusage)scCs΅y+ti|dddddgƒ\} }Wn"tij o} t| ƒnXd}d}d}d}d}x | D]\} } | djp | d joOtiitiitiƒd ƒ}ti|ƒ}ti|| ƒ\}}n| d jp | d jo d }n| djp | djo | }n| djp | djo | }n| djp | djo | }ququW|dj oD|p|otdƒn|ii}|ii}|ii}n|o|ptdƒnd} |oD|ptdƒn"t|ƒd jotdƒn|d}nd|ptdƒnOt|ƒdjotdƒn.t|ƒd jo|d}n |\}} |||||| fS(s>Password-specific options loaded from regular ZEO config file.s dr:p:f:C:s configure=s protocol=s filename=trealmits-Cs --configures schema.xmls-ds--deleteis-ps --protocols-fs --filenames-rs--realms8Error: Conflicting options; use either -C *or* -p and -fs@Error: Must specifiy configuration file or protocol and databases(Error: Must specify a username to deletesError: Too many argumentssError: Must specify a usernameiN(!tgetopttargstoptsterrorRRtNonetconfigtdeletet auth_protocoltauth_dbt auth_realmtktvtostpathtjointdirnametZEOt__file__t schemafiletZConfigt loadSchematschemat loadConfigtniltzeotauthentication_protocoltauthentication_databasetauthentication_realmtpasswordtlentusername(R RRR RRR&RRRR$RRR R((Rtoptions.s`+         c Cst|ƒ\}}}} }}|djot dƒn|djodk l }n@|djodk l}n"|o |}ntd|ƒ‚|djot dƒn|||ƒ}| o|i|ƒn1|djotidƒ}n|i||ƒ|iƒdS( Ns3Error: configuration does not specify auth protocoltdigest(sDigestDatabasetsrp(s SRPDatabasesUnknown database type %rs3Error: configuration does not specify auth databasesEnter password: (R'R tpRRRR&R$R RtZEO.auth.auth_digesttDigestDatabasetDatabasetZEO.auth.auth_srpt SRPDatabasetdbclasst ValueErrortdbtdel_usertgetpasstadd_usertsave( R R0R&R-RR2RR*R$R((Rtmaings&      ( RRR4RRRRRR'R R7( RRRR4RRR7RR'((Rt?s        9