-í
Û„?c       sK   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    s@   | |  _  x0 |  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      se   t  Z d  Z e d „ Z e d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 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)   h  |  _ | |  _ | |  _ |  i ƒ  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)
        N(   s   selfs   _userss   filenames   realms   load(   s   selfs   filenames   realm(    (    s5   /usr/pkg/lib/python2.2/site-packages/ZEO/auth/base.pys   __init__2 s
    	 			c  	  s„   |  i } | o t | d ƒ } n |  i o | d I|  i IJn x8 t |  i i ƒ  ƒ D]! } | d | |  i | f IJq[ 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   saveA s    	
 c    sÓ   |  i } | o d  Sn t i i | ƒ o d  Sn t | ƒ } | i ƒ  } | d i	 d ƒ o, | i
 d ƒ i ƒ  } | t d ƒ |  _ n x? | D]7 } | i ƒ  i d d ƒ \ } } | 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   loadL s    	 c    s   |  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_password^ s    c    s4   |  i i | ƒ o t d | ‚ n |  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_passworda s     c    s   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   hashj s    c    s8   |  i i | ƒ o t d | ‚ n |  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_userm s    c    s3   |  i i | ƒ o t d | ‚ n |  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_userr s    c    s9   |  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_passwordw s    (   s   __name__s
   __module__s   __doc__s   Nones   __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
   		
	