/* */ aliascfg: CHECKIT=0 /* Change this to 0 if you want to enable REMOTE configuration */ /* 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 'ALIASCFG: 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 USERCFG.CMD ' call lineout tempfile,' ' call lineout tempfile iia=dosdir(tempfile,'s') 'FILE ERASE TYPE text/html NAME' tempfile return '401 'iia' ALIASCFG: 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: aliasfile=value(enmadd||'ALIAS_FILE',,'os2environment') call lineout tempfile, '' call lineout tempfile, "SRE-Filter redirection aliases " call lineout tempfile, '' aa=go_fileread(aliasfile) /* expose lins */ /*aa=fileread(aliasfile,'lins',,'E') */ call lineout tempfile, "SRE-Filter: Redirection aliases
" if upper(list)="TODO=SHOW" then call lineout tempfile, "
List of "header" comments
" else call lineout tempfile, "Description of redirection aliaases
' /* 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 aliases, etc */ nusers=0 call lineout tempfile, 'List of redirection aliases
' call lineout tempfile,' Notes:' call lineout tempfile,'
- Aliases are stored in: ' aliasfile call lineout tempfile,'
- Comments are in italics ' call lineout tempfile,'
- The * character is used as a wildcard (for an arbitrarily long string)' call lineout tempfile, '
- Entries with no host nickname apply to all requests
' call lineout tempfile,'' call lineout tempfile,'
Host Nickname ' call lineout tempfile,'Candidate SEL (convert from) ' call lineout tempfile,'Target of redirection (convert to) ' 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 do parse var lins.mm hostname '//' candurl targurl end else do hostname=' .. ' parse var lins.mm candurl targurl end /* Do */ if length(targurl) > 55 then do iiat2=0 ; moocow='' ; ijoe=length(targurl) do while iiat2 <= length(targurl) iiat=iiat2+1 eek=substr(targurl,iiat,45) moocow=moocow||eek||'
' iiat2=iiat2+45 end targurl=moocow end call lineout tempfile,''hostname ' ' call lineout tempfile,'' candurl ' ' call lineout tempfile,''targurl ' ' end /* do */ end call lineout tempfile,'
Thanks for checking