(original) (raw)
changeset: 73036:bbd92b42508e parent: 73033:99c8b93c57cd parent: 73035:7d92b94b0eec user: Florent Xicluna florent.xicluna@gmail.com date: Thu Oct 20 23:14:36 2011 +0200 files: Lib/smtpd.py Misc/NEWS description: Issue #9168: now smtpd is able to bind privileged port. diff -r 99c8b93c57cd -r bbd92b42508e Lib/smtpd.py --- a/Lib/smtpd.py Thu Oct 20 19:53:35 2011 +0300 +++ b/Lib/smtpd.py Thu Oct 20 23:14:36 2011 +0200 @@ -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 -r 99c8b93c57cd -r bbd92b42508e Misc/NEWS --- a/Misc/NEWS Thu Oct 20 19:53:35 2011 +0300 +++ b/Misc/NEWS Thu Oct 20 23:14:36 2011 +0200 @@ -322,6 +322,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. /florent.xicluna@gmail.com