home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Spezial
/
SPEZIAL2_97.zip
/
SPEZIAL2_97.iso
/
ANWEND
/
ONLINE
/
SREFPRC1
/
SPECIAL.SRF
< prev
next >
Wrap
Text File
|
1997-03-02
|
4KB
|
124 lines
/*-----------------------------------------------*/
/* Do special requests: return 0 if okay, 1 if bad */
/*-----------------------------------------------*/
sref_special_request:
parse arg sel0,privset,the_realm,os2e,enmadd,tempfile
parse var sel0 sel '?' args /* there may be some arguments */
sel=translate(sel)
amessage="Special request processed: "||sel0
select
when sel='!PING' then do
'STRING Ping!'
return amessage
end
when sel='!STATISTICS' then do
'CONTROL STATISTICS'
return amessage
end
when left(sel,5)='!HOST' then do
if args<> " " then sel="!HOST?"||args
foo=rxqueue('s','session')
sel=translate(sel,' ','?+&')
sel=word(sel,2)
sref_host(sel) /* a ping */
return amessage
end
when sel="!SAVE" | sel="!RESET" | abbrev(sel,"!VARIABLE")=1 ,
| sel='!WRITE_CACHE' then do
/* see if have proper privs. If not, reask username (so, only return if valid */
a=check_privs2(privset,'SUPERUSER CONTROL',1,the_realm)
select
when sel='!SAVE' then do
'CONTROL MOVEAUDIT'
return amessage
end
when sel='!RESET' then do
foo=value('SREF_REDO',1,'os2environment')
if abbrev(upper(args),"PARAM")=0 then 'CONTROL RESET ALL'
return amessage
end
when abbrev(sel,'!VARIABLE')=1 then do
dog=show_env_vars(args) /* call as routine-- needs globals */
dog
return amessage
end
when sel='!WRITE_CACHE' then do
'STRING The caches for the RECORD_ALL_FILE, and common-log file, have been written to disk'
return amessage
end
otherwise do
amessage='Unknown special request:'||sel0
return amessage
end
end
end
otherwise do
amessage='Unknown special request:'||sel0
return amessage
end
end /*select */
/* ----------------------------------------------------------------------- */
/* SHOWVARS: Show values of listed variables (extract from environment) */
/* ----------------------------------------------------------------------- */
show_env_vars:procedure expose enmadd os2e tempfile
parse arg alist
call lineout tempfile, '<!doctype html public "-//IETF//DTD HTML 2.0//EN">'
call lineout tempfile, "<html><head><title> SRE-FILTER variables </title>"
call lineout tempfile, "</head>"
call lineout tempfile, "<body><h2>Values of selected environment variables</h2>"
call lineout tempfile,' <pre>'
do forever
parse var alist repargn '&' alist
if pos('=',repargn)>0 then parse var repargn . '=' repargn
putme=value(enmadd||repargn,,os2e)
if putme=" " then putme='n.a.'
putme=sref_replacestrg(putme,'<','<','ALL')
putme=sref_replacestrg(putme,'>','>','ALL')
call lineout tempfile, repargn ' = ' putme
if alist="" then leave
end
call lineout tempfile,' </pre>'
call lineout tempfile, ' </body> </html> '
call lineout tempfile
return ' FILE ERASE TYPE text/html NAME ' tempfile
/*--------------------------------------------------*/
/* check user privileges (privset) against a url specific privilege list (aprivs)
if one of them matches, return >0 value
if no match, and reask=1, the query client for new username,etc.*/
/* ----------------------------------------------- */
check_privs2: procedure
parse upper arg privset , aprivs , reask , the_realm
select
when wordpos('NO',aprivs)>0 then do
return 0
end
when aprivs="" | wordpos('*',aprivs)>0 | wordpos('YES',aprivs)>0 then do
return 1
end
otherwise do
do mm=1 to words(aprivs)
if wordpos(word(aprivs,mm),privset)>0 then do
return mm
end
end
end
end /* select */
/* if here, failure , so signal caller to ask authorization */
exit -1