[CalendarServer-changes] [14147] CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 7 13:27:24 PST 2014


Revision: 14147
          http://trac.calendarserver.org//changeset/14147
Author:   cdaboo at apple.com
Date:     2014-11-07 13:27:24 -0800 (Fri, 07 Nov 2014)
Log Message:
-----------
Fix bug with empty results from DNS SRV lookup.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/test_utils.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py

Added Paths:
-----------
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.empty.zone

Added: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.empty.zone
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.empty.zone	                        (rev 0)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/data/db.empty.zone	2014-11-07 21:27:24 UTC (rev 14147)
@@ -0,0 +1,12 @@
+example.com.		  10800 IN SOA	ns.example.com. 	admin.example.com. (
+                                                        2012090810 ; serial
+                                                        3600       ; refresh (1 hour)
+                                                        900        ; retry (15 minutes)
+                                                        1209600    ; expire (2 weeks)
+                                                        86400      ; minimum (1 day)
+							)
+									10800 IN NS		ns.example.com.
+									10800 IN A		127.0.0.1
+ns.example.com.						10800 IN A		127.0.0.1
+
+_ischedules._tcp.example.com.		10800 IN TXT	"empty"

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/test_utils.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/test_utils.py	2014-11-07 19:04:06 UTC (rev 14146)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/test/test_utils.py	2014-11-07 21:27:24 UTC (rev 14147)
@@ -78,6 +78,7 @@
                 ("example.com", "example.com", 8443,),
                 ("example.org", "example.org", 8543,),
             ),),
+            ("db.empty.zone", (("example.com", "", 0,),),),
         ):
             module = getModule(__name__)
             dataPath = module.filePath.sibling("data")
@@ -86,7 +87,12 @@
             utils.DebugResolver = None
 
             for domain, result_host, result_port in checks:
-                host, port = (yield utils.lookupServerViaSRV(domain))
+                result = (yield utils.lookupServerViaSRV(domain))
+                if result is None:
+                    host = ""
+                    port = 0
+                else:
+                    host, port = result
                 self.assertEqual(host, result_host)
                 self.assertEqual(port, result_port)
 

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py	2014-11-07 19:04:06 UTC (rev 14146)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/utils.py	2014-11-07 21:27:24 UTC (rev 14147)
@@ -91,6 +91,10 @@
         else:
             return cmp(a[1], b[1])
 
+    if not servers:
+        log.debug("DNS SRV: no matching records: {l}", l=lookup)
+        returnValue(None)
+
     servers.sort(_serverCmp)
     minPriority = servers[0][0]
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141107/08598fa8/attachment.html>


More information about the calendarserver-changes mailing list