|
|
Currently in semirandom order:
A useful patch to Squid 2.2STABLE which fixes per-user redirection where the user is authenticated using proxy-auth... *** src/redirect.c.orig Tue Jun 22 14:04:43 1999 --- src/redirect.c Tue Jun 22 15:46:41 1999 *************** *** 103,108 **** --- 103,110 ---- cbdataAdd(r, cbdataXfree, 0); r->orig_url = xstrdup(http->uri); r->client_addr = conn->log_addr; + if (http->request->user_ident[0]) + r->client_ident = http->request->user_ident; else if (conn->ident == NULL || *conn->ident == '\0') { r->client_ident = dash_str; } else {
use DB_File; sub mirror($) { scalar(reverse(shift)); } sub domainmatch($$) { my $search = mirror(lc(shift)); my $found = mirror(lc(shift)); if ($search . "." eq $found) { return(0); } else { return(substr($search,0,length($found)) cmp $found); } } sub urlmatch($$) { my $search = lc(shift) . "/"; my $found = lc(shift) . "/"; if ($search eq $found) { return(0); } else { $search = substr($search,0,length($found)); return($search cmp $found); } } my (%url,%domain); $DB_BTREE->{compare} = \&urlmatch; my $url_db = tie(%url, "DB_File", "urls.db", O_CREAT|O_RDWR, 0664, $DB_BTREE) || die("urls.db: $!\n"); $DB_BTREE->{compare} = \&domainmatch; my $domain_db = tie(%domain, "DB_File", "domains.db", O_CREAT|O_RDWR, 0664, $DB_BTREE) || die("domains.db: $!\n"); # Now you can operate on %url and %domain just as normal perl hashes:) $domain{".playboy.com"} = "" unless(exists($domain{"playboy.com"})); $url_db->sync; $domain_db->sync;See the perltie(1) and DB_File(3) man pages that comes with Perl for more info.
#!/local/bin/perl -w use strict; use DB_File; foreach (@ARGV) { my (%db, $key, $val); die("$_: $!\n") unless(-f); tie(%db, "DB_File", $_, O_RDONLY, 0664, $DB_BTREE) || die("$_: $!\n"); foreach $key (keys(%db)) { if($val = $db{$key}) { $val = "\"$val\""; } else { $val = "undef"; } print "$key -> $val\n"; } untie(%db); }See the perltie(1) and DB_File(3) man pages that comes with Perl for more info.
If you have questions and/or answers that should be on the FAQ list please send them to squidguard@squidguard.org
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |