Package: makejail
Version: 0.0.5-9

Makejail fails to copy setuid bit. Can't find any way to force this
behaviour in the configuration, and I don't believe this is a design
feature.

The error seems to occur due to the ordering of the way the file
permissions and user/group ids are applied. Pasted below is a copy of
the relevant code.

#!/usr/bin/python

import stat
import sys
import os
import shutil

# May be useful to parse correctly some program outputs
os.environ["LANG"]="C"

def copyStatAndOwner(source,target):
        # Keep all attributes
        shutil.copystat(source,target)

        # Copy user/group info
        statInfos=os.stat(source)
        os.chown(target,statInfos[stat.ST_UID],statInfos[stat.ST_GID])

def copyStatAndOwner2(source,target):
        # Copy user/group info
        statInfos=os.stat(source)
        os.chown(target,statInfos[stat.ST_UID],statInfos[stat.ST_GID])

        # Keep all attributes
        shutil.copystat(source,target)

if __name__=="__main__":
        file_in = "test.sh"
        file_out = "test2.sh"

        shutil.copy(file_in,file_out)
        copyStatAndOwner2(file_in,file_out)

        sys.exit(0)

CopyStatAndOwner is taken from makejail, CopyStatAndOwner2 is my
suggestion as a fix. 

Running chown/chgrp from the command line on a setuid file has the same
effect, which would seem to be the root of the problem.




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to