Search squid archive

Re: Authentication Hack

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

 



Uhm, try:

#!/usr/bin/perl -w

use strict; # (because you should!)

$| = 1;

while (<>) {
	chomp;
	my ($ip) = $_;
	# XXX should verify IP is an IP and not something nasty!
	...
}

The question then is how to query a cgi from a helper. I'd try the LWP stuff
in Perl to talk to a cgi-bin ; what you've doen there is try to read a file,
not call a cgi-bin. :)



Adrian

On Wed, Mar 05, 2008, Dave Coventry wrote:
> Thanks, Mick.
> 
> On Wed, Mar 5, 2008 at 12:08 PM, Michael Graham wrote:
> >  (Sorry Dave I keep hitting reply and not reply to list)
> Yes, I keep doing that :)
> 
> >  External helps are not supposed to exit once they have completed a
> >  request.  Your perl script should read from stdin then write OK/ERR then
> >  wait for more input.
> Ah!
> 
> So this should work?
> 
>  1:#!/usr/bin/perl
>  2:while(1){
>  3:  $| = 1;
>  4:  $ip=<STDIN>;
>  5:  $ip=chomp($ip);
>  6:  $ipfile='/var/www/apache2-default/cgi-bin/ips/'.$ip;
>  7:  #print $ipfile;
>  8:  if (-e $ipfile){print "OK";}
>  9:  else {print "ERR : ".$ip;}
> 10:}
> 
> I'll try it right now.

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $25/pm entry-level VPSes w/ capped bandwidth charges available in WA -

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux