2
# Copyright (C) 2002-2005 Novell/SUSE
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License as
6
# published by the Free Software Foundation, version 2 of the
11
# This tests passing a file descriptor over a unix domain socket. The server
12
# opens a socket, forks a client with it's own profile, passes the file
13
# descriptor to it over the socket, and sees what happens.
17
pwd=`cd $pwd ; /bin/pwd`
24
socket=${tmpdir}/unix_fd_test
25
fd_client=$PWD/unix_fd_client
29
# Content generated with:
30
# dd if=/dev/urandom bs=32 count=4 2> /dev/null | od -x | head -8 | sed -e 's/^[[:xdigit:]]\{7\}//g' -e 's/ //g'
32
aabcc2739c621194a00b6cb7875dcdeb
33
72f485a783219817c81c65f3e1b2bc80
34
4366ba09e881286c834e67b34ae6f186
35
ccc2c402fcc6e66d5cfaa0c68b94211c
36
163f7beeb9a320ab859189a82d695713
37
175797a8cf2e2435dd98551385e96d8f
38
05f82e8e0e146be0d4655d4681cb08b6
39
ed15ad1d4fb9959008589e589206ee13
42
# lets just be on the safe side
45
# PASS - unconfined client
47
genprofile $file:$okperm $socket:rw $fd_client:ux
49
runchecktest "fd passing; unconfined client" pass $file $socket $fd_client
54
# PASS - confined client, rw access to the file
56
genprofile $file:$okperm $socket:rw $fd_client:px -- image=$fd_client $file:$okperm $socket:rw
57
runchecktest "fd passing; confined client w/ rw" pass $file $socket $fd_client
61
# FAIL - confined client, w access to the file
63
genprofile $file:$okperm $socket:rw $fd_client:px -- image=$fd_client $file:$badperm $socket:rw
64
runchecktest "fd passing; confined client w/ w only" fail $file $socket $fd_client