1*2870Sdp# 2*2870Sdp# CDDL HEADER START 3*2870Sdp# 4*2870Sdp# The contents of this file are subject to the terms of the 5*2870Sdp# Common Development and Distribution License (the "License"). 6*2870Sdp# You may not use this file except in compliance with the License. 7*2870Sdp# 8*2870Sdp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*2870Sdp# or http://www.opensolaris.org/os/licensing. 10*2870Sdp# See the License for the specific language governing permissions 11*2870Sdp# and limitations under the License. 12*2870Sdp# 13*2870Sdp# When distributing Covered Code, include this CDDL HEADER in each 14*2870Sdp# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*2870Sdp# If applicable, add the following below this CDDL HEADER, with the 16*2870Sdp# fields enclosed by brackets "[]" replaced with your own identifying 17*2870Sdp# information: Portions Copyright [yyyy] [name of copyright owner] 18*2870Sdp# 19*2870Sdp# CDDL HEADER END 20*2870Sdp# 21*2870Sdp 22*2870Sdp# 23*2870Sdp# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24*2870Sdp# Use is subject to license terms. 25*2870Sdp# 26*2870Sdp#ident "%Z%%M% %I% %E% SMI" 27*2870Sdp 28*2870Sdp# 29*2870Sdp# Affirmative test of less privileged user operation. We do so by running 30*2870Sdp# this test case as root, then as a less privileged user. The output should 31*2870Sdp# be exactly the same. 32*2870Sdp# 33*2870Sdp 34*2870Sdpscript() 35*2870Sdp{ 36*2870Sdp cat <<"EOF" 37*2870Sdp 38*2870Sdp BEGIN { trace("trace\n"); } 39*2870Sdp BEGIN { printf("%s\n", "printf"); } 40*2870Sdp BEGIN { printf("strlen(\"strlen\") = %d\n", strlen("strlen")); } 41*2870Sdp BEGIN { x = alloca(10); 42*2870Sdp bcopy("alloca\n", x, 7); 43*2870Sdp trace(stringof(x)); } 44*2870Sdp 45*2870Sdp BEGIN { printf("index(\"index\", \"x\") = %d\n", 46*2870Sdp index("index", "x")); } 47*2870Sdp BEGIN { printf("strchr(\"strchr\", \'t\') = %s\n", 48*2870Sdp strchr("strchr", 't')); } 49*2870Sdp 50*2870Sdp BEGIN { printf("strtok(\"strtok\", \"t\") = %s\n", 51*2870Sdp strtok("strtok", "t")); } 52*2870Sdp BEGIN { printf("strtok(NULL, \"t\") = %s\n", 53*2870Sdp strtok(NULL, "t")); } 54*2870Sdp BEGIN { printf("strtok(NULL, \"t\") = %s\n", 55*2870Sdp strtok(NULL, "t")); } 56*2870Sdp BEGIN { printf("substr(\"substr\", 2, 2) = %s\n", 57*2870Sdp substr("substr", 2, 2)); } 58*2870Sdp BEGIN { trace(strjoin("str", "join\n")); } 59*2870Sdp BEGIN { trace(basename("dirname/basename")); trace("/"); } 60*2870Sdp BEGIN { trace(dirname("dirname/basename")); } 61*2870Sdp 62*2870Sdp BEGIN { exit(0); } 63*2870Sdp ERROR { exit(1); } 64*2870SdpEOF 65*2870Sdp} 66*2870Sdp 67*2870Sdpprivout=/tmp/$$.priv_output 68*2870Sdpunprivout=/tmp/$$.unpriv_output 69*2870Sdp 70*2870Sdpscript | /usr/sbin/dtrace -q -s /dev/stdin > $privout 71*2870Sdpppriv -s A=basic,dtrace_user $$ 72*2870Sdpscript | /usr/sbin/dtrace -q -s /dev/stdin > $unprivout 73*2870Sdp 74*2870Sdpdiff $privout $unprivout 75*2870Sdpres=$? 76*2870Sdp 77*2870Sdp/bin/rm -f $privout $unprivout 78*2870Sdp 79*2870Sdpexit $res 80