home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
srev13g.zip
/
PREFILTR.80
< prev
next >
Wrap
Text File
|
1998-04-12
|
3KB
|
88 lines
/*A pre filter for SRE-http.
This pre-filter implements support for the GOREMOTE server
remote control package of GoServe.
If PRE_FILTER=YES, then only SUPERUSERs will be allowed acces to
GoRemore. If PRE_FILTER=FIRST, then everyone is given access.
In this version, PREFILTR will check to see if the request is for
GORMxxx or GOREMOTE.HTM, or GOREMOTE/GORMxxx and GOREMOTE/GOREMOTE.HTM.
Thus, GOREMOTE must be installed either in the root of the data directory,
or in the GOREMOTE/ subdirectory of the data directory.
PREFILTR should return: status , message:
status=0: SRE-http should continue
status=1: some form of completion, SRE-http should end (perhaps after
recording request info)
The message will be saved as the PREFILTER_RESULT variable
*/
prefiltr:
parse arg source,request,sel,privs,servername,otherargs
call pmprintf_sref(' in prefilter 80 'source' 'request)
issent=completed()
if issent=1 then /* if cached request, nothing here to do.. */
return '1 , ok cached'
tsel=translate(sel)
if abbrev(tsel,'GOR')=0 & abbrev(tsel,'GOS')=0 then return '0 , ok' /* quick check */
/* see it this is GOREMOTE.HTM or GORM*.HTM, in either main or
GOREMOTE directory */
foo=translate(sel,' ','/\')
endword=word(foo,words(foo))
sel1=strip(tsel,,'/')
hi1=abbrev(sel1,"GOREMOTE")
hi2=abbrev(sel1,"GORM")
hi3=abbrev(sel1,"GOREMOTE/GORM")
hi4=abbrev(sel1,"GOREMOTE/GOREMOTE")
if hi1+hi2+hi3+hi4=0 then
return '0 , ok'
/* if here, it's a goremote command -- srehttp will not have to
do anything with this request (except record it). */
verb=word(request,1)
/* check privs? */
if privs<>" " then do
tp=translate(privs)
IF verb="GET" then do
if (wordpos("SUPERUSER",tp)+wordpos("INHOUSE",tp))=0 then do
foo=sref_response('unauth', 'you do not have sufficient privileges for '||endword,servername)
return '1, not allowed ' /* let sre-http record this .. */
END
end
if verb="POST" then do
if wordpos("SUPERUSER",tp)=0 then DO
foo=sref_response('unauth', 'you do not have sufficient privileges for '||endword,servername)
return '1, not allowed ' /* let sre-http record this .. */
END
end
end
sel=sref_replacestrg(sel,'GOREMOTE.HTM','GOREMOTE') /* a common error .. */
/* if here, goremote and sufficient privs -- do it ! */
if verb="GET" then do
say " GoRemote= " verb sel
foo=goremote(verb,sel)
end
else do
say " GOREMOTE= " verb endword
foo=goremote(verb,endword)
end
return ' 1 , did goremote '