home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!think.com!paperboy.osf.org!rsalz
- From: rsalz@osf.org (Rich Salz)
- Subject: Re: How difficult is a restricted tcl shell ?
- Message-ID: <1993Jan22.205327.3323@osf.org>
- Keywords: shell user supervisor interpreter
- Sender: news@osf.org (USENET News System)
- Organization: Open Software Foundation
- References: <brucet.727682251@extro.ucc.su.OZ.AU>
- Date: Fri, 22 Jan 1993 20:53:27 GMT
- Lines: 24
-
- I have another idea. Allow a programmer to attach an 'authorization'
- function to an interpreter. Something like this:
- /* A TCL "authorization" function. Return 1 if command can be
- * executed. */
- typedef int (*Tcl_Authorize)(
- ClientData *clientdata,
- Tcl_Interp *interp,
- int argc,
- char *argv[]
- );
-
- And these commands:
- Tcl_Authorize Tcl_GetAuthorize(Tcl_Interp *interp);
- void Tcl_SetAuthorize(Tcl_Interp *interp, Tcl_Authorize authfunc);
- Then you could do things like
- authfunc(ClientData *clientdata, Tcl_Interp *interp, int argc, char *argv)
- {
- if (strcmp(argv[0], "open") == 0)
- /* validate pathnames */
- return validpath(argv[1]) ? 1 : 0;
- if (strcmp(argv[0], "exec") == 0)
- ...
- return 1;
- }
-