#NEWLINE# def ValidateAndLog( self , log ) : #NEWLINE# #INDENT# 'Validates an @ time spec line and logs any errors and warnings.\n\n    Args:\n      log: A LogCounter instance to record issues.\n    ' #NEWLINE# self . _CheckTimeField ( log ) #NEWLINE# if ( self . user in USER_WHITELIST ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( self . user ) > 31 ) : #NEWLINE# #INDENT# log . LineError ( log . MSG_INVALID_USER , ( 'Username too long "%s"' % self . user ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . user . startswith ( '-' ) : #NEWLINE# #INDENT# log . LineError ( log . MSG_INVALID_USER , ( 'Invalid username "%s"' % self . user ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if re . search ( '[\\s!"#$%&\\\'()*+,/:;<=>?@[\\\\\\]^`{|}~]' , self . user ) : #NEWLINE# #INDENT# log . LineError ( log . MSG_INVALID_USER , ( 'Invalid username "%s"' % self . user ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# pwd . getpwnam ( self . user ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# log . LineWarn ( log . MSG_USER_NOT_FOUND , ( 'User "%s" not found.' % self . user ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( self . command . startswith ( '%' ) or re . search ( '[^\\\\]%' , self . command ) ) : #NEWLINE# #INDENT# log . LineWarn ( log . MSG_BARE_PERCENT , 'A bare % is a line break in crontab and is commonly not intended.' )