#NEWLINE# def drop_privileges( self ) : #NEWLINE# #INDENT# if ( getuid ( ) > 0 ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# uid = getpwnam ( self . user ) . pw_uid #NEWLINE# gid = getgrnam ( self . group ) . gr_gid #NEWLINE# #UNINDENT# except KeyError as error : #NEWLINE# #INDENT# print ( 'ERROR: Could not drop privileges {0:s}' . format ( error ) ) #NEWLINE# print ( format_exc ( ) ) #NEWLINE# raise SystemExit ( ( - 1 ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# setgroups ( [ ] ) #NEWLINE# setgid ( gid ) #NEWLINE# setuid ( uid ) #NEWLINE# if ( self . umask is not None ) : #NEWLINE# #INDENT# umask ( self . umask ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as error : #NEWLINE# #INDENT# print ( 'ERROR: Could not drop privileges {0:s}' . format ( error ) ) #NEWLINE# print ( format_exc ( ) ) #NEWLINE# raise SystemExit ( ( - 1 ) )