/* */ usercfg: CHECKIT=0 /* Change this to 0 if you want to enable REMOTE configuration by SUPERUSERS */ 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 'USERCFG: 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' USERCFG: 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: userfile=value(enmadd||'USER_FILE',,'os2environment') aa=fileread(userfile,'lins',,'E') call lineout tempfile, '' call lineout tempfile, "SRE-Filter: view users " call lineout tempfile, ' ' call lineout tempfile, "SRE-Filter: view users
" call lineout tempfile, "
List of "header" comments
' /* 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 users
' call lineout tempfile,'Notes:
- Usernames/passwords are stored in: 'userfile call lineout tempfile,'
- Comments are in italics ' call lineout tempfile,'
- A * in the username or password signifies that any entry is a match ' call lineout tempfile, '
- Entries with no host nickname apply to all requests
' call lineout tempfile,'' call lineout tempfile,'
Host Nickname ' call lineout tempfile,'Username ' call lineout tempfile,'Password ' call lineout tempfile,'Privileges list ' do mm=iat to lins.0 if lins.mm=' ' then iterate if abbrev(strip(lins.mm),';') | 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 '//' username password privs else do hostname=' .. ' parse var lins.mm username password privs end /* Do */ privs=strip(privs) call lineout tempfile,' 'hostname ' ' call lineout tempfile,''username ' ' call lineout tempfile,'' password ' ' call lineout tempfile,'' privs ' ' end /* do */ end call lineout tempfile,'
Thanks for checking