[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Patch from tobias: do not die when we fail to resolve o...



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria:/tmp/cvs-serv26328/lib/mixminion/server

Modified Files:
	ServerKeys.py 
Log Message:
Patch from tobias: do not die when we fail to resolve our own hostname as a server.

Index: ServerKeys.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerKeys.py,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- ServerKeys.py	8 Dec 2005 16:11:36 -0000	1.72
+++ ServerKeys.py	8 Oct 2007 19:03:21 -0000	1.73
@@ -1058,8 +1058,8 @@
     if fields['Hostname'] is None:
         fields['Hostname'] = socket.getfqdn()
         LOG.warn("No Hostname configured; guessing %s",fields['Hostname'])
-    _checkHostnameIsLocal(fields['Hostname'])
     try:
+        _checkHostnameIsLocal(fields['Hostname'])
         dnsResults = mixminion.NetUtils.getIPs(fields['Hostname'])
     except socket.error, e:
         LOG.warn("Can't resolve configured hostname %r: %s",
@@ -1246,21 +1246,16 @@
 def _checkHostnameIsLocal(name):
     if _KNOWN_LOCAL_HOSTNAMES.has_key(name):
         return
-    try:
-        r = mixminion.NetUtils.getIPs(name)
-        for family, addr, _ in r:
-            if family == mixminion.NetUtils.AF_INET:
-                if addr.startswith("127.") or addr.startswith("0."):
-                    LOG.warn("Hostname %r resolves to reserved address %s",
-                             name, addr)
-            else:
-                if addr in ("::", "::1"):
-                    LOG.warn("Hostname %r resolves to reserved address %s",
-                             name,addr)
-    except socket.error, e:
-        # ???? Turn this into a warning, if people have a real reason to
-        # ???? use a hostname that they themselves cannot resolve.
-        raise UIError("Cannot resolve hostname %r: %s"%(name,e))
+    r = mixminion.NetUtils.getIPs(name)
+    for family, addr, _ in r:
+        if family == mixminion.NetUtils.AF_INET:
+            if addr.startswith("127.") or addr.startswith("0."):
+                LOG.warn("Hostname %r resolves to reserved address %s",
+                         name, addr)
+        else:
+            if addr in ("::", "::1"):
+                LOG.warn("Hostname %r resolves to reserved address %s",
+                         name,addr)
     _KNOWN_LOCAL_HOSTNAMES[name] = 1
 
 def generateCertChain(filename, mmtpKey, identityKey, nickname,