-í
ğiâ?c       s`     d  Z    d k Z  d k Z  d f  d „  ƒ  YZ ! d „  Z & d f  d „  ƒ  YZ d S(   s¥   Base classes for defining an authentication protocol.

Database -- abstract base class for password database
Client -- abstract base class for authentication client
Ns   Clientc      s     t  Z  g  Z  d „  Z RS(   Nc    sO     | |  _   x6 |  i D ]( }  t |  i  | |  i  i | ƒ ƒ q Wd  S(   N(   s   stubs   selfs
   extensionss   ms   setattrs   extensionMethod(   s   selfs   stubs   m(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   __init__ s    	(   s   __name__s
   __module__s
   extensionss   __init__(    (    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   Client s   		c    s   ! " # |  i ƒ  $ |  Sd S(   s#   Sort a list in-place and return it.N(   s   Ls   sort(   s   L(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   sort! s   s   Databasec      s   & t  Z d  Z 0 1 e Z 2 e d „ Z F e d „ Z Q d „  Z c d „  Z f d „  Z	 o d „  Z
 r d „  Z w d „  Z | d	 „  Z RS(
   sg  Abstracts a password database.

    This class is used both in the authentication process (via
    get_password()) and by client scripts that manage the password
    database file.

    The password file is a simple, colon-separated text file mapping
    usernames to password hashes. The hashes are SHA hex digests
    produced from the password string.
    c    sŠ   2 ; < h  |  _ = | |  _ > |  i ƒ  ? | oQ @ |  i o |  i | j o$ A t d | p d |  i f ‚ n D | |  _ n d S(   s2  Creates a new Database

        filename: a string containing the full pathname of
            the password database file. Must be readable by the user
            running ZEO. Must be writeable by any client script that
            accesses the database.

        realm: the realm name (a string)
        s1   Specified realm %r differs from database realm %rs    N(   s   selfs   _userss   filenames   loads   realms
   ValueError(   s   selfs   filenames   realm(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   __init__2 s   	
$c  	  sŸ   F G |  i } I | o J t | d ƒ } n K |  i o L | d I|  i IJn N x> t |  i i ƒ  ƒ DN ]$ } O | d | |  i | f IJqp Wd  S(   Ns   ws   realms   %s: %s(	   s   selfs   filenames   fds   opens   realms   sorts   _userss   keyss   username(   s   selfs   fds   usernames   filename(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   saveF s    	c    s   Q R |  i } S | o T d  Sn V t i i | ƒ o W d  Sn Y t | ƒ } Z | i ƒ  } [ | d i	 d ƒ o2 \ | i
 d ƒ i ƒ  } ] | t d ƒ |  _ n _ xH | D_ ]= } ` | i ƒ  i d d ƒ \ } } a | i ƒ  |  i | <q¸ Wd  S(   Ni    s   realm s   :i   (   s   selfs   filenames   oss   paths   existss   opens   fds	   readliness   Ls
   startswiths   pops   strips   lines   lens   realms   splits   usernames   hashs   _users(   s   selfs   usernames   lines   hashs   fds   Ls   filename(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   loadQ s   
 	!c    s    c d |  i | ƒ |  i | <d  S(   N(   s   selfs   hashs   passwords   _userss   username(   s   selfs   usernames   password(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   _store_passwordc s   c    sC   f j k |  i i | ƒ o l t d | ‚ n m |  i | Sd S(   s    Returns password hash for specified username.

        Callers must check for LookupError, which is raised in
        the case of a non-existent user specified.s   No such user: %sN(   s   selfs   _userss   has_keys   usernames   LookupError(   s   selfs   username(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   get_passwordf s   c    s   o p t  i | ƒ i ƒ  Sd  S(   N(   s   shas   news   ss	   hexdigest(   s   selfs   s(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   hasho s   c    sD   r s |  i i | ƒ o t t d | ‚ n u |  i | | ƒ d  S(   Ns   User %s does already exist(   s   selfs   _userss   has_keys   usernames   LookupErrors   _store_passwords   password(   s   selfs   usernames   password(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   add_userr s   c    s?   w x |  i i | ƒ o y t d | ‚ n z |  i | =d  S(   Ns   No such user: %s(   s   selfs   _userss   has_keys   usernames   LookupError(   s   selfs   username(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   del_userw s   c    sE   | } |  i i | ƒ o ~ t d | ‚ n  |  i | | ƒ d  S(   Ns   No such user: %s(   s   selfs   _userss   has_keys   usernames   LookupErrors   _store_passwords   password(   s   selfs   usernames   password(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   change_password| s   (   s   __name__s
   __module__s   __doc__s   Nones   realms   __init__s   saves   loads   _store_passwords   get_passwords   hashs   add_users   del_users   change_password(    (    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   Database& s   
		(   s   __doc__s   oss   shas   Clients   sorts   Database(   s   sorts   shas   Clients   oss   Database(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   ? s
   
