1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2024-12-22 07:42:55 +00:00

Don't assume that root's grpid is '0' -- on solaris it can be different.

This commit is contained in:
Paul Rodger 2002-11-07 22:54:03 +00:00
parent 9d08aca3b9
commit 60f119d64a
2 changed files with 31 additions and 23 deletions

49
TODO
View file

@ -1,24 +1,29 @@
.archivemailrc support
Goals for next minor release
-------------------------------------
* .archivemailrc support
* When you get a file-not-found in the 6th mailbox of 10, it aborts the whole
run. Better to fail gracefully and keep going.
* Think about the best way to specify the names of archives created with
possibly an --archive-name option.
* Add more tests (see top of test_archivemail.py)
* We need some better checking to see if we are really looking at a valid
mbox-format mailbox.
* Lock any original .gz files
- is this necessary?
* Check for symlink attacks for tempfiles (although we don't use /var/tmp)
When you get a file-not-found in the 6th mailbox of 10, it aborts the whole
run. Better to fail gracefully and keep going.
Longer Term goals:
------------------
* Add an option to not cut threads.
* Add MMDF mailbox support
* Add Babyl mailbox support
* Add option to archive depending on mailbox size threshold
- is this a good idea?
* Add option to archive depending on number of messages
- is this a good idea?
Think about the best way to specify the names of archives created with
possibly an --archive-name option.
Add more tests (see top of test_archivemail.py)
We need some better checking to see if we are really looking at a valid
mbox-format mailbox.
Lock any original .gz files
- is this necessary?
Check for symlink attacks for tempfiles (although we don't use /var/tmp)
Add an option to not cut threads.
Add MMDF mailbox support
Add Babyl mailbox support
Add option to archive depending on mailbox size threshold
- is this a good idea?
Add option to archive depending on number of messages
- is this a good idea?

View file

@ -1007,7 +1007,10 @@ def archive(mailbox_name):
# check to see if we are running as root -- if so, change our effective
# userid and groupid to that of the original mailbox
former_gid = None # groupid doesn't have to be '0' for root on solaris 8?
if (os.getuid() == 0) and os.path.exists(mailbox_name):
former_gid = os.getgid(); # remember this so we can change back
mailbox_user = os.stat(mailbox_name)[stat.ST_UID]
mailbox_group = os.stat(mailbox_name)[stat.ST_GID]
vprint("changing effective group id to: %d" % mailbox_group)
@ -1054,7 +1057,7 @@ def archive(mailbox_name):
# if we are running as root, revert the seteuid()/setegid() above
if (os.getuid() == 0):
vprint("changing effective groupid and userid back to root")
os.setegid(0)
os.setegid(former_gid)
os.seteuid(0)