Line
Link Here
|
0 |
-- queue-repair.py 2012-02-26 15:18:47.000000000 +0100 |
0 |
++ queue-repair.py3 2012-02-26 15:02:12.000000000 +0100 |
Lines 66-89
Link Here
|
66 |
# key: pathname - all paths are relative to conf-qmail |
66 |
# key: pathname - all paths are relative to conf-qmail |
67 |
# data: (user, group, mode, split) |
67 |
# data: (user, group, mode, split) |
68 |
# split is: 0 : no, 1 : yes, -1 : only with big-todo |
68 |
# split is: 0 : no, 1 : yes, -1 : only with big-todo |
69 |
'queue' : ('qmailq', 'qmail', 0750, 0), |
69 |
'queue' : ('qmailq', 'qmail', 0o750, 0), |
70 |
'queue/bounce' : ('qmails', 'qmail', 0700, 0), |
70 |
'queue/bounce' : ('qmails', 'qmail', 0o070, 0), |
71 |
'queue/info' : ('qmails', 'qmail', 0700, 1), |
71 |
'queue/info' : ('qmails', 'qmail', 0o070, 1), |
72 |
'queue/intd' : ('qmailq', 'qmail', 0700, -1), |
72 |
'queue/intd' : ('qmailq', 'qmail', 0o070, -1), |
73 |
'queue/local' : ('qmails', 'qmail', 0700, 1), |
73 |
'queue/local' : ('qmails', 'qmail', 0o070, 1), |
74 |
'queue/lock' : ('qmailq', 'qmail', 0750, 0), |
74 |
'queue/lock' : ('qmailq', 'qmail', 0o750, 0), |
75 |
'queue/mess' : ('qmailq', 'qmail', 0750, 1), |
75 |
'queue/mess' : ('qmailq', 'qmail', 0o750, 1), |
76 |
'queue/pid' : ('qmailq', 'qmail', 0700, 0), |
76 |
'queue/pid' : ('qmailq', 'qmail', 0o070, 0), |
77 |
'queue/remote' : ('qmails', 'qmail', 0700, 1), |
77 |
'queue/remote' : ('qmails', 'qmail', 0o070, 1), |
78 |
'queue/todo' : ('qmailq', 'qmail', 0750, -1), |
78 |
'queue/todo' : ('qmailq', 'qmail', 0o750, -1), |
79 |
} |
79 |
} |
80 |
|
80 |
|
81 |
nondirs = { |
81 |
nondirs = { |
82 |
# Files to check; format is: |
82 |
# Files to check; format is: |
83 |
# key: pathname - all paths are relative to conf-qmail |
83 |
# key: pathname - all paths are relative to conf-qmail |
84 |
# data: (user, group, mode) |
84 |
# data: (user, group, mode) |
85 |
'queue/lock/sendmutex' : ('qmails', 'qmail', 0600), |
85 |
'queue/lock/sendmutex' : ('qmails', 'qmail', 0o600), |
86 |
'queue/lock/tcpto' : ('qmailr', 'qmail', 0644), |
86 |
'queue/lock/tcpto' : ('qmailr', 'qmail', 0o644), |
87 |
} |
87 |
} |
88 |
|
88 |
|
89 |
|
89 |
|
Lines 105-111
Link Here
|
105 |
while i <= max: |
105 |
while i <= max: |
106 |
for p in primelist: |
106 |
for p in primelist: |
107 |
if (i % p == 0) or (p * p > i): break |
107 |
if (i % p == 0) or (p * p > i): break |
108 |
if (i % p <> 0): |
108 |
if (i % p != 0): |
109 |
primelist.append(i) |
109 |
primelist.append(i) |
110 |
if i >= min: |
110 |
if i >= min: |
111 |
result.append(i) |
111 |
result.append(i) |
Lines 223-229
Link Here
|
223 |
msg(' fixed, %s ownership %i:%i' % (path, s[ST_UID], s[ST_GID])) |
223 |
msg(' fixed, %s ownership %i:%i' % (path, s[ST_UID], s[ST_GID])) |
224 |
else: |
224 |
else: |
225 |
msg(' testmode, not fixing') |
225 |
msg(' testmode, not fixing') |
226 |
except OSError, o: |
226 |
except OSError as o: |
227 |
err(o or '[no error message]') |
227 |
err(o or '[no error message]') |
228 |
checked_owner[path] = None |
228 |
checked_owner[path] = None |
229 |
|
229 |
|
Lines 247-253
Link Here
|
247 |
msg(' changed %s mode to %o' % (path, newmode)) |
247 |
msg(' changed %s mode to %o' % (path, newmode)) |
248 |
else: |
248 |
else: |
249 |
msg(' testmode, not fixing') |
249 |
msg(' testmode, not fixing') |
250 |
except OSError, o: |
250 |
except OSError as o: |
251 |
err(o or '[no error message]') |
251 |
err(o or '[no error message]') |
252 |
checked_mode[path] = None |
252 |
checked_mode[path] = None |
253 |
|
253 |
|
Lines 467-473
Link Here
|
467 |
if not os.path.exists(path) and not testmode: |
467 |
if not os.path.exists(path) and not testmode: |
468 |
os.mkfifo(path) |
468 |
os.mkfifo(path) |
469 |
chown(path, user, group) |
469 |
chown(path, user, group) |
470 |
chmod(path, 0622) |
470 |
chmod(path, 0o622) |
471 |
|
471 |
|
472 |
####################################### |
472 |
####################################### |
473 |
def check_messages(path, split): |
473 |
def check_messages(path, split): |
Lines 549-557
Link Here
|
549 |
# Nothing in these directories to check at this point |
549 |
# Nothing in these directories to check at this point |
550 |
continue |
550 |
continue |
551 |
elif path in ('queue/mess', 'queue/todo'): |
551 |
elif path in ('queue/mess', 'queue/todo'): |
552 |
mode = 0644 |
552 |
mode = 0o644 |
553 |
else: |
553 |
else: |
554 |
mode = 0600 |
554 |
mode = 0o600 |
555 |
this_split = is_splitdir(is_split, bigtodo) |
555 |
this_split = is_splitdir(is_split, bigtodo) |
556 |
if this_split: |
556 |
if this_split: |
557 |
splits = range(split) |
557 |
splits = range(split) |
Lines 747-753
Link Here
|
747 |
if force_split < 1: |
747 |
if force_split < 1: |
748 |
raise ValueError |
748 |
raise ValueError |
749 |
except ValueError: |
749 |
except ValueError: |
750 |
raise getopt.error, 'split value must be a positive integer (%s)' % value |
750 |
raise getopt.error('split value must be a positive integer (%s)' % value) |
751 |
elif option in ('-n', '--no-bigtodo'): |
751 |
elif option in ('-n', '--no-bigtodo'): |
752 |
force_bigtodo = -1 |
752 |
force_bigtodo = -1 |
753 |
elif option in ('-b', '--bigtodo'): |
753 |
elif option in ('-b', '--bigtodo'): |
Lines 765-774
Link Here
|
765 |
create = 1 |
765 |
create = 1 |
766 |
if args: |
766 |
if args: |
767 |
if len(args) > 1: |
767 |
if len(args) > 1: |
768 |
raise getopt.error, 'conf-qmail must be a single argument (%s)' % string.join(args) |
768 |
raise getopt.error ('conf-qmail must be a single argument (%s)' % string.join(args)) |
769 |
qmaildir = args[0] |
769 |
qmaildir = args[0] |
770 |
|
770 |
|
771 |
except getopt.error, o: |
771 |
except getopt.error as o: |
772 |
err('Error: %s' % o, showhelp=1) |
772 |
err('Error: %s' % o, showhelp=1) |
773 |
|
773 |
|
774 |
check_queue(qmaildir, test, force_split, force_bigtodo, create, mathishard) |
774 |
check_queue(qmaildir, test, force_split, force_bigtodo, create, mathishard) |