* Safe jail is now running

* Bug corrections in Handler::Vhost and Handler::Simple
 * Example runs fine now
This commit is contained in:
Xavier Guimard 2006-12-31 12:59:26 +00:00
parent dbe9fa9289
commit f581c0c1c2
7 changed files with 31 additions and 9 deletions

View File

@ -1,5 +1,11 @@
Revision history for Perl extension Lemonldap::NG::Handler.
0.71 Sun Dec 31 13:47:49 2006
- Bug corrections in Vhosts: default header does not work
Safe does not work because lmSetHeaderIn
was not shared
- Example correction
0.7 Tue Dec 19 19:09:09 2006
- config is now shared with Lemonldap::NG::Manager::Conf
- use Safe for locationRules and exportedHeaders 'eval'

View File

@ -5,6 +5,20 @@
ServerName test.example.com
PerlRequire __DIR__/handler/MyHandler.pm
DocumentRoot __DIR__
<Directory __DIR__>
Order allow,deny
Allow from all
</Directory>
<Files *.pl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
</Files>
<IfModule mod_dir.c>
DirectoryIndex index.pl index.html
</IfModule>
PerlInitHandler My::Package
<Location /reload>
Order deny,allow

View File

@ -1,7 +1,7 @@
package Lemonldap::NG::Handler;
print STDERR "See Lemonldap::NG::Handler(3) to know which Lemonldap::NG::Handler::* module to use.";
our $VERSION = "0.7";
our $VERSION = "0.71";
1;

View File

@ -9,7 +9,7 @@ use Cache::Cache qw($EXPIRES_NEVER);
our @ISA = qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
our $VERSION = '0.5';
our $VERSION = '0.51';
our $cfgNum = 0;
our $lastReload = 0;
our $reloadTime;
@ -46,6 +46,7 @@ sub init($$) {
sub localInit {
my($class, $args) = @_;
$lmConf = Lemonldap::NG::Manager::Conf->new ( $args->{configStorage} );
$class->defaultValuesInit($args);
$class->SUPER::localInit($args);
}

View File

@ -209,7 +209,7 @@ sub lmHeaderOut {
# Security jail
$safe = new Safe;
$safe->share('&encode_base64','$datas');
$safe->share('&encode_base64','$datas', '&lmSetHeaderIn', '$apacheRequest');
# init() : by default, it calls localInit and globalInit, but with
# a shared configuration, init() is overloaded to call only
@ -315,10 +315,10 @@ sub defaultValuesInit {
my ( $class, $args ) = @_;
# Other values
$cookieName = $args->{cookieName} || 'lemon';
$whatToTrace = $args->{whatToTrace} || '$uid';
$cookieName ||= $args->{cookieName} || 'lemon';
$whatToTrace ||= $args->{whatToTrace} || '$uid';
$whatToTrace =~ s/\$//g;
$https = $args->{https};
$https = $args->{https} unless defined($https);
$https = 1 unless defined($https);
}

View File

@ -4,7 +4,7 @@ use Lemonldap::NG::Handler::Simple qw(:locationRules :headers);
use strict;
use MIME::Base64;
our $VERSION = '0.4';
our $VERSION = '0.5';
sub locationRulesInit {
my ( $class, $args ) = @_;
@ -45,7 +45,7 @@ sub forgeHeadersInit {
}
#$sub = "\$forgeHeaders->{'$vhost'} = sub {$sub};";
#eval "$sub";
$forgeHeaders->{'$vhost'} = $safe->reval("sub {$sub}");
$forgeHeaders->{$vhost} = $safe->reval("sub {$sub}");
$class->lmLog( "$class: Unable to forge headers: $@: sub {$sub}", 'error' ) if ($@);
}
}
@ -58,7 +58,7 @@ sub sendHeaders {
&{ $forgeHeaders->{$vhost} };
}
else {
lmSetHeaderIn( $apacheRequest, 'Auth-User' => '$uid' );
lmSetHeaderIn( $apacheRequest, 'Auth-User' => $datas->{uid} );
}
}

View File

@ -18,6 +18,7 @@ if($portal->process()) {
else {
print $portal->header;
print $portal->start_html;
print 'Error: '.$portal->error.'<br>';
print '<form method="POST">';
print '<input type="hidden" name="url" value="'.$portal->param('url').'">';
print 'Login : <input name="user"><br>';