0
or 1
to the language processor. A value of 0
indicates that the program is authorized to perform the indicated action. In this case, processing continues as usual. A value of 1
indicates that the security manager performed the action itself. The security manager sets entries in the information directory to pass results for the action back to the language processor. The security manager can also use the RAISE instruction to raise a program error for a prohibited access. Error message 98.948 indicates authorization failures.
1
, indicating that it handled the external call, the security manager places the function result in the information directory as the entry RESULT.
1
, indicating that it handled the command, the security manager uses the following information directory entries to return the command results:
0
is used.
1
, indicating that it handled the request, the entry NAME in the information directory is replaced with the name of the actual file to load for the request. The REQUIRES method can also provide a security manager to be used for the program loaded by the ::REQUIRES directive by setting the information direction entry SECURITYMANAGER into the desired security manager object.
1
, indicating that it handled the request, the information directory entry RESULT contains the directory entry. When RESULT is not set and the method returns 1
, this is the same as a failure to find an entry in the .LOCAL directory. Rexx continues with the next step in the name resolution.
1
, indicating that it handled the request, the information directory entry RESULT contains the directory entry. When RESULT is not set and the method returns 1
, this is the same as a failure to find an entry in the .ENVIRONMENT directory. Rexx continues with the next step in the name resolution.
1
, the information directory STREAM must be set to an object to be used as the stream target. This should be a stream object or another object that supports the Stream class methods.
1
, indicating that it handled the external call, the function result can be placed in the information directory as the method RESULT.
Example 13.1. Agent Program
/* Agent */ interpret "echo Hello There" "dir foo.bar" call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs say result say syssleep(1) say linein("c:\profile") say .array .object~setmethod("SETMETHOD") ::requires agent2.cmd
Example 13.2. Example of Server Implementing Security Manager
/* Server implements security manager */ parse arg program method = .method~newfile(program) say "Calling program" program "with an audit manager:" pull method~setSecurityManager(.dumper~new(.output)) .go~new~~run(method) say "Calling program" program "with a function replacement execution environment:" pull method~setSecurityManager(.replacer~new) .go~new~~run(method) say "Calling program" program "with a closed cell manager:" pull signal on syntax method~setSecurityManager(.noWay~new) .go~new~~run(method) exit syntax: say "Agent program terminated with an authorization failure" exit ::class go subclass object ::method run -- this is a NON-PRIVATE method! use arg m self~run:super(m) -- a PRIVATE method is called here! ::class dumper ::method init expose stream /* target stream for output */ use arg stream /* hook up the output stream */ ::method unknown /* generic unknown method */ expose stream /* need the global stream */ use arg name, args /* get the message and arguments */ /* write out the audit event */ stream~lineout(time() date() "Called for event" name) stream~lineout("Arguments are:") /* write out the arguments */ info = args[1] /* info directory is the first arg */ do name over info /* dump the info directory */ stream~lineout("Item" name":" info[name]) end return 0 /* allow this to proceed */ ::class noWay ::method unknown /* everything trapped by unknown */ /* and everything is an error */ raise syntax 98.948 array("You didn't say the magic word!") ::class replacer subclass noWay /* inherit restrictive UNKNOWN method*/ ::method command /* issuing commands */ use arg info /* access the directory */ info~rc = 1234 /* set the command return code */ info~failure = .true /* raise a FAILURE condition */ return 1 /* return "handled" return value */ ::method call /* external function/routine call */ use arg info /* access the directory */ /* all results are the same */ info~setentry("RESULT","uh, uh, uh...you didn't say the magic word") return 1 /* return "handled" return value */ ::method stream /* I/O function stream lookup */ use arg info /* access the directory */ /* replace with a different stream */ info~stream = .stream~new("c:\sample.txt") return 1 /* return "handled" return value */ ::method local /* .LOCAL variable lookup */ /* no value returned at all */ return 1 /* return "handled" return value */ ::method environment /* .ENVIRONMENT variable lookup */ /* no value returned at all */ return 1 /* return "handled" return value */ ::method method /* protected method invocation */ use arg info /* access the directory */ /* all results are the same */ info~setentry("RESULT","uh, uh, uh...you didn't say the magic word") return 1 /* return "handled" return value */ ::method requires /* REQUIRES directive */ use arg info /* access the directory */ /* switch to load a different file */ info~name = "c:\samples\agent.cmd" info~securitymanager = self /* load under this authority */ return 1 /* return "handled" return value */