/* */ virtcfg: CHECKIT=0 /* Change this to 0 if you want to enable REMOTE configuration by SUPERUSERS */ /* background color */ USECOLOR='2dd52f' /* ---------------- DO NOT MODIFY BELOW THIS LINE ------------------ */ parse arg ddir,tempfile,sel,list,verb,uri,user,basedir,workdir,privset,enmadd,transaction,verbose if verb="" then do say " This SRE-Filter add-on is NOT meant to be run from the command line." say " It can be invoked by using CONFIGUR.HTM " exit end /* Do */ list=translate(list, ' ', '+'||'090a0d'x) /* Whitespace, etc. */ who2=extract('CLIENTADDR') saddr2=extract('SERVERADDR') select when checkit=1 then do /* only if user = serveraddress !!! */ if who2<>saddr2 then do call lineout tempfile, '' call lineout tempfile, "
' call lineout tempfile,' ' call lineout tempfile 'FILE ERASE TYPE text/html NAME' tempfile return 'VIRTCFG: action not allowed remotely. ' end end otherwise do if wordpos('SUPERUSER',privset)=0 then do 'RESPONSE HTTP/1.0 401 Unauthorized ' /* Set HTTP response line */ 'header add WWW-Authenticate: Basic Realm=' /* challenge */ call lineout tempfile, '' call lineout tempfile, " Not authorized " call lineout tempfile, '' call lineout tempfile,' You do not have configuration rights.' if who2=saddr2 then call lineout tempfile,'
You may want to edit VIRTCFG.CMD ' call lineout tempfile,' ' call lineout tempfile iia=dosdir(tempfile,'s') 'FILE ERASE TYPE text/html NAME' tempfile return '401 'iia ' VIRTCFG: not permitted to configure. ' end end end list=strip(list) select when upper(list)='TODO=SHOW' | upper(list)='TODO=SHOW_HEADER' then signal doshow when upper(list)='TODO=SET' then signal doset otherwise signal dochange end /* select */ /* jump here to show values */ doshow: virtualfile=value(enmadd||'VIRTUAL_FILE',,'os2environment') call lineout tempfile, '' call lineout tempfile, "SRE-Filter: Virtual Directories " call lineout tempfile, '' aa=fileread(virtualfile,'lins',,'E') call lineout tempfile, "SRE-Filter: Virtual Directories
" if upper(list)='TODO=SHOW' then call lineout tempfile, "
List of "header" comments
" else call lineout tempfile, "Description of virtual directories
' /* view descriptive header only? */ if upper(list)='TODO=SHOW_HEADER' then do call lineout tempfile,'" /* show "header comments" */ iat=0 do until iat >= lins.0 iat=iat+1 if abbrev(strip(lins.iat),';') then do foo=strip(lins.iat) ;foo=strip(foo,'l',';') call lineout tempfile, foo end /* Do */ else do leave end end /* do -- iat is the first non header comment line */ call lineout tempfile, '
' call lineout tempfile 'file erase type text/html name ' tempfile return ' done ' end /* Do */ /* read in usernames, etc */ nusers=0 call lineout tempfile, '
List of virtual directories
' call lineout tempfile,' Notes:' call lineout tempfile,'
- Virtual directories are stored in: ' virtualfile call lineout tempfile,'
- Comments are in italics ' call lineout tempfile, '
- Entries with no host nickname apply to all requests ' call lineout tempfile, '
- Valid keywords for limitation list are: !CGI-BIN !UPLOAD !ADDONS !HTML
' call lineout tempfile,'' call lineout tempfile,'
Host Nickname ' call lineout tempfile,'Candidate SEL Fragment ' call lineout tempfile,'Fully qualified directory (or remote directory) ' call lineout tempfile,'Allow subdirectories
&limitation list
' do mm=iat to lins.0 if lins.mm=' ' then iterate if abbrev(strip(lins.mm),';') then do call lineout tempfile,' ' strip(strip(lins.mm),'l',';') '
' end else do if pos('// ',lins.mm)>0 then parse var lins.mm hostname '//' candurl targdir limlist else do hostname=' .. ' parse var lins.mm candurl targdir limlist end /* Do */ subdirok='NO' if right(strip(targdir),1)='*' then do targdir=delstr(targdir,length(targdir)) subdirok='YES' end call lineout tempfile,' 'hostname ' ' call lineout tempfile,'' candurl ' ' call lineout tempfile,''targdir ' ' call lineout tempfile,'' subdirok '
' call lineout tempfile,'' limlist '
' end /* do */ end call lineout tempfile,'
Thanks for checking