Beispiel #1
0
tests(
    [
        # Make file setuid daemon
        """\
% sudo chown daemon check_setuid
% sudo chmod u+s check_setuid
""",
        # Now setuid to daemon shoudn't change anything
        """\
% ./check_setuid 1
Real user ID: 10... (tn)
Effective user ID: 1 (daemon)
Saved user ID: 1 (daemon)

Calling setuid(1)

Real user ID: 10... (tn)
Effective user ID: 1 (daemon)
Saved user ID: 1 (daemon)
""",
        # And setuid to $UID should leave saved suid as daemon
        """\
% ./check_setuid $(id -ur)
Real user ID: 10... (tn)
Effective user ID: 1 (daemon)
Saved user ID: 1 (daemon)

Calling setuid(10...)

Real user ID: 10... (tn)
Effective user ID: 10... (tn)
Saved user ID: 1 (daemon)
...
"""
    ],
    only=("SunOS", "Linux"))
Beispiel #2
0
from shell_doctest import tests, test

tests([
# check-holes should report no holes in a file.nohole
"""\
% {make} --no-print-directory clean all
...
% ./check-holes file.nohole
""",
# make-file-with-holes should create file with correct number & size of holes.
"""\
% ./make-file-with-holes file.hole
% ./check-holes file.hole
Hole from 0 to 131072
Hole from 262144 to 393216
""",
# Check that ./copy-holes preserve holes.
"""\
% ./copy-holes file.hole file.hole.copy
% ./check-holes file.hole.copy
Hole from 0 to 131072
Hole from 262144 to 393216
% rm file.hole.copy
"""
], exclude=('DragonFly',) # At least when using HAMMER fs.
)

test(
# Check that cp doesn't preserve holes.
"""\
% cp file.hole file.hole.cp_copy
Beispiel #3
0
tests([
# Make file setuid daemon
"""\
% sudo chown daemon check_setuid
% sudo chmod u+s check_setuid
""",
# Now setuid to daemon shoudn't change anything
"""\
% ./check_setuid 1
Real user ID: 10... (tn)
Effective user ID: 1 (daemon)
Saved user ID: 1 (daemon)

Calling setuid(1)

Real user ID: 10... (tn)
Effective user ID: 1 (daemon)
Saved user ID: 1 (daemon)
""",
# And setuid to $UID should leave saved suid as daemon
"""\
% ./check_setuid $(id -ur)
Real user ID: 10... (tn)
Effective user ID: 1 (daemon)
Saved user ID: 1 (daemon)

Calling setuid(10...)

Real user ID: 10... (tn)
Effective user ID: 10... (tn)
Saved user ID: 1 (daemon)
...
"""
], only=("SunOS", "Linux"))
Beispiel #4
0
from shell_doctest import tests, test

tests(
    [
        # check-holes should report no holes in a file.nohole
        """\
% {make} --no-print-directory clean all
...
% ./check-holes file.nohole
""",
        # make-file-with-holes should create file with correct number & size of holes.
        """\
% ./make-file-with-holes file.hole
% ./check-holes file.hole
Hole from 0 to 131072
Hole from 262144 to 393216
""",
        # Check that ./copy-holes preserve holes.
        """\
% ./copy-holes file.hole file.hole.copy
% ./check-holes file.hole.copy
Hole from 0 to 131072
Hole from 262144 to 393216
% rm file.hole.copy
"""
    ],
    exclude=('DragonFly', )  # At least when using HAMMER fs.
)

test(
    # Check that cp doesn't preserve holes.