Whenever I have some free time I try to work on an update of my book "Introduction to Rexx and
ooRexx", which I wrote more than thirteen years ago to bring it up to ooRexx 5.2.0.
At the moment I am working on a new section about the ooRexx "Security Manager", explaining the
security manager protocol and how to use it. This is a very nifty and very useful feature in ooRexx.
The agent.rex example in rexxref.pdf (Example 13.1. Agent Program) in the section "Chapter 13. The
Security Manager" employs a "::requires json.cls" directive, which should be reported with the
"REQUIRES" message to the currently active security manager. This is not the case, which is a
serious bug. Cf. <https://sourceforge.net/p/oorexx/bugs/1422/> or
<https://sourceforge.net/p/oorexx/bugs/1886/>.
Attached there are three files:
* launcher.orx: accepts the name of a program to supervise; demonstrates how a
running package can
have a security manager assigned to it
* myProgram1staticRequires.orx: this is basically the "agent.rex" program from
rexxref.pdf which
employs a static requires ("::requires json.cls"), which ooRexx does not
report to the security
manager
* myProgram1dynamicRequires.orx: this agent.rex variant employs a dynamic
requires in which case
the REQUIRES messages get sent (two actually, the first with the unqualified
name, the second
with the fully qualified name)
To run:
launcher.orx myProgram1staticRequires.orx
launcher.orx myProgram1dynamicRequires.orx
The static version does not report REQUIRES messages, the dynamic version does. The normal case in
ooRexx programs are static requires.
The question is whether this serious bug can and will be fixed in a timely manner, such that I can
point out in the book, that maybe future versions of ooRexx would have the appropriate fix? (The
book is slated for late September, early October of this year.)
Any comments? Maybe ideas about possible fixes that could be sought? Or: what should I write in my
book about ooRexx' security manager?
---rony
P.S.: The documentation of the security methods in the security manager section "Chapter 13. The
Security Manager" of rexxref.pdf is wrong, as the return values got mixed up (.true and .false
reversed) which is quite irritating, will open a documentation bug for it.
parse arg fn .
if fn="" then
do
say "you must supply a file name!"
exit -1
end
-- have this package/program supervise from now on with an auditor security manager
.context~package~setSecurityManager(.auditor~new)
-- this will already be reported (environment symbol)
say "line #" .line": accessing environment"
say "supervising" pp(fn)
code=.file~readlines(fn) -- read code into array
do counter c1 secManObj over .auditor~new, .nil
say "="~copies(79)
if secManObj~isNil then leave
say c1"." secManObj
do counter c2 clz over .routine, .nil -- , .method, .package
if clz~isNil then leave
name="test"clz~id
r=clz~new(name, code) -- create object
say " " c2"." name": ---> about to set the security manager"
r~setSecurityManager(secManObj)
say " " c2"." name": about to call ..."
r~call
say "---"
say
end
say "="~copies(79)
say
end
/* ------------------------------------------------------------- */
::class auditor public -- report a supervise action
::method unknown
use arg methName, methArgs
say self": received security message:" pp(methName) -
"entries in argument:" ppArgs(methArgs[1])
return .false -- indicate we did not handle this
/* ------------------------------------------------------------- */
::routine ppArgs -- pretty print arguments
use arg dir
mb=.mutableBuffer~new
do counter c idx over dir~allIndexes~sort
mb~append((c>1)~?(', ','') , '"', idx, '"="', dir[idx]~string, '"')
end
return mb~string
/* ------------------------------------------------------------- */
::routine pp public
return "["arg(1)"]"
/* myProgram.rex: to be supervised */
/* Agent */
"echo Hello There"
call rxfuncadd "rxcalcsqrt", "rxmath", "rxcalcsqrt"
say result
say syssleep(1)
say linein("./profile")
say .methods
say "*** dynamically requiring json.cls ..."
.context~package~addPackage(.package~new("json.cls"))
.json~define("")
say "line #" .line":" .context~name
/* myProgram.rex: to be supervised */
/* Agent */
"echo Hello There"
call rxfuncadd "rxcalcsqrt", "rxmath", "rxcalcsqrt"
say result
say syssleep(1)
say linein("./profile")
say .methods
.json~define("")
say "line #" .line":" .context~name
::requires json.cls
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel