[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: Crash on 0.
Hi,
Marco wrote:
> File
> "/usr/lib/python2.4/site-packages/mixminion/server/ServerKeys.py", line
> 1061, in generateServerDescriptorAndKeys
> _checkHostnameIsLocal(fields['Hostname'])
> File
> "/usr/lib/python2.4/site-packages/mixminion/server/ServerKeys.py", line
> 1263, in _checkHostnameIsLocal
> raise UIError("Cannot resolve hostname %r: %s"%(name,e))
> UIError: Cannot resolve hostname
> 'sullust.winstonsmith.info': (-3,
> 'Temporary failure in name resolution')
My suggestion:
don't catch the socket.error in _checkHostnameIsLocal(), but in
generateServerDescriptorAndKeys() instead, NetUtils.getIPs() is
called there anyway.
I've tried and a patch follows. At least, mixminiond didn't crash
at once here, but could please somebody else have a look at it?
===== Beginn =====
--- ServerKeys.py.old 2005-12-08 17:11:36.000000000 +0100
+++ ServerKeys.py 2007-09-27 00:03:05.000000000 +0200
@@ -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,
===== Ende =====
Ciao
Tobias
--
mbox:admin@tainaron