[CalendarServer-changes] [3128] CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Oct 7 10:45:19 PDT 2008


Revision: 3128
          http://trac.macosforge.org/projects/calendarserver/changeset/3128
Author:   cdaboo at apple.com
Date:     2008-10-07 10:45:19 -0700 (Tue, 07 Oct 2008)
Log Message:
-----------
Properly handle dns lookup errors.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2008-10-07 16:50:11 UTC (rev 3127)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2008-10-07 17:45:19 UTC (rev 3128)
@@ -578,24 +578,27 @@
                 matched = True
             else:
                 # Now do hostname lookup
-                host, aliases, _ignore_ips = socket.gethostbyaddr(clientip)
-                for host in itertools.chain((host,), aliases):
-                    # Try simple match first
-                    if host in compare_with:
-                        matched = True
+                try:
+                    host, aliases, _ignore_ips = socket.gethostbyaddr(clientip)
+                    for host in itertools.chain((host,), aliases):
+                        # Try simple match first
+                        if host in compare_with:
+                            matched = True
+                            break
+                        
+                        # Try pattern match next
+                        for pattern in compare_with:
+                            try:
+                                if re.match(pattern, host) is not None:
+                                    matched = True
+                                    break
+                            except re.error:
+                                log.debug("Invalid regular expression for ServerToServer white list for server domain %s: %s" % (self.originator.domain, pattern,))
+                        else:
+                            continue
                         break
-                    
-                    # Try pattern match next
-                    for pattern in compare_with:
-                        try:
-                            if re.match(pattern, host) is not None:
-                                matched = True
-                                break
-                        except re.error:
-                            log.debug("Invalid regular expression for ServerToServer white list for server domain %s: %s" % (self.originator.domain, pattern,))
-                    else:
-                        continue
-                    break
+                except socket.herror, e:
+                    log.debug("iSchedule cannot lookup client ip '%s': %s" % (clientip, str(e),))
                         
             if not matched:
                 log.err("Originator not on allowed server: %s" % (self.originator,))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081007/5c0a8e01/attachment-0001.html 


More information about the calendarserver-changes mailing list