Commit dea799a5 authored by Xavier Guimard's avatar Xavier Guimard

* Safe jail is now running

 * Bug corrections in Handler::Vhost and Handler::Simple
 * Example runs fine now


git-svn-id: svn://svn.forge.objectweb.org/svnroot/lemonldap/trunk@14 1dbb9719-a921-0410-b57f-c3a383c2c641
parent 8f9eb177
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'
......
......@@ -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
......
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;
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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} );
}
}
......
......@@ -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>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment