xref: /titanic_53/usr/src/cmd/bnu/uucheck.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #define UUCHECK
34*7c478bd9Sstevel@tonic-gate int Uerrors = 0;	/* error count */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /* This unusual include (#include "permission.c") is done because
37*7c478bd9Sstevel@tonic-gate  * uucheck wants to use the global static variable in permission.c
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #include "uucp.h"
41*7c478bd9Sstevel@tonic-gate #include "permission.c"
42*7c478bd9Sstevel@tonic-gate #include "sysfiles.h"
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate /* These are here because uucpdefs.c is not used, and
45*7c478bd9Sstevel@tonic-gate  * some routines are referenced (never called within uucheck execution)
46*7c478bd9Sstevel@tonic-gate  * and not included.
47*7c478bd9Sstevel@tonic-gate  */
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate #define USAGE	"[-v] [-xNUM]"
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate int Debug=0;
52*7c478bd9Sstevel@tonic-gate mkdirs(){}
53*7c478bd9Sstevel@tonic-gate canPath(){}
54*7c478bd9Sstevel@tonic-gate char RemSpool[] = SPOOL; /* this is a dummy for chkpth() -- never used here */
55*7c478bd9Sstevel@tonic-gate char *Spool = SPOOL;
56*7c478bd9Sstevel@tonic-gate char *Pubdir = PUBDIR;
57*7c478bd9Sstevel@tonic-gate char *Bnptr;
58*7c478bd9Sstevel@tonic-gate char	Progname[NAMESIZE];
59*7c478bd9Sstevel@tonic-gate /* used for READANY and READSOME macros */
60*7c478bd9Sstevel@tonic-gate struct stat __s_;
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate /* This is stuff for uucheck */
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate struct tab
65*7c478bd9Sstevel@tonic-gate    {
66*7c478bd9Sstevel@tonic-gate     char *name;
67*7c478bd9Sstevel@tonic-gate     char *value;
68*7c478bd9Sstevel@tonic-gate    } tab[] =
69*7c478bd9Sstevel@tonic-gate    {
70*7c478bd9Sstevel@tonic-gate #ifdef	CORRUPTDIR
71*7c478bd9Sstevel@tonic-gate     "CORRUPT",	CORRUPTDIR,
72*7c478bd9Sstevel@tonic-gate #endif
73*7c478bd9Sstevel@tonic-gate     "LOGUUCP",	LOGUUCP,
74*7c478bd9Sstevel@tonic-gate     "LOGUUX",	LOGUUX,
75*7c478bd9Sstevel@tonic-gate     "LOGUUXQT",	LOGUUXQT,
76*7c478bd9Sstevel@tonic-gate     "LOGCICO",	LOGCICO,
77*7c478bd9Sstevel@tonic-gate     "SEQDIR",	SEQDIR,
78*7c478bd9Sstevel@tonic-gate     "STATDIR",	STATDIR,
79*7c478bd9Sstevel@tonic-gate     "PERMISSIONS",	PERMISSIONS,
80*7c478bd9Sstevel@tonic-gate     "SYSTEMS",	SYSTEMS,
81*7c478bd9Sstevel@tonic-gate     "DEVICES",	DEVICES	,
82*7c478bd9Sstevel@tonic-gate     "DIALCODES",	DIALCODES,
83*7c478bd9Sstevel@tonic-gate     "DIALERS",	DIALERS,
84*7c478bd9Sstevel@tonic-gate #ifdef	USRSPOOLLOCKS
85*7c478bd9Sstevel@tonic-gate     "USRSPOOLLOCKS",	"/var/spool/locks",
86*7c478bd9Sstevel@tonic-gate #endif
87*7c478bd9Sstevel@tonic-gate #ifdef	NOSTRANGERS
88*7c478bd9Sstevel@tonic-gate     "NOSTRANGERS",	NOSTRANGERS,
89*7c478bd9Sstevel@tonic-gate #endif
90*7c478bd9Sstevel@tonic-gate     "LIMITS",	LIMITS, /* if not defined we'll stat NULL, it's not a bug */
91*7c478bd9Sstevel@tonic-gate     "XQTDIR",	XQTDIR,
92*7c478bd9Sstevel@tonic-gate     "WORKSPACE",	WORKSPACE,
93*7c478bd9Sstevel@tonic-gate     "admin directory",	ADMIN,
94*7c478bd9Sstevel@tonic-gate     NULL,
95*7c478bd9Sstevel@tonic-gate    };
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate extern char *nextarg();
98*7c478bd9Sstevel@tonic-gate int verbose = 0;	/* fsck-like verbosity */
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate main(argc, argv)
101*7c478bd9Sstevel@tonic-gate char *argv[];
102*7c478bd9Sstevel@tonic-gate {
103*7c478bd9Sstevel@tonic-gate     struct stat statbuf;
104*7c478bd9Sstevel@tonic-gate     struct tab *tabptr;
105*7c478bd9Sstevel@tonic-gate     int i;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate 	(void) strcpy(Progname, "uucheck");
108*7c478bd9Sstevel@tonic-gate 	while ((i = getopt(argc, argv, "vx:")) != EOF) {
109*7c478bd9Sstevel@tonic-gate 		switch(i){
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate 		case 'v':
112*7c478bd9Sstevel@tonic-gate 			verbose++;
113*7c478bd9Sstevel@tonic-gate 			break;
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate 		case 'x':
116*7c478bd9Sstevel@tonic-gate 			Debug = atoi(optarg);
117*7c478bd9Sstevel@tonic-gate 			if (Debug <= 0)
118*7c478bd9Sstevel@tonic-gate 				Debug = 1;
119*7c478bd9Sstevel@tonic-gate #ifdef SMALL
120*7c478bd9Sstevel@tonic-gate 			fprintf(stderr,
121*7c478bd9Sstevel@tonic-gate 			"WARNING: uucheck built with SMALL flag defined -- no debug info available\n");
122*7c478bd9Sstevel@tonic-gate #endif /* SMALL */
123*7c478bd9Sstevel@tonic-gate 			break;
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate 		default:
126*7c478bd9Sstevel@tonic-gate 			(void) fprintf(stderr, "\tusage: %s %s\n",
127*7c478bd9Sstevel@tonic-gate 			    Progname, USAGE);
128*7c478bd9Sstevel@tonic-gate 			exit(1);
129*7c478bd9Sstevel@tonic-gate 		}
130*7c478bd9Sstevel@tonic-gate 	}
131*7c478bd9Sstevel@tonic-gate 	if (argc != optind) {
132*7c478bd9Sstevel@tonic-gate 		(void) fprintf(stderr, "\tusage: %s %s\n", Progname, USAGE);
133*7c478bd9Sstevel@tonic-gate 		exit(1);
134*7c478bd9Sstevel@tonic-gate 	}
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate     if (verbose) printf("*** uucheck:  Check Required Files and Directories\n");
137*7c478bd9Sstevel@tonic-gate     for (tabptr = tab; tabptr->name != NULL; tabptr++) {
138*7c478bd9Sstevel@tonic-gate         if (stat(tabptr->value, &statbuf) < 0) {
139*7c478bd9Sstevel@tonic-gate 	    fprintf(stderr, "%s - ", tabptr->name);
140*7c478bd9Sstevel@tonic-gate 	    perror(tabptr->value);
141*7c478bd9Sstevel@tonic-gate 	    Uerrors++;
142*7c478bd9Sstevel@tonic-gate 	}
143*7c478bd9Sstevel@tonic-gate     }
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate     if (verbose) printf("*** uucheck:  Directories Check Complete\n\n");
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate     /* check the permissions file */
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate     if (verbose) printf("*** uucheck:  Check %s file\n", PERMISSIONS);
150*7c478bd9Sstevel@tonic-gate     Uerrors += checkPerm();
151*7c478bd9Sstevel@tonic-gate     if (verbose) printf("*** uucheck:  %s Check Complete\n\n", PERMISSIONS);
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate     exit(Uerrors);
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate 	/* NOTREACHED */
157*7c478bd9Sstevel@tonic-gate }
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate int
160*7c478bd9Sstevel@tonic-gate checkPerm ()
161*7c478bd9Sstevel@tonic-gate {
162*7c478bd9Sstevel@tonic-gate     int type;
163*7c478bd9Sstevel@tonic-gate     int error=0;
164*7c478bd9Sstevel@tonic-gate     char defaults[BUFSIZ];
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate     for (type=0; type<2; type++) {
167*7c478bd9Sstevel@tonic-gate 	/* type = 0 for LOGNAME, 1 for MACHINE */
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate 	if (verbose) printf("** %s \n\n",
170*7c478bd9Sstevel@tonic-gate 	    type == U_MACHINE
171*7c478bd9Sstevel@tonic-gate 		?"MACHINE PHASE (when we call or execute their uux requests)"
172*7c478bd9Sstevel@tonic-gate 		:"LOGNAME PHASE (when they call us)" );
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate 	Fp = fopen(PERMISSIONS, "r");
175*7c478bd9Sstevel@tonic-gate 	if (Fp == NULL) {
176*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("can't open %s\n", PERMISSIONS);
177*7c478bd9Sstevel@tonic-gate 		exit(1);
178*7c478bd9Sstevel@tonic-gate 	}
179*7c478bd9Sstevel@tonic-gate 
180*7c478bd9Sstevel@tonic-gate 	for (;;) {
181*7c478bd9Sstevel@tonic-gate 	    if (parse_tokens(_Flds, NULL) != 0) {
182*7c478bd9Sstevel@tonic-gate 		fclose(Fp);
183*7c478bd9Sstevel@tonic-gate 		break;
184*7c478bd9Sstevel@tonic-gate 	    }
185*7c478bd9Sstevel@tonic-gate 	    if (_Flds[type] == NULL)
186*7c478bd9Sstevel@tonic-gate 	        continue;
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate 	    /* XXX - need to reset defaults here */
189*7c478bd9Sstevel@tonic-gate 	    fillFlds();
190*7c478bd9Sstevel@tonic-gate 	    /* if no ReadPath set num to 1--Path already set */
191*7c478bd9Sstevel@tonic-gate 	    fillList(U_READPATH, _RPaths);
192*7c478bd9Sstevel@tonic-gate 	    fillList(U_WRITEPATH, _WPaths);
193*7c478bd9Sstevel@tonic-gate 	    fillList(U_NOREADPATH, _NoRPaths);
194*7c478bd9Sstevel@tonic-gate 	    fillList(U_NOWRITEPATH, _NoWPaths);
195*7c478bd9Sstevel@tonic-gate 	    if (_Flds[U_COMMANDS] == NULL) {
196*7c478bd9Sstevel@tonic-gate 		strcpy(defaults, DEFAULTCMDS);
197*7c478bd9Sstevel@tonic-gate 		_Flds[U_COMMANDS] = defaults;
198*7c478bd9Sstevel@tonic-gate 	    }
199*7c478bd9Sstevel@tonic-gate 	    fillList(U_COMMANDS, _Commands);
200*7c478bd9Sstevel@tonic-gate 	    error += outLine(type);
201*7c478bd9Sstevel@tonic-gate 	}
202*7c478bd9Sstevel@tonic-gate     if (verbose) printf("\n");
203*7c478bd9Sstevel@tonic-gate     }
204*7c478bd9Sstevel@tonic-gate     return(error);
205*7c478bd9Sstevel@tonic-gate }
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate int
208*7c478bd9Sstevel@tonic-gate outLine(type)
209*7c478bd9Sstevel@tonic-gate int type;
210*7c478bd9Sstevel@tonic-gate {
211*7c478bd9Sstevel@tonic-gate 	register int i;
212*7c478bd9Sstevel@tonic-gate 	register char *p;
213*7c478bd9Sstevel@tonic-gate 	char *arg, cmd[BUFSIZ];
214*7c478bd9Sstevel@tonic-gate 	int error = 0;
215*7c478bd9Sstevel@tonic-gate 	char myname[MAXBASENAME+1];
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate 	if (_Flds[type][0] == 0)
218*7c478bd9Sstevel@tonic-gate 	    return(0);
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate 	if (type == U_LOGNAME) { /* for LOGNAME */
221*7c478bd9Sstevel@tonic-gate 	    p = _Flds[U_LOGNAME];
222*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("When a system logs in as: ");
223*7c478bd9Sstevel@tonic-gate 	    while (*p != '\0') {
224*7c478bd9Sstevel@tonic-gate 		p = nextarg(p, &arg);
225*7c478bd9Sstevel@tonic-gate 		if (verbose) 	printf("(%s) ", arg);
226*7c478bd9Sstevel@tonic-gate 	    }
227*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\n");
228*7c478bd9Sstevel@tonic-gate 
229*7c478bd9Sstevel@tonic-gate 	    if (callBack()) {
230*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("\tWe will call them back.\n\n");
231*7c478bd9Sstevel@tonic-gate 		return(0);
232*7c478bd9Sstevel@tonic-gate 	    }
233*7c478bd9Sstevel@tonic-gate 	}
234*7c478bd9Sstevel@tonic-gate 	else {	/* MACHINE */
235*7c478bd9Sstevel@tonic-gate 	    p = _Flds[U_MACHINE];
236*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("When we call system(s): ");
237*7c478bd9Sstevel@tonic-gate 	    while (*p != '\0') {
238*7c478bd9Sstevel@tonic-gate 		p = nextarg(p, &arg);
239*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("(%s) ", arg);
240*7c478bd9Sstevel@tonic-gate 	    }
241*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\n");
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate 	}
244*7c478bd9Sstevel@tonic-gate 
245*7c478bd9Sstevel@tonic-gate 	if (verbose) printf("\tWe %s allow them to request files.\n",
246*7c478bd9Sstevel@tonic-gate 	    requestOK()? "DO" : "DO NOT");
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate 	if (type == U_LOGNAME) {
249*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("\tWe %s send files queued for them on this call.\n",
250*7c478bd9Sstevel@tonic-gate 		    switchRole()? "WILL" : "WILL NOT");
251*7c478bd9Sstevel@tonic-gate 	}
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate 	if (verbose) printf("\tThey can send files to\n");
254*7c478bd9Sstevel@tonic-gate 	if (_Flds[U_WRITEPATH] == NULL) {
255*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\t    %s (DEFAULT)\n", Pubdir);
256*7c478bd9Sstevel@tonic-gate 	}
257*7c478bd9Sstevel@tonic-gate 	else {
258*7c478bd9Sstevel@tonic-gate 	    for (i=0; _WPaths[i] != NULL; i++)
259*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("\t    %s\n", _WPaths[i]);
260*7c478bd9Sstevel@tonic-gate 	}
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate 	if (_Flds[U_NOWRITEPATH] != NULL) {
263*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\tExcept\n");
264*7c478bd9Sstevel@tonic-gate 	    for (i=0; _NoWPaths[i] != NULL; i++)
265*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("\t    %s\n", _NoWPaths[i]);
266*7c478bd9Sstevel@tonic-gate 	}
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate 	if (verbose) {
269*7c478bd9Sstevel@tonic-gate 	    if (noSpool())
270*7c478bd9Sstevel@tonic-gate 		(void) printf("\tSent files will be created directly in the target directory.\n");
271*7c478bd9Sstevel@tonic-gate 	    else {
272*7c478bd9Sstevel@tonic-gate 		(void) printf("\tSent files will be created in %s\n", SPOOL);
273*7c478bd9Sstevel@tonic-gate 		(void) printf("\t before they are copied to the target directory.\n");
274*7c478bd9Sstevel@tonic-gate 	    }
275*7c478bd9Sstevel@tonic-gate 	}
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate 	if (requestOK()) {
278*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\tThey can request files from\n");
279*7c478bd9Sstevel@tonic-gate 	    if (_Flds[U_READPATH] == NULL) {
280*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("\t    %s (DEFAULT)\n", Pubdir);
281*7c478bd9Sstevel@tonic-gate 	    }
282*7c478bd9Sstevel@tonic-gate 	    else {
283*7c478bd9Sstevel@tonic-gate 		for (i=0; _RPaths[i] != NULL; i++)
284*7c478bd9Sstevel@tonic-gate 		    if (verbose) printf("\t    %s\n", _RPaths[i]);
285*7c478bd9Sstevel@tonic-gate 	    }
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate 	    if (_Flds[U_NOREADPATH] != NULL) {
288*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("\tExcept\n");
289*7c478bd9Sstevel@tonic-gate 		for (i=0; _NoRPaths[i] != NULL; i++)
290*7c478bd9Sstevel@tonic-gate 		    if (verbose) printf("\t    %s\n", _NoRPaths[i]);
291*7c478bd9Sstevel@tonic-gate 	    }
292*7c478bd9Sstevel@tonic-gate 	}
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate 	myName(myname);
295*7c478bd9Sstevel@tonic-gate 	if (verbose) printf("\tMyname for the conversation will be %s.\n",
296*7c478bd9Sstevel@tonic-gate 	    myname);
297*7c478bd9Sstevel@tonic-gate 	if (verbose) printf("\tPUBDIR for the conversation will be %s.\n",
298*7c478bd9Sstevel@tonic-gate 	    Pubdir);
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate 	if (verbose) printf("\n");
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate 	if (type == U_MACHINE) {
303*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("Machine(s): ");
304*7c478bd9Sstevel@tonic-gate 	    p = _Flds[U_MACHINE];
305*7c478bd9Sstevel@tonic-gate 	    while (*p != '\0') {
306*7c478bd9Sstevel@tonic-gate 		p = nextarg(p, &arg);
307*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("(%s) ", arg);
308*7c478bd9Sstevel@tonic-gate 	    }
309*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\nCAN execute the following commands:\n");
310*7c478bd9Sstevel@tonic-gate 	    for (i=0; _Commands[i] != NULL; i++) {
311*7c478bd9Sstevel@tonic-gate 		if (cmdOK(BASENAME(_Commands[i], '/'), cmd) == FALSE) {
312*7c478bd9Sstevel@tonic-gate 		    if (verbose) printf("Software Error in permission.c\n");
313*7c478bd9Sstevel@tonic-gate 		    error++;
314*7c478bd9Sstevel@tonic-gate 		}
315*7c478bd9Sstevel@tonic-gate 		if (verbose) printf("command (%s), fullname (%s)\n",
316*7c478bd9Sstevel@tonic-gate 		    BASENAME(_Commands[i], '/'), cmd);
317*7c478bd9Sstevel@tonic-gate 	    }
318*7c478bd9Sstevel@tonic-gate 	    if (verbose) printf("\n");
319*7c478bd9Sstevel@tonic-gate 	}
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate 	return(error);
322*7c478bd9Sstevel@tonic-gate }
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate void
325*7c478bd9Sstevel@tonic-gate cleanup(s)
326*7c478bd9Sstevel@tonic-gate 	int s;
327*7c478bd9Sstevel@tonic-gate {
328*7c478bd9Sstevel@tonic-gate 	exit(s);
329*7c478bd9Sstevel@tonic-gate }
330