9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Use is subject to license terms.
e98f46cc16b6ba1555409cb3c7e384bdb0792875Adam Leventhal# Copyright (c) 2012 by Delphix. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl############################################################################
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# ASSERTION:
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# To verify egid of current process
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# SECTION: Scripting
9512fe850e98fdd448c638ca63fdd92a8a510255ahl############################################################################
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeeif [ $# != 1 ]; then
9512fe850e98fdd448c638ca63fdd92a8a510255ahl## Create .d file
9512fe850e98fdd448c638ca63fdd92a8a510255ahl##########################################################################
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#!$dtrace -qs
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/\$egid != \$1/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/\$egid == \$1/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl##########################################################################
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#chmod 555 the .d file
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#Get the groupid of the calling process using ps
9512fe850e98fdd448c638ca63fdd92a8a510255ahlgroupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
9512fe850e98fdd448c638ca63fdd92a8a510255ahl print -u2 "unable to get uid of the current process with pid = $$"
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#Pass groupid as argument to .d file
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#Cleanup leftovers