[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]


     [nocol-users] mod to genweb.pl to improve access control

As distributed, NOCOL 2.4.beta1 doesn't let me use my webserver's
.htaccess mechanism to control access to Nocol's web pages whist allowing
un-authenticated access to the User.html page. Thus I have to allow free
access to all the Nocol pages and use webnocol.cgi's authentication
mechanism, requiring authentication separate from that already available
from .htaccess. As nocol pages are just part of our web-based
information much of which requires authentication via .htaccess this
separate authentication is tedious and clumsy so I've been trying to find
a way around it.

There are a few problems: 
 1. User.html gets generated in the same directory as the other .html
files, so .htaccess applies to all pages. 
	Solution: symlink from some publically-accessible page (say
pub/Nocol.html) to nocol/User.html

 2. however this only works when the pub/Nocol.html page is first
displayed: after a minute it refreshes and tries to access nocol/User.html
page and falls foul of the .htaccess mechanism.
	Solution: in genweb.pl, in sub print_html_prologue (somewhere
around line 320) remove the URL i.e. 
	<META HTTP-EQUIV="REFRESH" CONTENT="$refresh;URL=$thispage"> 
becomes <META HTTP-EQUIV="REFRESH" CONTENT="$refresh">

 3. this still leaves the image .gifs broken. In the distribution it is
assumed that the gifs directory wil be a subdirectory of the nocol web
directory, but if the nocol directory is .htaccess protected this makes
the gifs directory protected also, which it need not be. I moved my
directory to the same level as the nocol directory, so in my web tree I
 	nocol/ 	(containing Critical.html, webnocol.cgi etc)
	pix/	(nocol .gif images - could have others also)
	pub/	(contains Nocol.html symlink -> nocol/User.html)

and in genweb.pl, somewhere around line 94, I changed:
local ($imageurl) = "${baseurl}pix/";  # check. Note baseurl has trailing /
local ($imageurl) = "../pix/";

There may be a more elegant way (I wondered about setting $baseurl to a
relative path but that didn't work...) but this works.

merry xmas!

John Stumbles                                      j.d.stumbles@reading.ac.uk
I.T. Services (Centre), University of Reading  http://www.rdg.ac.uk/~suqstmbl 
       If a job's worth doing, it'll still be worth doing tomorrow.