@@ -678,6 +678,16 @@ def parseargs():
678
678
if __name__ == '__main__' :
679
679
options = parseargs ()
680
680
# Become nobody
681
+ classname = options .classname
682
+ if "." in classname :
683
+ lastdot = classname .rfind ("." )
684
+ mod = __import__ (classname [:lastdot ], globals (), locals (), ["" ])
685
+ classname = classname [lastdot + 1 :]
686
+ else :
687
+ import __main__ as mod
688
+ class_ = getattr (mod , classname )
689
+ proxy = class_ ((options .localhost , options .localport ),
690
+ (options .remotehost , options .remoteport ))
681
691
if options .setuid :
682
692
try :
683
693
import pwd
@@ -691,16 +701,6 @@ def parseargs():
691
701
if e .errno != errno .EPERM : raise
692
702
print ('Cannot setuid "nobody"; try running with -n option.' , file = sys .stderr )
693
703
sys .exit (1 )
694
- classname = options .classname
695
- if "." in classname :
696
- lastdot = classname .rfind ("." )
697
- mod = __import__ (classname [:lastdot ], globals (), locals (), ["" ])
698
- classname = classname [lastdot + 1 :]
699
- else :
700
- import __main__ as mod
701
- class_ = getattr (mod , classname )
702
- proxy = class_ ((options .localhost , options .localport ),
703
- (options .remotehost , options .remoteport ))
704
704
try :
705
705
asyncore .loop ()
706
706
except KeyboardInterrupt :
0 commit comments