[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [despammed] Re: [Sheflug] Redirecting to a index page depending on group membership on Apache 1.3
On Tuesday, August 26, 2003 8:11 PM [GMT+0100=CET],
Chris J <cej [at] nightwolf.org.uk> wrote:
> I can't see anything obvious in the apache docs; what you'll probably
> need is a short CGI script that does something like (this /will/ need
> some work as it isn't perfect, and you'd probably be safer writing it
> in perl/C++ or similar as shell really isn't ideal for CGI from a
> security viewpoint):
>
<snip script>
As Chris said, but here's a Perl script that should do the trick in place of
his shell script.
Not tested, but something like this *should* work...
Obviously you'll need to fill in the blanks - which are all in capitals to
stand out...
----- CUT -----
#!/usr/bin/perl -w
setpwent();
my $finished=1;
while ($finished)
{
@user = getpwent();
if ( [at] user == () )
{
USER_NOT_FOUND;
$finished = 0;
}
else
{
if ($user[0] eq USERNAME_TO_CHECK)
{
if ($user[3] == STAFF_GID)
{
print "Location: STAFF_REDIRECT";
$finished=0;
}
if ($user[3] == STUDENT_GID)
{
print "Location: STUDENT_REDIRECT";
$finished=0;
}
etc...
}
}
}
endpwent();
----- CUT -----
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.