~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to scripts/usrmgt-server

  • Committer: mattgiuca
  • Date: 2008-06-23 09:09:12 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:783
usrmgt-server, fileservice_lib/action.py: Fixed SVN get_login callback.
    No longer gets stuck in an infinite loop if the credentials are wrong.
    Just gives an error and exits.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    db.update_user(**update)
99
99
    db.close()
100
100
 
101
 
def get_login(login, passwd, _realm, _login, _may_save):
 
101
def get_login(login, passwd, realm, existing_login, _may_save):
102
102
    """Callback function used by pysvn for authentication.
 
103
    login, passwd: Credentials of the user attempting to log in.
 
104
        passwd in clear (this should be the user's svn_pass, a
 
105
        randomly-generated permanent password for this user, not their main
 
106
        IVLE password).
 
107
    realm, existing_login, _may_save: The 3 arguments passed by pysvn to
 
108
        callback_get_login.
 
109
        The following has been determined empirically, not from docs:
 
110
        existing_login will be the name of the user who owns the process on
 
111
        the first attempt, "" on subsequent attempts. We use this fact.
103
112
    """
104
 
    logging.debug("Getting password for %s (realm %s)" % (login, _realm))
105
 
    return (True, login, passwd, False)
 
113
    logging.debug("Getting password for %s (realm %s)" % (login, realm))
 
114
    # Only provide credentials on the _first_ attempt.
 
115
    # If we're being asked again, then it means the credentials failed for
 
116
    # some reason and we should just fail. (This is not desirable, but it's
 
117
    # better than being asked an infinite number of times).
 
118
    if existing_login == "":
 
119
        logging.warning("Could not authenticate SVN for %s" % login)
 
120
        return (False, login, passwd, False)
 
121
    else:
 
122
        return (True, login, passwd, False)
106
123
 
107
124
def activate_user(props):
108
125
    """Create the on-disk stuff for the given user.