Menu

#23 Small bug setting gid

closed-fixed
None
3
2007-11-02
2007-07-28
No

When using the verbose option on IMAP mailboxes and running under root, e.g.

archivemail -v imap://user:pw@server/mb

the variable 'former_id' in the following section around line 1100 stays at 'None':

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):
...

This is because mailbox_name is an IMAP mailbox and therefore the path doesn't exist. Later on, in the 'finally' section it tries to set the gid to 'None' which, of course, fails:

# 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(former_gid)

In order to catch this case I would suggest to replace the condition to:

if os.getuid() == 0 and former_gid != None:

Works fine here.

Discussion

  • helloworld.c

    helloworld.c - 2007-07-29

    Logged In: YES
    user_id=1760487
    Originator: YES

    As I sent it I realized that the verbose option has absolutely nothing to do with it, so just using it as root with an IMAP mailbox should be enough to make it fail.

     
  • Nikolaus Schulz

    Nikolaus Schulz - 2007-11-02

    Logged In: YES
    user_id=1594781
    Originator: NO

    Fixed in subversion. Will go into 0.7.1.

     
  • Nikolaus Schulz

    Nikolaus Schulz - 2007-11-02
    • priority: 5 --> 3
    • assigned_to: nobody --> nikosch
    • status: open --> closed-fixed
     

Log in to post a comment.