cpython: bbd92b42508e (original) (raw)
Mercurial > cpython
changeset 73036:bbd92b42508e
Issue #9168: now smtpd is able to bind privileged port. [#9168]
Florent Xicluna florent.xicluna@gmail.com | |
---|---|
date | Thu, 20 Oct 2011 23:14:36 +0200 |
parents | 99c8b93c57cd(current diff)7d92b94b0eec(diff) |
children | c1effa2cdd20 |
files | Lib/smtpd.py Misc/NEWS |
diffstat | 2 files changed, 12 insertions(+), 10 deletions(-)[+] [-] Lib/smtpd.py 20 Misc/NEWS 2 |
line wrap: on
line diff
--- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@ -678,6 +678,16 @@ def parseargs(): if name == 'main': options = parseargs() # Become nobody
- classname = options.classname
- if "." in classname:
lastdot = classname.rfind(".")[](#l1.9)
mod = __import__(classname[:lastdot], globals(), locals(), [""])[](#l1.10)
classname = classname[lastdot+1:][](#l1.11)
- else:
import __main__ as mod[](#l1.13)
- class_ = getattr(mod, classname)
- proxy = class_((options.localhost, options.localport),
if options.setuid: try: import pwd(options.remotehost, options.remoteport))[](#l1.16)
@@ -691,16 +701,6 @@ if name == 'main': 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(".")[](#l1.26)
mod = __import__(classname[:lastdot], globals(), locals(), [""])[](#l1.27)
classname = classname[lastdot+1:][](#l1.28)
- else:
import __main__ as mod[](#l1.30)
- class_ = getattr(mod, classname)
- proxy = class_((options.localhost, options.localport),
try: asyncore.loop() except KeyboardInterrupt:(options.remotehost, options.remoteport))[](#l1.33)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -322,6 +322,8 @@ Core and Builtins Library ------- +- Issue #9168: now smtpd is able to bind privileged port. +