Attachment 'check.py'

Download

   1 #! /usr/bin/python
   2 import os
   3 import grp
   4 import errno
   5 from stat import *
   6 def dodir(d):
   7     gid = grp.getgrnam('list').gr_gid
   8     for nm in os.listdir(d):
   9         fn = os.path.join(d, nm)
  10         try:
  11             st = os.stat(fn)
  12         except OSError, e:
  13             if e.errno == errno.ENOENT:
  14                 continue
  15             else:
  16                 raise
  17         if st.st_gid != gid:
  18             print '%s not group list, fixing' % fn
  19             os.chown(fn, -1, gid)
  20         if (os.path.isdir(fn) or
  21                 d == '/var/lib/mailman/mail' or
  22                 d == '/var/lib/mailman/cgi-bin'):
  23             if not st.st_mode & S_ISGID:
  24                 print '%s not SETGID, fixing' % fn
  25                 os.chmod(fn, st.st_mode | S_ISGID)
  26             if os.path.isdir(fn):
  27                 dodir(fn)
  28 dodir('/var/lib/mailman')

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2014-06-06 22:15:01, 0.8 KB) [[attachment:check.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.