[Python-checkins] cpython (3.2): Issue #9168: now smtpd is able to bind privileged port.
florent.xicluna
python-checkins at python.org
Thu Oct 20 23:15:40 CEST 2011
http://hg.python.org/cpython/rev/7d92b94b0eec
changeset: 73035:7d92b94b0eec
branch: 3.2
parent: 73032:1d8fad82c32d
user: Florent Xicluna <florent.xicluna at gmail.com>
date: Thu Oct 20 23:03:43 2011 +0200
summary:
Issue #9168: now smtpd is able to bind privileged port.
files:
Lib/smtpd.py | 20 ++++++++++----------
Misc/NEWS | 2 ++
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/Lib/smtpd.py b/Lib/smtpd.py
--- a/Lib/smtpd.py
+++ b/Lib/smtpd.py
@@ -678,6 +678,16 @@
if __name__ == '__main__':
options = parseargs()
# Become nobody
+ classname = options.classname
+ if "." in classname:
+ lastdot = classname.rfind(".")
+ mod = __import__(classname[:lastdot], globals(), locals(), [""])
+ classname = classname[lastdot+1:]
+ else:
+ import __main__ as mod
+ class_ = getattr(mod, classname)
+ proxy = class_((options.localhost, options.localport),
+ (options.remotehost, options.remoteport))
if options.setuid:
try:
import pwd
@@ -691,16 +701,6 @@
if e.errno != errno.EPERM: raise
print('Cannot setuid "nobody"; try running with -n option.', file=sys.stderr)
sys.exit(1)
- classname = options.classname
- if "." in classname:
- lastdot = classname.rfind(".")
- mod = __import__(classname[:lastdot], globals(), locals(), [""])
- classname = classname[lastdot+1:]
- else:
- import __main__ as mod
- class_ = getattr(mod, classname)
- proxy = class_((options.localhost, options.localport),
- (options.remotehost, options.remoteport))
try:
asyncore.loop()
except KeyboardInterrupt:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -54,6 +54,8 @@
Library
-------
+- Issue #9168: now smtpd is able to bind privileged port.
+
- Issue #12529: fix cgi.parse_header issue on strings with double-quotes and
semicolons together. Patch by Ben Darnell and Petri Lehtinen.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list