aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-02-14 00:54:42 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-02-14 00:54:42 +0000
commit18bdd894c2026fcdc31ebd8b58fa9313ccdff476 (patch)
treeda2d72377d8eb468e56bd99248b7cf49838f84a3
parent243db9ef7ae3fc061fc841c51b8c6f20490b3df7 (diff)
downloadmsec-18bdd894c2026fcdc31ebd8b58fa9313ccdff476.tar
msec-18bdd894c2026fcdc31ebd8b58fa9313ccdff476.tar.gz
msec-18bdd894c2026fcdc31ebd8b58fa9313ccdff476.tar.bz2
msec-18bdd894c2026fcdc31ebd8b58fa9313ccdff476.tar.xz
msec-18bdd894c2026fcdc31ebd8b58fa9313ccdff476.zip
corrected warnings reported by pychecker
-rw-r--r--share/Config.py24
-rw-r--r--share/ConfigFile.py1
-rwxr-xr-xshare/Perms.py42
3 files changed, 31 insertions, 36 deletions
diff --git a/share/Config.py b/share/Config.py
index ee2c10e..37a176f 100644
--- a/share/Config.py
+++ b/share/Config.py
@@ -8,8 +8,6 @@
# Purpose : configuration settings
#---------------------------------------------------------------
-import sys
-
CONFIG='/etc/security/msec2.conf'
_config={ 'root' : '',
@@ -31,16 +29,16 @@ def get_config(name, default=None):
def set_config(name, value):
_config[name] = value
-def converthexa(array):
- result=""
- for c in array:
- o=ord(c)
- d=o/16
- u=o-(d*16)
- result=result + "%x%x" % (d, u)
- return result
-
-def hashstring(str):
- return converthexa(md5.new(str).digest())
+# def converthexa(array):
+# result=""
+# for c in array:
+# o=ord(c)
+# d=int(o/16)
+# u=o-(d*16)
+# result=result + "%x%x" % (d, u)
+# return result
+#
+# def hashstring(str):
+# return converthexa(md5.new(str).digest())
# Config.py ends here
diff --git a/share/ConfigFile.py b/share/ConfigFile.py
index b041169..582b36e 100644
--- a/share/ConfigFile.py
+++ b/share/ConfigFile.py
@@ -253,7 +253,6 @@ class ConfigFile:
def get_match(self, regex, replace=None):
r=re.compile(regex)
lines = self.get_lines()
- matches = 0
for idx in range(0, len(lines)):
res = r.search(lines[idx])
if res:
diff --git a/share/Perms.py b/share/Perms.py
index 374f3ed..7069831 100755
--- a/share/Perms.py
+++ b/share/Perms.py
@@ -30,54 +30,54 @@ except IOError:
comment_regex = re.compile('^\s*#|^\s*$')
-user = {}
-group = {}
-userid = {}
-groupid = {}
+USER = {}
+GROUP = {}
+USERID = {}
+GROUPID = {}
def get_user_id(name):
try:
- return user[name]
+ return USER[name]
except KeyError:
try:
- user[name] = pwd.getpwnam(name)[2]
+ USER[name] = pwd.getpwnam(name)[2]
except KeyError:
error(_('user name %s not found') % name)
- user[name] = -1
- return user[name]
+ USER[name] = -1
+ return USER[name]
def get_user_name(id):
try:
- return userid[id]
+ return USERID[id]
except KeyError:
try:
- userid[id] = pwd.getpwuid(id)[0]
+ USERID[id] = pwd.getpwuid(id)[0]
except KeyError:
error(_('user name not found for id %d') % id)
- userid[id] = str(id)
- return userid[id]
+ USERID[id] = str(id)
+ return USERID[id]
def get_group_id(name):
try:
- return group[name]
+ return GROUP[name]
except KeyError:
try:
- group[name] = grp.getgrnam(name)[2]
+ GROUP[name] = grp.getgrnam(name)[2]
except KeyError:
error(_('group name %s not found') % name)
- group[name] = -1
- return group[name]
+ GROUP[name] = -1
+ return GROUP[name]
def get_group_name(id):
try:
- return groupid[id]
+ return GROUPID[id]
except KeyError:
try:
- groupid[id] = grp.getgrgid(id)[0]
+ GROUPID[id] = grp.getgrgid(id)[0]
except KeyError:
error(_('group name not found for id %d') % id)
- groupid[id] = str(id)
- return groupid[id]
+ GROUPID[id] = str(id)
+ return GROUPID[id]
assoc = {}
@@ -181,8 +181,6 @@ def chmod(f, newperm):
return 1
if __name__ == '__main__':
- import sys
- import Config
import getopt
_interactive = sys.stdin.isatty()