use Digest::HMAC;
use Digest::SHA;
use Data::Dumper;
+use File::Copy;
#---------- public utilities ----------
'</address>');
}
+#---------- licence and source code ----------
+
+sub dump_licence ($$$) {
+
+ my ($c,$r, $fh) = @_;
+ foreach my $incdir ($r->_ch('getsource_includedirs')) {
+
+ }
+}
+
+sub source_dump_get_path ($$$) {
+ my ($c,$r, $thing) = @_;
+ die if $thing =~ m/\W/;
+ my $pat = $r->{S}('source_dump_path_pat');
+ my $leaf = sprintf $pat, $thing;
+ return $r->_absify_path($leaf);
+}
+
+sub source_dump_thing ($$$) {
+ my ($c,$r, $thing, $outfn) = @_;
+ my $path = $r->_ch('source_dump_get_path', $thing);
+ copy($path, $utfn
+
#---------- verifier object methods ----------
sub new_verifier {
assocdb_dbh => undef, # must have AutoCommit=0, RaiseError=1
assocdb_path => 'caf-assocs.db',
keys_path => 'caf-keys',
+ source_dump_path_pat => 'caf-%s.dump',
+ source_dump_get_path => \&source_dump_get_path,
assocdb_dsn => undef,
assocdb_user => '',
assocdb_password => '',
gen_login_form => \&gen_plain_login_form,
gen_login_link => \&gen_plain_login_link,
gen_postmainpage_form => \&gen_postmainpage_form,
+ source_dump_thing => \&source_dump_thing,
+ source_includedirs => sub { grep { !m#^/etc/# } @INC; },
gettext => sub { gettext($_[2]); },
print => sub { print $_[2] or die $!; },
debug => sub { }, # like print; msgs contain trailing \n
sub _get_path ($$) {
my ($v,$keybase) = @_;
my $leaf = $v->{S}{"${keybase}_path"};
- my $dir = $v->{S}{dir};
+ return $r->_absify_path($leaf);
+}
+
+sub _absify_path ($$) {
+ my ($v,$leaf) = @_;
return $leaf if $leaf =~ m,^/,;
+ my $dir = $v->{S}{dir};
die "relying on cwd by default ?! set dir" unless defined $dir;
return "$dir/$leaf";
}
my $params = $divert->{Params};
my $cookie = $r->construct_cookie($cookiesecret);
+ if ($kind =~ m/^SPECIAL-(LICENCE|SOURCE)$/) {
+ $r->_ch('dump_'.lc $1, \*STDOUT);
+ return 0;
+ }
+
if ($kind =~ m/^REDIRECT-/) {
# for redirects, we honour stored NextParams and SetCookie,
# as we would for non-divert