Dmitry V. Levin | 1da7c95 | 2014-12-13 18:24:13 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Check uid decoding. |
| 4 | |
| 5 | . "${srcdir=.}/init.sh" |
| 6 | |
Dmitry V. Levin | d2a9ce6 | 2015-01-14 10:13:59 +0000 | [diff] [blame] | 7 | check_prog gawk |
Dmitry V. Levin | 1da7c95 | 2014-12-13 18:24:13 +0000 | [diff] [blame] | 8 | |
| 9 | s="${uid_syscall_suffix-}" |
| 10 | w="${uid_t_size-}" |
| 11 | uid="uid$s$w" |
| 12 | ./"$uid" || { |
| 13 | if [ $? -eq 77 ]; then |
| 14 | framework_skip_ "some uid$s or uid${w}_t syscalls are not available" |
| 15 | else |
| 16 | fail_ "$uid failed" |
| 17 | fi |
| 18 | } |
| 19 | |
Dmitry V. Levin | 530bed0 | 2014-12-14 13:30:54 +0000 | [diff] [blame] | 20 | syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,chown$s,getgroups$s" |
Dmitry V. Levin | 1da7c95 | 2014-12-13 18:24:13 +0000 | [diff] [blame] | 21 | args="-e trace=$syscalls" |
| 22 | $STRACE -o "$LOG" $args ./"$uid"|| { |
| 23 | cat "$LOG" |
| 24 | fail_ "$STRACE $args ./$uid failed" |
| 25 | } |
| 26 | |
Dmitry V. Levin | d2a9ce6 | 2015-01-14 10:13:59 +0000 | [diff] [blame] | 27 | gawk -f "$srcdir"/uid.awk -v suffix="$s" "$LOG" || { |
Dmitry V. Levin | 1da7c95 | 2014-12-13 18:24:13 +0000 | [diff] [blame] | 28 | cat "$LOG" |
| 29 | fail_ 'unexpected output' |
| 30 | } |
| 31 | |
| 32 | exit 0 |