Remove the setuid functionality

It was not a good idea, and trying to do it right would be too much effort.
This commit is contained in:
Nikolaus Schulz 2008-08-03 20:51:55 +02:00
parent bd85cffe37
commit cd07a2663e
1 changed files with 0 additions and 24 deletions

View File

@ -1127,24 +1127,6 @@ def archive(mailbox_name):
check_sane_destdir(dest_dir)
vprint("archiving '%s' to '%s' ..." % (mailbox_name, final_archive_name))
# check to see if we are running as root -- if so, change our effective
# userid and groupid to that of the original mailbox
running_setuid = False
if (os.getuid() == 0) and os.path.exists(mailbox_name):
former_gid = os.getgid() # groupid doesn't have to be '0' for root on solaris 8?
mailbox_user = os.stat(mailbox_name)[stat.ST_UID]
mailbox_group = os.stat(mailbox_name)[stat.ST_GID]
if (mailbox_user, mailbox_group) != (0, former_gid):
running_setuid = True
vprint("changing effective group id to: %d" % mailbox_group)
os.setegid(mailbox_group)
vprint("changing effective user id to: %d" % mailbox_user)
os.seteuid(mailbox_user)
user_warning("changing effective user id: this automatic feature "
"is deprecated and will be removed from later versions.")
old_temp_dir = tempfile.tempdir
try:
# create a temporary directory for us to work in securely
@ -1184,12 +1166,6 @@ def archive(mailbox_name):
tempfile.tempdir = old_temp_dir
clean_up()
# if we are running as root, revert the seteuid()/setegid() above
if running_setuid:
vprint("changing effective groupid and userid back to root")
os.setegid(former_gid)
os.seteuid(0)
def _archive_mbox(mailbox_name, final_archive_name):
"""Archive a 'mbox' style mailbox - used by archive_mailbox()