Enhancement: Sanity Check Subscribers MX Record
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Mailman |
New
|
Undecided
|
Unassigned |
Bug Description
Attempted to path mailman 2.1.17 with a simple MX record check on web-based subscribers.
Running Debian 7.4
python 2.7.3-4+deb7u1
python-dns 2.3.6-1+deb7u1
Python-dns installed to /usr/lib/
Attempted patches follow
dragon@
$ diff subscribe.py subscribe.py.dns
212a213,221
> except Errors.
> results = _("""\
> The email address you supplied is not valid. Host not found.""")
> except Errors.
> results = _("""\
> The email address you supplied does not have a MX record.""")
> except Errors.
> results = _("""\
> The email address you supplied had some unknown DNS error.""")
dragon@
$ diff Utils.py Utils.py.dns
40a41
> import DNS
237a239,247
> # MX Record sanity checks
> try:
> mx_host - DNS.mxlookup(
> if len(mx_host) < 1:
> raise Errors.
> except DNS.Base.
> raise Errors.
> except:
> raise Errors.
dragon@
$ diff Errors.py Errors.py.dns
98a99,110
> class MMBadEmailHostN
> """Email address domain name does not resolve to a known host."""
> pass
>
> class MMBadEmailMXRec
> """Email address domain name does not have a MX record."""
> pass
>
> class MMBadEmailUnkno
> """Email address domain name had unknown DNS error."""
> pass
>
When running said patches, mailman complained with:
admin(13907): [----- Mailman Version: 2.1.17 -----]
admin(13907): [----- Traceback ------]
admin(13907): Traceback (most recent call last):
admin(13907): File "/usr/local/
admin(13907): pkg = __import_
admin(13907): File "/usr/local/
admin(13907): from Mailman import MailList
admin(13907): File "/usr/local/
admin(13907): from Mailman import Utils
admin(13907): File "/usr/local/
admin(13907): import DNS
admin(13907): ImportError: No module named DNS
admin(13907): [----- Python Information -----]
admin(13907): sys.version = 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2]
admin(13907): sys.executable = /usr/bin/python
admin(13907): sys.prefix = /usr
admin(13907): sys.exec_prefix = /usr
admin(13907): sys.path = ['/usr/
admin(13907): sys.platform = linux2
AFAICS, it seems like Utils.py isn't locating the system wide python-dns library.
How do I modify the sys.path to include python-dns under /usr/lib/
Thanks
> admin(13907): ImportError: No module named DNS local/mailman- 2.1.17/ pythonlib' , '/usr/local/ mailman- 2.1.17' , '/usr/local/ mailman- 2.1.17/ scripts' , '/usr/local/ mailman- 2.1.17' , '/usr/lib/ python2. 7/', '/usr/lib/ python2. 7/plat- linux2' , '/usr/lib/ python2. 7/lib-tk' , '/usr/lib/ python2. 7/lib-old' , '/usr/lib/ python2. 7/lib-dynload' , '/usr/lib/ python2. 7/site- packages' ]
> admin(13907): [----- Python Information -----]
> admin(13907): sys.version = 2.7.3 (default, Jan 2 2013, 13:56:14)
> [GCC 4.7.2]
> admin(13907): sys.executable = /usr/bin/python
> admin(13907): sys.prefix = /usr
> admin(13907): sys.exec_prefix = /usr
> admin(13907): sys.path = ['/usr/
> admin(13907): sys.platform = linux2
>
> AFAICS, it seems like Utils.py isn't locating the system wide python-dns
> library.
Correct. sys.path does not include /usr/lib/ python2. 7/dist- packages/
> How do I modify the sys.path to include python-dns under python2. 7/dist- packages?
> /usr/lib/
sys.path. append( '/usr/lib/ python2. 7/dist- packages/ ')
However, this should not be necessary as python2. 7/dist- packages/ ' should already be included in python2. 7/site. py which is normally executed during python
'/usr/lib/
sys.path. Why it isn't is a Python question, but
/usr/lib/
startup should put it there. What do you see if you invoke an
interactive python session and import sys and print sys.path as in
$ python python2. 7', '/usr/lib/ python2. 7/plat- x86_64- linux-gnu' , python2. 7/lib-tk' , '/usr/lib/ python2. 7/lib-old' , python2. 7/lib-dynload' , lib/python2. 7/dist- packages' , python2. 7/dist- packages' , python2. 7/dist- packages/ PILcompat' , python2. 7/dist- packages/ gtk-2.0' , pymodules/ python2. 7', python2. 7/dist- packages/ ubuntu- sso-client' , python2. 7/dist- packages/ ubuntuone- client' , python2. 7/dist- packages/ ubuntuone- control- panel', python2. 7/dist- packages/ ubuntuone- storage- protocol' ]
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/
'/usr/lib/
'/usr/lib/
'/usr/local/
'/usr/lib/
'/usr/lib/
'/usr/lib/
'/usr/lib/
'/usr/lib/
'/usr/lib/
'/usr/lib/
'/usr/lib/
>>>
--
Mark Sapiro <email address hidden> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan