view previous-work/more_control_helpers/lib/chown @ 20:c75924bd38e3

fix security hole relating to path for package user.
author Robert McIntyre <rlm@mit.edu>
date Thu, 10 Jan 2013 04:25:17 +0000
parents d6bef198ae71
children
line wrap: on
line source
1 #!/bin/bash
2 # Copyright (c) 2000,2004 Matthias S. Benkmann <article AT winterdrache DOT de>
3 # You may do everything with this code except misrepresent its origin.
4 # PROVIDED `AS IS' WITH ABSOLUTELY NO WARRANTY OF ANY KIND!
6 DAISY_CHAIN=""
8 for p in $(type -ap chown) ; do
9 if [ ! $p -ef $0 ]; then DAISY_CHAIN=$p ; break ; fi
10 done
12 if [ ! -n "$DAISY_CHAIN" ]; then
13 echo Cannot find real ${0##*/} command
14 exit 1
15 fi
17 if [ $UID == 0 ]; then
18 exec $DAISY_CHAIN "$@"
19 fi
21 # Package users can't chown anything at all, so
22 # having the script test for specific parameters
23 # is pointless.
24 #if [ "$1" == "root.root" ]; then
25 echo 1>&2 '***' chown "$@"
26 #else
27 # $DAISY_CHAIN "$@" || exit $?
28 #fi
30 exit 0