#!/bin/sh # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #pragma ident "@(#)relabel.sh 1.1 07/10/17 SMI" # # This program is invoked to do the actual file transfer # associated with an invocation of the setflabel(3TSOL) function. # # It executes in the global zone with the user's identity and # basic privileges plus the file_dac_search privilege. This # script should not not assume that stdio is available or that # any particular environment variables are set. In particular, # the DISPLAY variable will not normally be pre-set. # # Authorization checks and zone limit privilege checks # are done before calling this script. Auditing is done # upon return. # ############################################################## # # Calling sequence: # # $1 is the global zone real pathname of the source file # # $2 is the global zone real destination pathname # # Exit status: # # 0 on success # 1 on error # ############################################################## # # This script can be customized or replaced to perform # additional processing such as tranquility checks, dirty # word filtering, copying instead of moving, etc. # # By default it does a check to determine if the source file # is in use by calling fuser(1). However, this check # does not work for filesystems that were automounted in # non-global zones. # # Perform a simple tranquility check # inuse=`/usr/sbin/fuser $1 2>&1 | /usr/bin/cut -d ":" -f2` if [ $inuse ]; then # # file is in use # exit 1 else # # Perform an inter-zone move of the data /usr/bin/mv $1 $2 exit $? fi