From 52a6de461ffcec76834f7f31766681359e292339 Mon Sep 17 00:00:00 2001
From: Hanspeter Spalinger <hanspeter@spahan.ch>
Date: Wed, 10 Aug 2016 09:11:16 +0200
Subject: [PATCH] fix variable scope

---
 chkcrontab_lib.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/chkcrontab_lib.py b/chkcrontab_lib.py
index 0313c61..921b965 100755
--- a/chkcrontab_lib.py
+++ b/chkcrontab_lib.py
@@ -697,6 +697,7 @@ class CronLineTimeAction(object):
     self.time_field = time_field
     self.user = user
     self.command = command
+    self.check_passwd = check_passwd
 
   def _CheckTimeField(self, log):
     """Virtual method to be implemented by subclasses to check time field."""
@@ -720,7 +721,7 @@ class CronLineTimeAction(object):
       log.LineError(log.MSG_INVALID_USER, 'Invalid username "%s"' % self.user)
     elif re.search(r'[\s!"#$%&\'()*+,/:;<=>?@[\\\]^`{|}~]', self.user):
       log.LineError(log.MSG_INVALID_USER, 'Invalid username "%s"' % self.user)
-    elif check_passwd:
+    elif self.check_passwd:
       try:
         pwd.getpwnam(self.user)
       except KeyError:
-- 
GitLab