/* */ htaccfg: 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, , servername,host_nickname,homedir if verb=" " then do say " This SRE-Filter procedure is NOT meant to be run from the command line." exit end /* Do */ list=translate(list, ' ', '+'||'090a0d'x) /* Whitespace, etc. */ /* write results (2nd call */ if pos('WRITETO=',translate(list))>0 then do call writeres return ' Results written ' end 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 'HTACCFG: 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 HTACCFG.CMD ' call lineout tempfile,' ' call lineout tempfile iia=dosdir(tempfile,'s') 'FILE ERASE TYPE text/html NAME' tempfile return '401 'iia' HTACCFG: not permitted to configure. ' end end end htfile=' ' ;htacc=' ' list=strip(list) DO UNTIL LIST="" PARSE VAR list a1 '&' list parse var a1 avar '=' aval if translate(avar)='HTFILE' then do htfile=strip(translate(translate(packur(aval),'\','/'))) htfile=strip(htfile,'t','\')||'\' end if translate(avar)='ACCFILE' then htacc=strip(translate(translate(packur(aval),'\','/'))) end /* do */ if left(htfile,1)='\' | pos(':',htfile)>0 then nop else htfile=translate(ddir||htfile,'\','/') if htacc=' ' then htacc=get_value('htaccess_file') if filespec('p',htfile)='\' then do call lineout tempfile,'' HTFILE ' not permitted
' call lineout tempfile,' Sorry, HTACCESS file can not be in the root' call lineout tempfile, '