aboutsummaryrefslogtreecommitdiffstats
path: root/bin/check_perms
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-02-22 17:51:37 +0900
committerYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-02-22 17:51:37 +0900
commit6aaafb6c05840389f1dd9139da9694f3b43c57df (patch)
tree3ca127f0bd34ede1ff388fa529fffad522d424d8 /bin/check_perms
parent3c78c57cc88877f701a935ce009efd39d31925e6 (diff)
downloadmailman2-6aaafb6c05840389f1dd9139da9694f3b43c57df.tar.gz
mailman2-6aaafb6c05840389f1dd9139da9694f3b43c57df.tar.xz
mailman2-6aaafb6c05840389f1dd9139da9694f3b43c57df.zip
Importing locale patch for command line utils, from RHEL6 rpm source
(for -japan-poem, originally imported from 2.1.12-18 package for RHEL6 rpm source)
Diffstat (limited to 'bin/check_perms')
-rwxr-xr-xbin/check_perms82
1 files changed, 41 insertions, 41 deletions
diff --git a/bin/check_perms b/bin/check_perms
index 137ebfb9..5249504a 100755
--- a/bin/check_perms
+++ b/bin/check_perms
@@ -45,7 +45,7 @@ directory. You must run this from the installation directory instead.
raise
from Mailman import mm_cfg
from Mailman.mm_cfg import MAILMAN_USER, MAILMAN_GROUP
-from Mailman.i18n import _
+from Mailman.i18n import C_
# Let KeyErrors percolate
MAILMAN_GID = grp.getgrnam(MAILMAN_GROUP)[2]
@@ -107,7 +107,7 @@ def checkwalk(arg, dirname, names):
for name in names:
path = os.path.join(dirname, name)
if arg.VERBOSE:
- print _(' checking gid and mode for %(path)s')
+ print C_(' checking gid and mode for %(path)s')
try:
mode, gid = statgidmode(path)
except OSError, e:
@@ -119,10 +119,10 @@ def checkwalk(arg, dirname, names):
except KeyError:
groupname = '<anon gid %d>' % gid
arg.ERRORS += 1
- print _('%(path)s bad group (has: %(groupname)s, '
- 'expected %(MAILMAN_GROUP)s)'),
+ print C_('%(path)s bad group (has: %(groupname)s, '
+ 'expected %(MAILMAN_GROUP)s)'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chown(path, -1, MAILMAN_GID)
else:
print
@@ -148,19 +148,19 @@ def checkwalk(arg, dirname, names):
octperms = oct(targetperms)
if S_ISDIR(mode) and (mode & targetperms) <> targetperms:
arg.ERRORS += 1
- print _('directory permissions must be %(octperms)s: %(path)s'),
+ print C_('directory permissions must be %(octperms)s: %(path)s'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | targetperms)
else:
print
elif os.path.splitext(path)[1] in ('.py', '.pyc', '.pyo'):
octperms = oct(PYFILEPERMS)
if mode & PYFILEPERMS <> PYFILEPERMS:
- print _('source perms must be %(octperms)s: %(path)s'),
+ print C_('source perms must be %(octperms)s: %(path)s'),
arg.ERRORS += 1
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | PYFILEPERMS)
else:
print
@@ -168,10 +168,10 @@ def checkwalk(arg, dirname, names):
# Article files must be group writeable
octperms = oct(ARTICLEFILEPERMS)
if mode & ARTICLEFILEPERMS <> ARTICLEFILEPERMS:
- print _('article db files must be %(octperms)s: %(path)s'),
+ print C_('article db files must be %(octperms)s: %(path)s'),
arg.ERRORS += 1
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | ARTICLEFILEPERMS)
else:
print
@@ -180,7 +180,7 @@ def checkall():
# first check PREFIX
if STATE.VERBOSE:
prefix = mm_cfg.PREFIX
- print _('checking mode for %(prefix)s')
+ print C_('checking mode for %(prefix)s')
dirs = {}
for d in (mm_cfg.PREFIX, mm_cfg.EXEC_PREFIX, mm_cfg.VAR_PREFIX,
mm_cfg.LOG_DIR):
@@ -190,13 +190,13 @@ def checkall():
mode = statmode(d)
except OSError, e:
if e.errno <> errno.ENOENT: raise
- print _('WARNING: directory does not exist: %(d)s')
+ print C_('WARNING: directory does not exist: %(d)s')
continue
if (mode & DIRPERMS) <> DIRPERMS:
STATE.ERRORS += 1
- print _('directory must be at least 02775: %(d)s'),
+ print C_('directory must be at least 02775: %(d)s'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(d, mode | DIRPERMS)
else:
print
@@ -206,14 +206,14 @@ def checkall():
def checkarchives():
private = mm_cfg.PRIVATE_ARCHIVE_FILE_DIR
if STATE.VERBOSE:
- print _('checking perms on %(private)s')
+ print C_('checking perms on %(private)s')
# private archives must not be other readable
mode = statmode(private)
if mode & S_IROTH:
STATE.ERRORS += 1
- print _('%(private)s must not be other-readable'),
+ print C_('%(private)s must not be other-readable'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(private, mode & ~S_IROTH)
else:
print
@@ -237,9 +237,9 @@ def checkmboxfile(mboxdir):
mode = statmode(mboxfile)
if (mode & MBOXPERMS) <> MBOXPERMS:
STATE.ERRORS = STATE.ERRORS + 1
- print _('mbox file must be at least 0660:'), mboxfile
+ print C_('mbox file must be at least 0660:'), mboxfile
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(mboxfile, mode | MBOXPERMS)
else:
print
@@ -260,9 +260,9 @@ def checkarchivedbs():
continue
if mode & S_IRWXO:
STATE.ERRORS += 1
- print _('%(dbdir)s "other" perms must be 000'),
+ print C_('%(dbdir)s "other" perms must be 000'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(dbdir, mode & ~S_IRWXO)
else:
print
@@ -270,18 +270,18 @@ def checkarchivedbs():
def checkcgi():
cgidir = os.path.join(mm_cfg.EXEC_PREFIX, 'cgi-bin')
if STATE.VERBOSE:
- print _('checking cgi-bin permissions')
+ print C_('checking cgi-bin permissions')
exes = os.listdir(cgidir)
for f in exes:
path = os.path.join(cgidir, f)
if STATE.VERBOSE:
- print _(' checking set-gid for %(path)s')
+ print C_(' checking set-gid for %(path)s')
mode = statmode(path)
if mode & S_IXGRP and not mode & S_ISGID:
STATE.ERRORS += 1
- print _('%(path)s must be set-gid'),
+ print C_('%(path)s must be set-gid'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | S_ISGID)
else:
print
@@ -289,13 +289,13 @@ def checkcgi():
def checkmail():
wrapper = os.path.join(mm_cfg.WRAPPER_DIR, 'mailman')
if STATE.VERBOSE:
- print _('checking set-gid for %(wrapper)s')
+ print C_('checking set-gid for %(wrapper)s')
mode = statmode(wrapper)
if not mode & S_ISGID:
STATE.ERRORS += 1
- print _('%(wrapper)s must be set-gid'),
+ print C_('%(wrapper)s must be set-gid'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(wrapper, mode | S_ISGID)
def checkadminpw():
@@ -303,7 +303,7 @@ def checkadminpw():
os.path.join(mm_cfg.DATA_DIR, 'creator.pw')):
targetmode = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP
if STATE.VERBOSE:
- print _('checking permissions on %(pwfile)s')
+ print C_('checking permissions on %(pwfile)s')
try:
mode = statmode(pwfile)
except OSError, e:
@@ -312,10 +312,10 @@ def checkadminpw():
if mode <> targetmode:
STATE.ERRORS += 1
octmode = oct(mode)
- print _('%(pwfile)s permissions must be exactly 0640 '
- '(got %(octmode)s)'),
+ print C_('%(pwfile)s permissions must be exactly 0640 '
+ '(got %(octmode)s)'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(pwfile, targetmode)
else:
print
@@ -337,7 +337,7 @@ def checkdata():
'digest.mbox', 'pending.pck',
'request.db', 'request.db.tmp')
if STATE.VERBOSE:
- print _('checking permissions on list data')
+ print C_('checking permissions on list data')
# BAW: This needs to be converted to the Site module abstraction
for dir in os.listdir(mm_cfg.LIST_DATA_DIR):
if not os.path.isdir(os.path.join(mm_cfg.LIST_DATA_DIR, dir)):
@@ -345,7 +345,7 @@ def checkdata():
for file in checkfiles:
path = os.path.join(mm_cfg.LIST_DATA_DIR, dir, file)
if STATE.VERBOSE:
- print _(' checking permissions on: %(path)s')
+ print C_(' checking permissions on: %(path)s')
try:
mode = statmode(path)
except OSError, e:
@@ -353,9 +353,9 @@ def checkdata():
continue
if (mode & targetmode) <> targetmode:
STATE.ERRORS += 1
- print _('file permissions must be at least 660: %(path)s'),
+ print C_('file permissions must be at least 660: %(path)s'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | targetmode)
else:
print
@@ -367,7 +367,7 @@ def usage(code, msg=''):
fd = sys.stderr
else:
fd = sys.stdout
- print >> fd, _(__doc__)
+ print >> fd, C_(__doc__)
if msg:
print >> fd, msg
sys.exit(code)
@@ -398,7 +398,7 @@ if __name__ == '__main__':
checkmta()
if not STATE.ERRORS:
- print _('No problems found')
+ print C_('No problems found')
else:
- print _('Problems found:'), STATE.ERRORS
- print _('Re-run as %(MAILMAN_USER)s (or root) with -f flag to fix')
+ print C_('Problems found:'), STATE.ERRORS
+ print C_('Re-run as %(MAILMAN_USER)s (or root) with -f flag to fix')