]> granicus.if.org Git - python/commitdiff
#14758: Need to specify the desired socket type in the getaddrinfo call.
authorR David Murray <rdmurray@bitdance.com>
Wed, 11 Jun 2014 19:17:50 +0000 (15:17 -0400)
committerR David Murray <rdmurray@bitdance.com>
Wed, 11 Jun 2014 19:17:50 +0000 (15:17 -0400)
This worked by accident on Linux because the SOCK_STREAM was returned
first, but on the FreeBSD the SOCK_DGRAM is first in the list.

Lib/smtpd.py

index d828c5f12fee85daaf91b5a26a8930e97a7c4254..f90fae8e15a47abf44a2720922d4bd60b2c8f288 100755 (executable)
@@ -610,7 +610,8 @@ class SMTPServer(asyncore.dispatcher):
         self._decode_data = decode_data
         asyncore.dispatcher.__init__(self, map=map)
         try:
-            gai_results = socket.getaddrinfo(*localaddr)
+            gai_results = socket.getaddrinfo(*localaddr,
+                                             type=socket.SOCK_STREAM)
             self.create_socket(gai_results[0][0], gai_results[0][1])
             # try to re-use a server port if possible
             self.set_reuse_addr()