1*10898Sroland.mainz@nrubsig.org /***********************************************************************
2*10898Sroland.mainz@nrubsig.org *                                                                      *
3*10898Sroland.mainz@nrubsig.org *               This software is part of the ast package               *
4*10898Sroland.mainz@nrubsig.org *          Copyright (c) 1982-2009 AT&T Intellectual Property          *
5*10898Sroland.mainz@nrubsig.org *                      and is licensed under the                       *
6*10898Sroland.mainz@nrubsig.org *                  Common Public License, Version 1.0                  *
7*10898Sroland.mainz@nrubsig.org *                    by AT&T Intellectual Property                     *
8*10898Sroland.mainz@nrubsig.org *                                                                      *
9*10898Sroland.mainz@nrubsig.org *                A copy of the License is available at                 *
10*10898Sroland.mainz@nrubsig.org *            http://www.opensource.org/licenses/cpl1.0.txt             *
11*10898Sroland.mainz@nrubsig.org *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12*10898Sroland.mainz@nrubsig.org *                                                                      *
13*10898Sroland.mainz@nrubsig.org *              Information and Software Systems Research               *
14*10898Sroland.mainz@nrubsig.org *                            AT&T Research                             *
15*10898Sroland.mainz@nrubsig.org *                           Florham Park NJ                            *
16*10898Sroland.mainz@nrubsig.org *                                                                      *
17*10898Sroland.mainz@nrubsig.org *                  David Korn <dgk@research.att.com>                   *
18*10898Sroland.mainz@nrubsig.org *                                                                      *
19*10898Sroland.mainz@nrubsig.org ***********************************************************************/
20*10898Sroland.mainz@nrubsig.org #pragma prototyped
21*10898Sroland.mainz@nrubsig.org /*
22*10898Sroland.mainz@nrubsig.org  * regression test intercept control
23*10898Sroland.mainz@nrubsig.org  * enable with SHOPT_REGRESS==1 in Makefile
24*10898Sroland.mainz@nrubsig.org  * not for production use
25*10898Sroland.mainz@nrubsig.org  * see --man for details
26*10898Sroland.mainz@nrubsig.org  * all string constants inline here instead of in data/...
27*10898Sroland.mainz@nrubsig.org  *
28*10898Sroland.mainz@nrubsig.org  *   David Korn
29*10898Sroland.mainz@nrubsig.org  *   at&t research
30*10898Sroland.mainz@nrubsig.org  */
31*10898Sroland.mainz@nrubsig.org 
32*10898Sroland.mainz@nrubsig.org #include	"defs.h"
33*10898Sroland.mainz@nrubsig.org 
34*10898Sroland.mainz@nrubsig.org #if SHOPT_REGRESS
35*10898Sroland.mainz@nrubsig.org 
36*10898Sroland.mainz@nrubsig.org #include	<error.h>
37*10898Sroland.mainz@nrubsig.org #include	<ls.h>
38*10898Sroland.mainz@nrubsig.org #include	"io.h"
39*10898Sroland.mainz@nrubsig.org #include	"builtins.h"
40*10898Sroland.mainz@nrubsig.org #include	<tmx.h>
41*10898Sroland.mainz@nrubsig.org 
42*10898Sroland.mainz@nrubsig.org #define REGRESS_HEADER	"ksh:REGRESS:"
43*10898Sroland.mainz@nrubsig.org 
44*10898Sroland.mainz@nrubsig.org #define TRACE(r,i,f)		sh_regress(REGRESS_##r, i, sfprints f, __LINE__, __FILE__)
45*10898Sroland.mainz@nrubsig.org 
46*10898Sroland.mainz@nrubsig.org static const char	usage[] =
47*10898Sroland.mainz@nrubsig.org "[-1p0?\n@(#)$Id: __regress__ (AT&T Research) 2009-03-29 $\n]"
48*10898Sroland.mainz@nrubsig.org USAGE_LICENSE
49*10898Sroland.mainz@nrubsig.org "[+NAME?__regress__ - shell regression test intercept control]"
50*10898Sroland.mainz@nrubsig.org "[+DESCRIPTION?\b__regress__\b controls the regression test intercepts "
51*10898Sroland.mainz@nrubsig.org     "for shells compiled with SHOPT_REGRESS==1. Shells compiled this way are "
52*10898Sroland.mainz@nrubsig.org     "for testing only. In addition to \b__regress__\b and the \b--regress\b "
53*10898Sroland.mainz@nrubsig.org     "command line option, these shells may contain system library function "
54*10898Sroland.mainz@nrubsig.org     "intercepts that behave different from the native counterparts.]"
55*10898Sroland.mainz@nrubsig.org "[+?Each option controls a different test and possibly a different set "
56*10898Sroland.mainz@nrubsig.org     "of intercepts. The options are interpreted \bdd\b(1) style -- '-' or "
57*10898Sroland.mainz@nrubsig.org     "'--' prefix not required. This simplifies the specification of the "
58*10898Sroland.mainz@nrubsig.org     "command line \b--regress\b=\avalue\a option, where \avalue\a is passed "
59*10898Sroland.mainz@nrubsig.org     "as an option to the \b__regress__\b builtin. Typically regression test "
60*10898Sroland.mainz@nrubsig.org     "intercepts are enabled with one or more command line \b--regress\b "
61*10898Sroland.mainz@nrubsig.org     "options, with optional specific calls to \b__regress__\b in test "
62*10898Sroland.mainz@nrubsig.org     "scripts to enable/disable intercepts as the test progresses.]"
63*10898Sroland.mainz@nrubsig.org "[+?Each enabled intercept may result in trace lines of the form \b" REGRESS_HEADER
64*10898Sroland.mainz@nrubsig.org     "\aoption\a:\aintercept\a:\ainfo\a on the standard error, where "
65*10898Sroland.mainz@nrubsig.org     "\aoption\a is one of the options below, \aintercept\a is the name of "
66*10898Sroland.mainz@nrubsig.org     "the specific intercept for \aoption\a, and \ainfo\a is \aoption\a "
67*10898Sroland.mainz@nrubsig.org     "specific information. Unless noted otherwise, one regression test trace "
68*10898Sroland.mainz@nrubsig.org     "line is produced each time an enabled intercept is called.]"
69*10898Sroland.mainz@nrubsig.org "[101:egid?The intercept effective gid is set to \aoriginal-egid\a. The "
70*10898Sroland.mainz@nrubsig.org     "effective gid of the underlying system process is not affected. The "
71*10898Sroland.mainz@nrubsig.org     "trace line info is either \begid==rgid\b or \begid!=rgid\b. The "
72*10898Sroland.mainz@nrubsig.org     "intercepts are:]#?[original-egid:=1]"
73*10898Sroland.mainz@nrubsig.org     "{"
74*10898Sroland.mainz@nrubsig.org         "[+getegid()?The intercept effecive gid is returned. The "
75*10898Sroland.mainz@nrubsig.org             "\bsetgid\b() intercept may change this between the real gid and "
76*10898Sroland.mainz@nrubsig.org             "\aoriginal-egid\a.]"
77*10898Sroland.mainz@nrubsig.org         "[+setgid(gid)?Sets the intercept effective gid to \agid\a. "
78*10898Sroland.mainz@nrubsig.org             "Fails if \agid\a is neither the real gid nor "
79*10898Sroland.mainz@nrubsig.org             "\aoriginal-egid\a.]"
80*10898Sroland.mainz@nrubsig.org     "}"
81*10898Sroland.mainz@nrubsig.org "[102:euid?The intercept effective uid is set to \aoriginal-euid\a. The "
82*10898Sroland.mainz@nrubsig.org     "effective uid of the underlying system process is not affected. The "
83*10898Sroland.mainz@nrubsig.org     "trace line info is either \beuid==ruid\b or \beuid!=ruid\b. The "
84*10898Sroland.mainz@nrubsig.org     "intercepts are:]#?[original-euid:=1]"
85*10898Sroland.mainz@nrubsig.org     "{"
86*10898Sroland.mainz@nrubsig.org         "[+geteuid()?The intercept effecive uid is returned. The "
87*10898Sroland.mainz@nrubsig.org             "\bsetuid\b() intercept may change this between the real uid and "
88*10898Sroland.mainz@nrubsig.org             "\aoriginal-euid\a.]"
89*10898Sroland.mainz@nrubsig.org         "[+setuid(uid)?Sets the intercept effective uid to \auid\a. "
90*10898Sroland.mainz@nrubsig.org             "Fails if \auid\a is neither the real uid nor "
91*10898Sroland.mainz@nrubsig.org             "\aoriginal-euid\a.]"
92*10898Sroland.mainz@nrubsig.org     "}"
93*10898Sroland.mainz@nrubsig.org "[103:p_suid?Specifies a value for SHOPT_P_SUID. Effective uids greater "
94*10898Sroland.mainz@nrubsig.org     "than the non-privileged-uid disable the priveleged mode. The intercepts "
95*10898Sroland.mainz@nrubsig.org     "are:]#?[non-privileged-uid:=1]"
96*10898Sroland.mainz@nrubsig.org     "{"
97*10898Sroland.mainz@nrubsig.org         "[+SHOPT_P_SUID?The SHOPT_P_SUID macro value is overridden by "
98*10898Sroland.mainz@nrubsig.org             "\bp_suid\b. A trace line is output for each SHOPT_P_SUID "
99*10898Sroland.mainz@nrubsig.org             "access.]"
100*10898Sroland.mainz@nrubsig.org     "}"
101*10898Sroland.mainz@nrubsig.org "[104:source?The intercepts are:]"
102*10898Sroland.mainz@nrubsig.org     "{"
103*10898Sroland.mainz@nrubsig.org         "[+sh_source()?The trace line info is the path of the script "
104*10898Sroland.mainz@nrubsig.org             "being sourced. Used to trace shell startup scripts.]"
105*10898Sroland.mainz@nrubsig.org     "}"
106*10898Sroland.mainz@nrubsig.org "[105:etc?Map file paths matching \b/etc/\b* to \aetc-dir\a/*. The "
107*10898Sroland.mainz@nrubsig.org     "intercepts are:]:[etc-dir:=/etc]"
108*10898Sroland.mainz@nrubsig.org     "{"
109*10898Sroland.mainz@nrubsig.org         "[+sh_open()?Paths matching \b/etc/\b* are changed to "
110*10898Sroland.mainz@nrubsig.org             "\aetc-dir\a/*.]"
111*10898Sroland.mainz@nrubsig.org     "}"
112*10898Sroland.mainz@nrubsig.org "[+SEE ALSO?\bksh\b(1), \bregress\b(1), \brt\b(1)]"
113*10898Sroland.mainz@nrubsig.org ;
114*10898Sroland.mainz@nrubsig.org 
115*10898Sroland.mainz@nrubsig.org static const char*	regress_options[] =
116*10898Sroland.mainz@nrubsig.org {
117*10898Sroland.mainz@nrubsig.org 	"ERROR",
118*10898Sroland.mainz@nrubsig.org 	"egid",
119*10898Sroland.mainz@nrubsig.org 	"euid",
120*10898Sroland.mainz@nrubsig.org 	"p_suid",
121*10898Sroland.mainz@nrubsig.org 	"source",
122*10898Sroland.mainz@nrubsig.org 	"etc",
123*10898Sroland.mainz@nrubsig.org };
124*10898Sroland.mainz@nrubsig.org 
125*10898Sroland.mainz@nrubsig.org void sh_regress_init(Shell_t* shp)
126*10898Sroland.mainz@nrubsig.org {
127*10898Sroland.mainz@nrubsig.org 	static Regress_t	state;
128*10898Sroland.mainz@nrubsig.org 
129*10898Sroland.mainz@nrubsig.org 	shp->regress = &state;
130*10898Sroland.mainz@nrubsig.org }
131*10898Sroland.mainz@nrubsig.org 
132*10898Sroland.mainz@nrubsig.org /*
133*10898Sroland.mainz@nrubsig.org  * regress info trace output
134*10898Sroland.mainz@nrubsig.org  */
135*10898Sroland.mainz@nrubsig.org 
136*10898Sroland.mainz@nrubsig.org void sh_regress(unsigned int index, const char* intercept, const char* info, unsigned int line, const char* file)
137*10898Sroland.mainz@nrubsig.org {
138*10898Sroland.mainz@nrubsig.org 	char*	name;
139*10898Sroland.mainz@nrubsig.org 	char	buf[16];
140*10898Sroland.mainz@nrubsig.org 
141*10898Sroland.mainz@nrubsig.org 	if (index >= 1 && index <= elementsof(regress_options))
142*10898Sroland.mainz@nrubsig.org 		name = (char*)regress_options[index];
143*10898Sroland.mainz@nrubsig.org 	else
144*10898Sroland.mainz@nrubsig.org 		sfsprintf(name = buf, sizeof(buf), "%u", index);
145*10898Sroland.mainz@nrubsig.org 	sfprintf(sfstderr, REGRESS_HEADER "%s:%s:%s\n", name, intercept, fmtesc(info));
146*10898Sroland.mainz@nrubsig.org }
147*10898Sroland.mainz@nrubsig.org 
148*10898Sroland.mainz@nrubsig.org /*
149*10898Sroland.mainz@nrubsig.org  * egid intercepts
150*10898Sroland.mainz@nrubsig.org  */
151*10898Sroland.mainz@nrubsig.org 
152*10898Sroland.mainz@nrubsig.org static gid_t	intercept_sgid = 0;
153*10898Sroland.mainz@nrubsig.org static gid_t	intercept_egid = -1;
154*10898Sroland.mainz@nrubsig.org static gid_t	intercept_rgid = -1;
155*10898Sroland.mainz@nrubsig.org 
156*10898Sroland.mainz@nrubsig.org gid_t getegid(void)
157*10898Sroland.mainz@nrubsig.org {
158*10898Sroland.mainz@nrubsig.org 	if (intercept_rgid == -1)
159*10898Sroland.mainz@nrubsig.org 		intercept_rgid = getgid();
160*10898Sroland.mainz@nrubsig.org 	if (sh_isregress(REGRESS_egid))
161*10898Sroland.mainz@nrubsig.org 	{
162*10898Sroland.mainz@nrubsig.org 		TRACE(egid, "getegid", ("%s", intercept_egid == intercept_rgid ? "egid==rgid" : "egid!=rgid"));
163*10898Sroland.mainz@nrubsig.org 		return intercept_egid;
164*10898Sroland.mainz@nrubsig.org 	}
165*10898Sroland.mainz@nrubsig.org 	return intercept_rgid;
166*10898Sroland.mainz@nrubsig.org }
167*10898Sroland.mainz@nrubsig.org 
168*10898Sroland.mainz@nrubsig.org int setgid(gid_t gid)
169*10898Sroland.mainz@nrubsig.org {
170*10898Sroland.mainz@nrubsig.org 	if (intercept_rgid == -1)
171*10898Sroland.mainz@nrubsig.org 		intercept_rgid = getgid();
172*10898Sroland.mainz@nrubsig.org 	if (sh_isregress(REGRESS_egid))
173*10898Sroland.mainz@nrubsig.org 	{
174*10898Sroland.mainz@nrubsig.org 		if (gid != intercept_rgid && gid != intercept_sgid)
175*10898Sroland.mainz@nrubsig.org 		{
176*10898Sroland.mainz@nrubsig.org 			TRACE(egid, "setgid", ("%s", "EPERM"));
177*10898Sroland.mainz@nrubsig.org 			errno = EPERM;
178*10898Sroland.mainz@nrubsig.org 			return -1;
179*10898Sroland.mainz@nrubsig.org 		}
180*10898Sroland.mainz@nrubsig.org 		intercept_egid = gid;
181*10898Sroland.mainz@nrubsig.org 		TRACE(egid, "setgid", ("%s", intercept_egid == intercept_rgid ? "egid==rgid" : "egid!=rgid"));
182*10898Sroland.mainz@nrubsig.org 	}
183*10898Sroland.mainz@nrubsig.org 	else if (gid != intercept_rgid)
184*10898Sroland.mainz@nrubsig.org 	{
185*10898Sroland.mainz@nrubsig.org 		errno = EPERM;
186*10898Sroland.mainz@nrubsig.org 		return -1;
187*10898Sroland.mainz@nrubsig.org 	}
188*10898Sroland.mainz@nrubsig.org 	return 0;
189*10898Sroland.mainz@nrubsig.org }
190*10898Sroland.mainz@nrubsig.org 
191*10898Sroland.mainz@nrubsig.org /*
192*10898Sroland.mainz@nrubsig.org  * euid intercepts
193*10898Sroland.mainz@nrubsig.org  */
194*10898Sroland.mainz@nrubsig.org 
195*10898Sroland.mainz@nrubsig.org static uid_t	intercept_suid = 0;
196*10898Sroland.mainz@nrubsig.org static uid_t	intercept_euid = -1;
197*10898Sroland.mainz@nrubsig.org static uid_t	intercept_ruid = -1;
198*10898Sroland.mainz@nrubsig.org 
199*10898Sroland.mainz@nrubsig.org uid_t geteuid(void)
200*10898Sroland.mainz@nrubsig.org {
201*10898Sroland.mainz@nrubsig.org 	if (intercept_ruid == -1)
202*10898Sroland.mainz@nrubsig.org 		intercept_ruid = getuid();
203*10898Sroland.mainz@nrubsig.org 	if (sh_isregress(REGRESS_euid))
204*10898Sroland.mainz@nrubsig.org 	{
205*10898Sroland.mainz@nrubsig.org 		TRACE(euid, "geteuid", ("%s", intercept_euid == intercept_ruid ? "euid==ruid" : "euid!=ruid"));
206*10898Sroland.mainz@nrubsig.org 		return intercept_euid;
207*10898Sroland.mainz@nrubsig.org 	}
208*10898Sroland.mainz@nrubsig.org 	return intercept_ruid;
209*10898Sroland.mainz@nrubsig.org }
210*10898Sroland.mainz@nrubsig.org 
211*10898Sroland.mainz@nrubsig.org int setuid(uid_t uid)
212*10898Sroland.mainz@nrubsig.org {
213*10898Sroland.mainz@nrubsig.org 	if (intercept_ruid == -1)
214*10898Sroland.mainz@nrubsig.org 		intercept_ruid = getuid();
215*10898Sroland.mainz@nrubsig.org 	if (sh_isregress(REGRESS_euid))
216*10898Sroland.mainz@nrubsig.org 	{
217*10898Sroland.mainz@nrubsig.org 		if (uid != intercept_ruid && uid != intercept_suid)
218*10898Sroland.mainz@nrubsig.org 		{
219*10898Sroland.mainz@nrubsig.org 			TRACE(euid, "setuid", ("%s", "EPERM"));
220*10898Sroland.mainz@nrubsig.org 			errno = EPERM;
221*10898Sroland.mainz@nrubsig.org 			return -1;
222*10898Sroland.mainz@nrubsig.org 		}
223*10898Sroland.mainz@nrubsig.org 		intercept_euid = uid;
224*10898Sroland.mainz@nrubsig.org 		TRACE(euid, "setuid", ("%s", intercept_euid == intercept_ruid ? "euid==ruid" : "euid!=ruid"));
225*10898Sroland.mainz@nrubsig.org 	}
226*10898Sroland.mainz@nrubsig.org 	else if (uid != intercept_ruid)
227*10898Sroland.mainz@nrubsig.org 	{
228*10898Sroland.mainz@nrubsig.org 		errno = EPERM;
229*10898Sroland.mainz@nrubsig.org 		return -1;
230*10898Sroland.mainz@nrubsig.org 	}
231*10898Sroland.mainz@nrubsig.org 	return 0;
232*10898Sroland.mainz@nrubsig.org }
233*10898Sroland.mainz@nrubsig.org 
234*10898Sroland.mainz@nrubsig.org /*
235*10898Sroland.mainz@nrubsig.org  * p_suid intercept
236*10898Sroland.mainz@nrubsig.org  */
237*10898Sroland.mainz@nrubsig.org 
238*10898Sroland.mainz@nrubsig.org static uid_t	intercept_p_suid = 0x7fffffff;
239*10898Sroland.mainz@nrubsig.org 
240*10898Sroland.mainz@nrubsig.org uid_t sh_regress_p_suid(unsigned int line, const char* file)
241*10898Sroland.mainz@nrubsig.org {
242*10898Sroland.mainz@nrubsig.org 	REGRESS(p_suid, "SHOPT_P_SUID", ("%d", intercept_p_suid));
243*10898Sroland.mainz@nrubsig.org 	return intercept_p_suid;
244*10898Sroland.mainz@nrubsig.org }
245*10898Sroland.mainz@nrubsig.org 
246*10898Sroland.mainz@nrubsig.org /*
247*10898Sroland.mainz@nrubsig.org  * p_suid intercept
248*10898Sroland.mainz@nrubsig.org  */
249*10898Sroland.mainz@nrubsig.org 
250*10898Sroland.mainz@nrubsig.org static char*	intercept_etc = 0;
251*10898Sroland.mainz@nrubsig.org 
252*10898Sroland.mainz@nrubsig.org char* sh_regress_etc(const char* path, unsigned int line, const char* file)
253*10898Sroland.mainz@nrubsig.org {
254*10898Sroland.mainz@nrubsig.org 	REGRESS(etc, "sh_open", ("%s => %s%s", path, intercept_etc, path+4));
255*10898Sroland.mainz@nrubsig.org 	return intercept_etc;
256*10898Sroland.mainz@nrubsig.org }
257*10898Sroland.mainz@nrubsig.org 
258*10898Sroland.mainz@nrubsig.org /*
259*10898Sroland.mainz@nrubsig.org  * __regress__ builtin
260*10898Sroland.mainz@nrubsig.org  */
261*10898Sroland.mainz@nrubsig.org 
262*10898Sroland.mainz@nrubsig.org int b___regress__(int argc, char** argv, void *extra)
263*10898Sroland.mainz@nrubsig.org {
264*10898Sroland.mainz@nrubsig.org 	register Shell_t*	shp = ((Shbltin_t*)extra)->shp;
265*10898Sroland.mainz@nrubsig.org 	int			n;
266*10898Sroland.mainz@nrubsig.org 
267*10898Sroland.mainz@nrubsig.org 	for (;;)
268*10898Sroland.mainz@nrubsig.org 	{
269*10898Sroland.mainz@nrubsig.org 		switch (n = optget(argv, usage))
270*10898Sroland.mainz@nrubsig.org 		{
271*10898Sroland.mainz@nrubsig.org 		case '?':
272*10898Sroland.mainz@nrubsig.org 			errormsg(SH_DICT, ERROR_usage(2), "%s", opt_info.arg);
273*10898Sroland.mainz@nrubsig.org 			break;
274*10898Sroland.mainz@nrubsig.org 		case ':':
275*10898Sroland.mainz@nrubsig.org 			errormsg(SH_DICT, 2, "%s", opt_info.arg);
276*10898Sroland.mainz@nrubsig.org 			break;
277*10898Sroland.mainz@nrubsig.org 		case 0:
278*10898Sroland.mainz@nrubsig.org 			break;
279*10898Sroland.mainz@nrubsig.org 		default:
280*10898Sroland.mainz@nrubsig.org 			if (n < -100)
281*10898Sroland.mainz@nrubsig.org 			{
282*10898Sroland.mainz@nrubsig.org 				n = -(n + 100);
283*10898Sroland.mainz@nrubsig.org 				if (opt_info.arg || opt_info.number)
284*10898Sroland.mainz@nrubsig.org 					sh_onregress(n);
285*10898Sroland.mainz@nrubsig.org 				else
286*10898Sroland.mainz@nrubsig.org 					sh_offregress(n);
287*10898Sroland.mainz@nrubsig.org 				switch (n)
288*10898Sroland.mainz@nrubsig.org 				{
289*10898Sroland.mainz@nrubsig.org 				case REGRESS_egid:
290*10898Sroland.mainz@nrubsig.org 					if (sh_isregress(n))
291*10898Sroland.mainz@nrubsig.org 					{
292*10898Sroland.mainz@nrubsig.org 						intercept_egid = intercept_sgid = (gid_t)opt_info.number;
293*10898Sroland.mainz@nrubsig.org 						TRACE(egid, argv[0], ("%d", intercept_egid));
294*10898Sroland.mainz@nrubsig.org 					}
295*10898Sroland.mainz@nrubsig.org 					else
296*10898Sroland.mainz@nrubsig.org 						TRACE(egid, argv[0], ("%s", "off"));
297*10898Sroland.mainz@nrubsig.org 					break;
298*10898Sroland.mainz@nrubsig.org 				case REGRESS_euid:
299*10898Sroland.mainz@nrubsig.org 					if (sh_isregress(n))
300*10898Sroland.mainz@nrubsig.org 					{
301*10898Sroland.mainz@nrubsig.org 						intercept_euid = intercept_suid = (uid_t)opt_info.number;
302*10898Sroland.mainz@nrubsig.org 						TRACE(euid, argv[0], ("%d", intercept_euid));
303*10898Sroland.mainz@nrubsig.org 					}
304*10898Sroland.mainz@nrubsig.org 					else
305*10898Sroland.mainz@nrubsig.org 						TRACE(euid, argv[0], ("%s", "off"));
306*10898Sroland.mainz@nrubsig.org 					break;
307*10898Sroland.mainz@nrubsig.org 				case REGRESS_p_suid:
308*10898Sroland.mainz@nrubsig.org 					if (sh_isregress(n))
309*10898Sroland.mainz@nrubsig.org 					{
310*10898Sroland.mainz@nrubsig.org 						intercept_p_suid = (uid_t)opt_info.number;
311*10898Sroland.mainz@nrubsig.org 						TRACE(p_suid, argv[0], ("%d", intercept_p_suid));
312*10898Sroland.mainz@nrubsig.org 					}
313*10898Sroland.mainz@nrubsig.org 					else
314*10898Sroland.mainz@nrubsig.org 						TRACE(p_suid, argv[0], ("%s", "off"));
315*10898Sroland.mainz@nrubsig.org 					break;
316*10898Sroland.mainz@nrubsig.org 				case REGRESS_source:
317*10898Sroland.mainz@nrubsig.org 					TRACE(source, argv[0], ("%s", sh_isregress(n) ? "on" : "off"));
318*10898Sroland.mainz@nrubsig.org 					break;
319*10898Sroland.mainz@nrubsig.org 				case REGRESS_etc:
320*10898Sroland.mainz@nrubsig.org 					if (sh_isregress(n))
321*10898Sroland.mainz@nrubsig.org 					{
322*10898Sroland.mainz@nrubsig.org 						intercept_etc = opt_info.arg;
323*10898Sroland.mainz@nrubsig.org 						TRACE(etc, argv[0], ("%s", intercept_etc));
324*10898Sroland.mainz@nrubsig.org 					}
325*10898Sroland.mainz@nrubsig.org 					else
326*10898Sroland.mainz@nrubsig.org 						TRACE(etc, argv[0], ("%s", "off"));
327*10898Sroland.mainz@nrubsig.org 					break;
328*10898Sroland.mainz@nrubsig.org 				}
329*10898Sroland.mainz@nrubsig.org 			}
330*10898Sroland.mainz@nrubsig.org 			continue;
331*10898Sroland.mainz@nrubsig.org 		}
332*10898Sroland.mainz@nrubsig.org 		break;
333*10898Sroland.mainz@nrubsig.org 	}
334*10898Sroland.mainz@nrubsig.org 	if (error_info.errors || *(argv + opt_info.index))
335*10898Sroland.mainz@nrubsig.org 		errormsg(SH_DICT, ERROR_usage(2), "%s", optusage(NiL));
336*10898Sroland.mainz@nrubsig.org 	return 0;
337*10898Sroland.mainz@nrubsig.org }
338*10898Sroland.mainz@nrubsig.org 
339*10898Sroland.mainz@nrubsig.org #else
340*10898Sroland.mainz@nrubsig.org 
341*10898Sroland.mainz@nrubsig.org NoN(regress)
342*10898Sroland.mainz@nrubsig.org 
343*10898Sroland.mainz@nrubsig.org #endif
344