Ticket #4309: sage-4309_2.patch

File sage-4309_2.patch, 2.1 KB (added by TimothyClemans, 14 years ago)
  • sage/server/notebook/avatars.py

    # HG changeset patch
    # User Timothy Clemans <timothy.clemans@gmail.com>
    # Date 1226282571 21600
    # Node ID 9d61d9c07d8090640e6c94e3d0c39584581882b8
    # Parent  91b58135cec80756572727af4d606b3fb863c8fe
    #4309
    
    diff -r 91b58135cec8 -r 9d61d9c07d80 sage/server/notebook/avatars.py
    a b  
    1212from   random import randint, choice
    1313
    1414import twist
    15 import kerberos
    1615from twisted.cred import portal, checkers, credentials, error as credError
    1716from twisted.internet import protocol, defer
    1817from zope.interface import Interface, implements
    1918from twisted.web2 import iweb
    2019from twisted.python import log
     20
     21krb_data = [None, None]
     22try:
     23    import kerberos
     24except ImportError:
     25    if krb_data[0] and krb_data[1]:
     26        raise ImportError, 'Must have kerberos installed in order to use kerberos authentification.'
     27    pass
    2128
    2229def user_type(avatarId):
    2330    """
     
    8390        self.failure_type = failure_type
    8491
    8592class PasswordChecker(object):
    86     krb_data = []
    8793    implements(checkers.ICredentialsChecker)
    8894    credentialInterfaces = (credentials.IUsernamePassword,)
    8995
     
    106112        if username == 'COOKIESDISABLED':
    107113            return defer.succeed(FailedLogin(username, failure_type = 'cookies'))
    108114
    109         if self.krb_data[0] and self.krb_data[1]:
     115        if krb_data[0] and krb_data[1]:
    110116            try:
    111117                kerberos.checkPassword(username,password,
    112118                                       self.krb_data[0], self.krb_data[1])
  • sage/server/notebook/run_notebook.py

    diff -r 91b58135cec8 -r 9d61d9c07d80 sage/server/notebook/run_notebook.py
    a b  
    224224startup_checker = avatars.OneTimeTokenChecker()
    225225startup_checker.token = startup_token
    226226p.registerChecker(startup_checker)
    227 avatars.PasswordChecker.krb_data=%s
     227avatars.krb_data=%s
    228228password_checker = avatars.PasswordChecker()
    229229p.registerChecker(password_checker)
    230230p.registerChecker(checkers.AllowAnonymousAccess())