AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
setSecurityManager (SecurityManager sm) yoix.system
 
Sets the interpreter's security manager to sm, and returns 1 on success and 0 otherwise. The security manager cannot be changed after it is set to something other than NULL.

Functions defined as the security checkers in sm must return non-zero if the operation they are protecting is allowed. Any other result, including no return value, means the operation will fail with a securitycheck error. Security checking functions are documented in the description of the Yoix SecurityManager.
 
 Example:   The program,
import yoix.stdio.*;
import yoix.string.*;
import yoix.system.*;

SecurityManager sm = {
    checkRead(name) {
        printf("checkRead: name=%s\n", name);
        return(startsWith(name, VM.tmpdir));
    }

    checkWrite(name) {
        printf("checkWrite: name=%s\n", name);
        return(startsWith(name, VM.tmpdir));
    }
};

setSecurityManager(sm);

fopen("/tmp/../usr/xxx", "r");       // easy way to cheat
fopen("xxx", "r");                   // gets a security check
tries to limit reads and writes to files in the official temp directory, but as you can see, this version is easy to cheat.
 
 Return:   int
 
 See Also:   setSecurityChecker, SecurityManager

 

Yoix is a registered trademark of AT&T Inc.