[CalendarServer-changes] [1822] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 24 11:34:43 PDT 2007
Revision: 1822
http://trac.macosforge.org/projects/calendarserver/changeset/1822
Author: cdaboo at apple.com
Date: 2007-08-24 11:34:42 -0700 (Fri, 24 Aug 2007)
Log Message:
-----------
Make sure Kerberos service/realm values are properly extracted from the service principal.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/authkerb.py
CalendarServer/trunk/twistedcaldav/test/test_kerberos.py
CalendarServer/trunk/twistedcaldav/test/test_tap.py
Modified: CalendarServer/trunk/twistedcaldav/authkerb.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/authkerb.py 2007-08-23 20:55:49 UTC (rev 1821)
+++ CalendarServer/trunk/twistedcaldav/authkerb.py 2007-08-24 18:34:42 UTC (rev 1822)
@@ -84,12 +84,13 @@
splits = principal.split("/")
servicetype = splits[0]
splits = splits[1].split("@")
+ service = splits[0].upper()
realm = splits[1]
except IndexError:
logging.err("Invalid Kerberos principal: %s" % (principal,), system="KerberosCredentialFactoryBase")
raise ValueError('Authentication System Failure: Invalid Kerberos principal: %s' % (principal,))
- self.service = "%s@%s" % (servicetype, realm,)
+ self.service = "%s@%s" % (servicetype, service,)
self.realm = realm
class BasicKerberosCredentials(credentials.UsernamePassword):
Modified: CalendarServer/trunk/twistedcaldav/test/test_kerberos.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_kerberos.py 2007-08-23 20:55:49 UTC (rev 1821)
+++ CalendarServer/trunk/twistedcaldav/test/test_kerberos.py 2007-08-24 18:34:42 UTC (rev 1822)
@@ -69,6 +69,11 @@
else:
self.fail(msg="NegotiateCredentialFactory decode did not fail")
+ def test_NegotiateCredentialFactoryDifferentRealm(self):
+ factory = authkerb.NegotiateCredentialFactory(principal="http/server.example.com at EXAMPLE.COM")
+ self.assertEquals(factory.realm, "EXAMPLE.COM")
+ self.assertEquals(factory.service, "http at SERVER.EXAMPLE.COM")
+
def test_NegotiateCredentialFactoryInvalidPrincipal(self):
self.assertRaises(
ValueError,
Modified: CalendarServer/trunk/twistedcaldav/test/test_tap.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_tap.py 2007-08-23 20:55:49 UTC (rev 1821)
+++ CalendarServer/trunk/twistedcaldav/test/test_tap.py 2007-08-24 18:34:42 UTC (rev 1822)
@@ -461,7 +461,7 @@
authWrapper = site.resource.resource
ncf = authWrapper.credentialFactories['negotiate']
- self.assertEquals(ncf.service, 'http at bob')
+ self.assertEquals(ncf.service, 'http at HELLO')
self.assertEquals(ncf.realm, 'bob')
def test_AuthWrapperPartialEnabled(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070824/71609194/attachment.html
More information about the calendarserver-changes
mailing list