[prev in list] [next in list] [prev in thread] [next in thread]
List: python-patches
Subject: [Patches] [ python-Patches-1257988 ] fix smtplib when local host
From: noreply () sourceforge ! net (SourceForge ! net)
Date: 2005-08-24 17:00:30
Message-ID: E1E7yc2-00070V-NH () sc8-sf-web1 ! sourceforge ! net
[Download RAW message or body]
Patches item #1257988, was opened at 2005-08-12 22:18
Message generated for change (Comment added) made by arekm
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1257988&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Arkadiusz Miskiewicz (arekm)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix smtplib when local host isn't resolvable in dns
Initial Comment:
Suppose that hostname gives hostX. hostX doesn't exists in dns nor in /
etc/hosts (it's unresolvable).
Now when trying to connect to smtp service:
>>> import smtplib
>>> smtplib.SMTP('akcyza.pld-linux.org')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/share/python2.4/smtplib.py", line 255, in __init__
socket.gaierror: (-2, 'Name or service not known')
The problem is gethostbyname() here:
# We can't find an fqdn hostname, so use a domain literal
addr = socket.gethostbyname(socket.gethostname())
self.local_hostname = '[%s]' % addr
It's much easier and better to just use getsockname() for local socket.
Attached patch fixes this problem and doesn't require for the local
system to be resolvable in dns/hosts.
----------------------------------------------------------------------
>Comment By: Arkadiusz Miskiewicz (arekm)
Date: 2005-08-24 19:00
Message:
Logged In: YES
user_id=139606
On unconnected socket it returns 0.0.0.0 afaik which doesn't happen
here. Please drop that part.
----------------------------------------------------------------------
Comment By: Martin v. L?wis (loewis)
Date: 2005-08-24 17:01
Message:
Logged In: YES
user_id=21627
Why would getsockname return '0.0.0.0'?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1257988&group_id=5470
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic