New target 'tidy' in Makefile
This commit is contained in:
parent
b5e2407728
commit
40d2c70604
|
@ -592,3 +592,7 @@ default-diff:
|
||||||
@$(DIFF) lemonldap-ng-manager/example/index.pl $(LMPREFIX)/htdocs/manager/index.pl ||true
|
@$(DIFF) lemonldap-ng-manager/example/index.pl $(LMPREFIX)/htdocs/manager/index.pl ||true
|
||||||
@$(DIFF) lemonldap-ng-manager/example/sessions.pl $(LMPREFIX)/htdocs/manager/sessions.pl ||true
|
@$(DIFF) lemonldap-ng-manager/example/sessions.pl $(LMPREFIX)/htdocs/manager/sessions.pl ||true
|
||||||
|
|
||||||
|
tidy: clean
|
||||||
|
find lemon*/ -type f -name '*.pm' -exec perltidy -b {} \;
|
||||||
|
find lemon*/ -name '*.bak' -delete
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package Lemonldap::NG::Common;
|
package Lemonldap::NG::Common;
|
||||||
|
|
||||||
our $VERSION='0.95';
|
our $VERSION = '0.95';
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,10 @@ sub soapTest {
|
||||||
|
|
||||||
# If non form encoded datas are posted, we call SOAP Services
|
# If non form encoded datas are posted, we call SOAP Services
|
||||||
if ( $ENV{HTTP_SOAPACTION} ) {
|
if ( $ENV{HTTP_SOAPACTION} ) {
|
||||||
require Lemonldap::NG::Common::CGI::SOAPServer; #link protected dispatcher
|
require
|
||||||
require Lemonldap::NG::Common::CGI::SOAPService; #link protected soapService
|
Lemonldap::NG::Common::CGI::SOAPServer; #link protected dispatcher
|
||||||
|
require
|
||||||
|
Lemonldap::NG::Common::CGI::SOAPService; #link protected soapService
|
||||||
my @func = (
|
my @func = (
|
||||||
ref($soapFunctions) ? @$soapFunctions : split /\s+/,
|
ref($soapFunctions) ? @$soapFunctions : split /\s+/,
|
||||||
$soapFunctions
|
$soapFunctions
|
||||||
|
|
|
@ -15,9 +15,9 @@ our $VERSION = '0.2';
|
||||||
# @param @func authorizated methods
|
# @param @func authorizated methods
|
||||||
# @return Lemonldap::NG::Common::CGI::SOAPService object
|
# @return Lemonldap::NG::Common::CGI::SOAPService object
|
||||||
sub new {
|
sub new {
|
||||||
my($class, $obj, @func) = @_;
|
my ( $class, $obj, @func ) = @_;
|
||||||
s/.*::// foreach(@func);
|
s/.*::// foreach (@func);
|
||||||
return bless {obj=>$obj,func=>\@func}, $class;
|
return bless { obj => $obj, func => \@func }, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
## @method datas AUTOLOAD()
|
## @method datas AUTOLOAD()
|
||||||
|
@ -29,14 +29,14 @@ sub new {
|
||||||
sub AUTOLOAD {
|
sub AUTOLOAD {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$AUTOLOAD =~ s/.*:://;
|
$AUTOLOAD =~ s/.*:://;
|
||||||
if(grep {$_ eq $AUTOLOAD} @{$self->{func}}){
|
if ( grep { $_ eq $AUTOLOAD } @{ $self->{func} } ) {
|
||||||
my $tmp = $self->{obj}->$AUTOLOAD(@_);
|
my $tmp = $self->{obj}->$AUTOLOAD(@_);
|
||||||
unless(ref($tmp) and ref($tmp) eq 'SOAP::Data') {
|
unless ( ref($tmp) and ref($tmp) eq 'SOAP::Data' ) {
|
||||||
$tmp = SOAP::Data->name( result => $tmp );
|
$tmp = SOAP::Data->name( result => $tmp );
|
||||||
}
|
}
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
elsif($AUTOLOAD ne 'DESTROY') {
|
elsif ( $AUTOLOAD ne 'DESTROY' ) {
|
||||||
die "$AUTOLOAD is not an authorizated function";
|
die "$AUTOLOAD is not an authorizated function";
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -84,7 +84,8 @@ sub store {
|
||||||
$fields =~ s/'/''/gs;
|
$fields =~ s/'/''/gs;
|
||||||
my $tmp =
|
my $tmp =
|
||||||
$self->_dbh->do( "insert into "
|
$self->_dbh->do( "insert into "
|
||||||
. $self->{dbiTable} . " (cfgNum,data) values ($cfgNum,'$fields')");
|
. $self->{dbiTable}
|
||||||
|
. " (cfgNum,data) values ($cfgNum,'$fields')" );
|
||||||
unless ($tmp) {
|
unless ($tmp) {
|
||||||
$self->logError;
|
$self->logError;
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
|
@ -107,9 +108,10 @@ sub load {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
my $r;
|
my $r;
|
||||||
eval { $r = Storable::thaw($row->[1]); } ;
|
eval { $r = Storable::thaw( $row->[1] ); };
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$Lemonldap::NG::Common::Conf::msg = "Bad stored data in conf database: $@";
|
$Lemonldap::NG::Common::Conf::msg =
|
||||||
|
"Bad stored data in conf database: $@";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
|
|
|
@ -74,7 +74,7 @@ sub store {
|
||||||
$self->unlock;
|
$self->unlock;
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
foreach my $k (sort keys %$fields) {
|
foreach my $k ( sort keys %$fields ) {
|
||||||
print FILE "$k\n\t$fields->{$k}\n\n";
|
print FILE "$k\n\t$fields->{$k}\n\n";
|
||||||
}
|
}
|
||||||
close FILE;
|
close FILE;
|
||||||
|
|
|
@ -56,7 +56,7 @@ sub lastCfg {
|
||||||
|
|
||||||
sub ldap {
|
sub ldap {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $self->{ldap} if($self->{ldap});
|
return $self->{ldap} if ( $self->{ldap} );
|
||||||
|
|
||||||
# Parse servers configuration
|
# Parse servers configuration
|
||||||
my $useTls = 0;
|
my $useTls = 0;
|
||||||
|
@ -106,16 +106,19 @@ sub ldap {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub lock {
|
sub lock {
|
||||||
|
|
||||||
# No lock for LDAP
|
# No lock for LDAP
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub isLocked {
|
sub isLocked {
|
||||||
|
|
||||||
# No lock for LDAP
|
# No lock for LDAP
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub unlock {
|
sub unlock {
|
||||||
|
|
||||||
# No lock for LDAP
|
# No lock for LDAP
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ sub load {
|
||||||
while ( @row = $sth->fetchrow_array ) {
|
while ( @row = $sth->fetchrow_array ) {
|
||||||
$res->{ $row[1] } = $row[2];
|
$res->{ $row[1] } = $row[2];
|
||||||
}
|
}
|
||||||
unless($res) {
|
unless ($res) {
|
||||||
$Lemonldap::NG::Common::Conf::msg .= "No configuration $cfgNum found";
|
$Lemonldap::NG::Common::Conf::msg .= "No configuration $cfgNum found";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,8 +235,7 @@ sub toConf {
|
||||||
sub toHash {
|
sub toHash {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $fields = ();
|
my $fields = ();
|
||||||
foreach (keys %$self)
|
foreach ( keys %$self ) {
|
||||||
{
|
|
||||||
$fields->{$_} = $self->{$_};
|
$fields->{$_} = $self->{$_};
|
||||||
}
|
}
|
||||||
return $fields;
|
return $fields;
|
||||||
|
|
|
@ -66,7 +66,7 @@ sub decrypt {
|
||||||
$msg = '';
|
$msg = '';
|
||||||
|
|
||||||
# Obscure Perl re bug...
|
# Obscure Perl re bug...
|
||||||
$tmp .="\0";
|
$tmp .= "\0";
|
||||||
$tmp =~ s/\0*$//;
|
$tmp =~ s/\0*$//;
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ our $functions = [qw(&checkLogonHours &checkDate)];
|
||||||
# @param $default_access optional what result to return for users without logons hours
|
# @param $default_access optional what result to return for users without logons hours
|
||||||
# @return 1 if access allowed, 0 else
|
# @return 1 if access allowed, 0 else
|
||||||
sub checkLogonHours {
|
sub checkLogonHours {
|
||||||
my ($logon_hours, $syntax, $time_correction, $default_access) = @_;
|
my ( $logon_hours, $syntax, $time_correction, $default_access ) = @_;
|
||||||
|
|
||||||
# Active Directory - logonHours: $attr_src_syntax = octetstring
|
# Active Directory - logonHours: $attr_src_syntax = octetstring
|
||||||
# Samba - sambaLogonHours: ???
|
# Samba - sambaLogonHours: ???
|
||||||
|
@ -39,29 +39,31 @@ sub checkLogonHours {
|
||||||
# Begin with sunday at 0h00
|
# Begin with sunday at 0h00
|
||||||
my $base2_logon_hours;
|
my $base2_logon_hours;
|
||||||
if ( $syntax eq "octetstring" ) {
|
if ( $syntax eq "octetstring" ) {
|
||||||
$base2_logon_hours = unpack ("B*", $logon_hours);
|
$base2_logon_hours = unpack( "B*", $logon_hours );
|
||||||
}
|
}
|
||||||
if ( $syntax eq "hexadecimal" ) {
|
if ( $syntax eq "hexadecimal" ) {
|
||||||
|
|
||||||
# Remove white spaces
|
# Remove white spaces
|
||||||
$logon_hours =~ s/ //g;
|
$logon_hours =~ s/ //g;
|
||||||
$base2_logon_hours = unpack ("B*", pack ("H*", $logon_hours));
|
$base2_logon_hours = unpack( "B*", pack( "H*", $logon_hours ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the present day and hour
|
# Get the present day and hour
|
||||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
|
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
|
||||||
|
gmtime(time);
|
||||||
|
|
||||||
# Get the hour position
|
# Get the hour position
|
||||||
my $hourpos = $wday*24 + $hour;
|
my $hourpos = $wday * 24 + $hour;
|
||||||
|
|
||||||
# Use time_correction
|
# Use time_correction
|
||||||
if ($time_correction) {
|
if ($time_correction) {
|
||||||
my ($sign, $time) = ($time_correction =~ /([+|-]?)(\d+)/);
|
my ( $sign, $time ) = ( $time_correction =~ /([+|-]?)(\d+)/ );
|
||||||
if ($sign =~ /-/) { $hourpos -= $time; }
|
if ( $sign =~ /-/ ) { $hourpos -= $time; }
|
||||||
else { $hourpos += $time; }
|
else { $hourpos += $time; }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the corresponding byte
|
# Get the corresponding byte
|
||||||
return substr($base2_logon_hours, $hourpos, 1);
|
return substr( $base2_logon_hours, $hourpos, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
## @function boolean checkDate(string start, string end, boolean default_access)
|
## @function boolean checkDate(string start, string end, boolean default_access)
|
||||||
|
@ -71,15 +73,15 @@ sub checkLogonHours {
|
||||||
# @param $default_access optional what result to return for users without start or end start
|
# @param $default_access optional what result to return for users without start or end start
|
||||||
# @return 1 if access allowed, 0 else
|
# @return 1 if access allowed, 0 else
|
||||||
sub checkDate {
|
sub checkDate {
|
||||||
my ($start, $end, $default_access) = @_;
|
my ( $start, $end, $default_access ) = @_;
|
||||||
|
|
||||||
# Get date in string
|
# Get date in string
|
||||||
$start = substr($start, 0, 14);
|
$start = substr( $start, 0, 14 );
|
||||||
$end = substr($end, 0, 14);
|
$end = substr( $end, 0, 14 );
|
||||||
|
|
||||||
# Default access if no value
|
# Default access if no value
|
||||||
$default_access ||= "0";
|
$default_access ||= "0";
|
||||||
return $default_access unless ($start or $end);
|
return $default_access unless ( $start or $end );
|
||||||
|
|
||||||
# If no start, set start to 0
|
# If no start, set start to 0
|
||||||
$start ||= 0;
|
$start ||= 0;
|
||||||
|
@ -88,22 +90,22 @@ sub checkDate {
|
||||||
$end ||= 999999999999999;
|
$end ||= 999999999999999;
|
||||||
|
|
||||||
# Get the present day and hour
|
# Get the present day and hour
|
||||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
|
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
|
||||||
|
gmtime(time);
|
||||||
$year += 1900;
|
$year += 1900;
|
||||||
$mon += 1;
|
$mon += 1;
|
||||||
$mon = "0".$mon if ($mon<10);
|
$mon = "0" . $mon if ( $mon < 10 );
|
||||||
$mday = "0".$mday if ($mday<10);
|
$mday = "0" . $mday if ( $mday < 10 );
|
||||||
$hour = "0".$hour if ($hour<10);
|
$hour = "0" . $hour if ( $hour < 10 );
|
||||||
$min = "0".$min if ($min<10);
|
$min = "0" . $min if ( $min < 10 );
|
||||||
$sec = "0".$sec if ($sec<10);
|
$sec = "0" . $sec if ( $sec < 10 );
|
||||||
|
|
||||||
my $date = $year.$mon.$mday.$hour.$min.$sec;
|
my $date = $year . $mon . $mday . $hour . $min . $sec;
|
||||||
|
|
||||||
return 1 if ( ($date >= $start) and ($date <= $end) );
|
return 1 if ( ( $date >= $start ) and ( $date <= $end ) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ use Lemonldap::NG::Common::Conf::Constants; #inherits
|
||||||
use Cache::Cache qw($EXPIRES_NEVER);
|
use Cache::Cache qw($EXPIRES_NEVER);
|
||||||
|
|
||||||
use base qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
|
use base qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
|
||||||
|
|
||||||
#parameter reloadTime Time in second between 2 configuration check (600)
|
#parameter reloadTime Time in second between 2 configuration check (600)
|
||||||
|
|
||||||
our $VERSION = '0.72';
|
our $VERSION = '0.72';
|
||||||
|
@ -62,6 +63,7 @@ BEGIN {
|
||||||
# @param $args hash containing parameters
|
# @param $args hash containing parameters
|
||||||
sub init($$) {
|
sub init($$) {
|
||||||
my ( $class, $args ) = splice @_;
|
my ( $class, $args ) = splice @_;
|
||||||
|
|
||||||
# TODO reloadTime in defaultValuesInit ?
|
# TODO reloadTime in defaultValuesInit ?
|
||||||
$reloadTime = $args->{reloadTime} || 600;
|
$reloadTime = $args->{reloadTime} || 600;
|
||||||
$class->localInit($args);
|
$class->localInit($args);
|
||||||
|
@ -91,8 +93,8 @@ sub localInit {
|
||||||
Lemonldap::NG::Common::Conf->new( $args->{configStorage} ) );
|
Lemonldap::NG::Common::Conf->new( $args->{configStorage} ) );
|
||||||
|
|
||||||
# Get local configuration parameters
|
# Get local configuration parameters
|
||||||
my $localconf = $lmConf->getLocalConf( HANDLERSECTION );
|
my $localconf = $lmConf->getLocalConf(HANDLERSECTION);
|
||||||
if ( $localconf ) {
|
if ($localconf) {
|
||||||
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
|
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,9 @@ use Digest::MD5;
|
||||||
|
|
||||||
our $VERSION = '0.11';
|
our $VERSION = '0.11';
|
||||||
|
|
||||||
open S, '/etc/lemonldap-ng/sympa.secret' or die "Unable to open /etc/lemonldap-ng/sympa.secret";
|
open S, '/etc/lemonldap-ng/sympa.secret'
|
||||||
our $sympaSecret = join('',<S>);
|
or die "Unable to open /etc/lemonldap-ng/sympa.secret";
|
||||||
|
our $sympaSecret = join( '', <S> );
|
||||||
close S;
|
close S;
|
||||||
$sympaSecret =~ s/[\r\n]//g;
|
$sympaSecret =~ s/[\r\n]//g;
|
||||||
|
|
||||||
|
@ -20,8 +21,9 @@ sub run {
|
||||||
# Building Sympa cookie
|
# Building Sympa cookie
|
||||||
my $tmp = new Digest::MD5;
|
my $tmp = new Digest::MD5;
|
||||||
$tmp->reset;
|
$tmp->reset;
|
||||||
$tmp->add($datas->{mail}.$sympaSecret);
|
$tmp->add( $datas->{mail} . $sympaSecret );
|
||||||
my $str = "sympauser=$datas->{mail}:".substr(unpack("H*",$tmp->digest), -8);
|
my $str =
|
||||||
|
"sympauser=$datas->{mail}:" . substr( unpack( "H*", $tmp->digest ), -8 );
|
||||||
|
|
||||||
# Get cookie header, removing Sympa cookie if exists (avoid security
|
# Get cookie header, removing Sympa cookie if exists (avoid security
|
||||||
# problems) and set the new value
|
# problems) and set the new value
|
||||||
|
|
|
@ -35,8 +35,10 @@ sub locationRulesInit {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$locationCondition->{$vhost}->[ $locationCount->{$vhost} ] =
|
$locationCondition->{$vhost}->[ $locationCount->{$vhost} ] =
|
||||||
$class->conditionSub( $args->{locationRules}->{$vhost}->{$_} );
|
$class->conditionSub(
|
||||||
$locationRegexp->{$vhost}->[ $locationCount->{$vhost} ] = qr/$_/;
|
$args->{locationRules}->{$vhost}->{$_} );
|
||||||
|
$locationRegexp->{$vhost}->[ $locationCount->{$vhost} ] =
|
||||||
|
qr/$_/;
|
||||||
$locationCount->{$vhost}++;
|
$locationCount->{$vhost}++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ sub confNode {
|
||||||
|
|
||||||
# saml metadata
|
# saml metadata
|
||||||
elsif ( $target =~ s/^samlmetadata:// ) {
|
elsif ( $target =~ s/^samlmetadata:// ) {
|
||||||
my $h = $self->keyToH($target, $self->conf);
|
my $h = $self->keyToH( $target, $self->conf );
|
||||||
$h = $h->{samlIDPMetaDataXML} if ( $h->{samlIDPMetaDataXML} );
|
$h = $h->{samlIDPMetaDataXML} if ( $h->{samlIDPMetaDataXML} );
|
||||||
my $metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new();
|
my $metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new();
|
||||||
$metadata->initializeFromConfHash($h);
|
$metadata->initializeFromConfHash($h);
|
||||||
|
|
|
@ -67,7 +67,8 @@ sub confUpload {
|
||||||
$id =~ s/\r//g;
|
$id =~ s/\r//g;
|
||||||
$id =~ s/^\///;
|
$id =~ s/^\///;
|
||||||
$id =~ s/(?:\/[^\/]*)?$/\/$name/ if ($NK);
|
$id =~ s/(?:\/[^\/]*)?$/\/$name/ if ($NK);
|
||||||
next if ( $id =~ /^(generalParameters|virtualHosts|samlIDPMetaDataNode)/);
|
next
|
||||||
|
if ( $id =~ /^(generalParameters|virtualHosts|samlIDPMetaDataNode)/ );
|
||||||
my ( $confKey, $test ) = $self->getConfTests($id);
|
my ( $confKey, $test ) = $self->getConfTests($id);
|
||||||
my ( $res, $m );
|
my ( $res, $m );
|
||||||
|
|
||||||
|
@ -317,15 +318,12 @@ sub findAllConfKeys {
|
||||||
sub formatValue {
|
sub formatValue {
|
||||||
my ( $self, $key, $value ) = @_;
|
my ( $self, $key, $value ) = @_;
|
||||||
my $newvalue = $value;
|
my $newvalue = $value;
|
||||||
if ( $key =~ /^samlIDPMetaDataXML/ )
|
if ( $key =~ /^samlIDPMetaDataXML/ ) {
|
||||||
{
|
|
||||||
my $metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new();
|
my $metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new();
|
||||||
if (ref($value))
|
if ( ref($value) ) {
|
||||||
{
|
|
||||||
$metadata->initializeFromConfHash($value);
|
$metadata->initializeFromConfHash($value);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$metadata->initializeFromXML($value);
|
$metadata->initializeFromXML($value);
|
||||||
}
|
}
|
||||||
$newvalue = $metadata->toHash();
|
$newvalue = $metadata->toHash();
|
||||||
|
@ -346,7 +344,7 @@ sub setKeyToH {
|
||||||
my ( $self, $h, $key, $k2 ) = @_;
|
my ( $self, $h, $key, $k2 ) = @_;
|
||||||
my $tmp = $h;
|
my $tmp = $h;
|
||||||
$key =~ s/^\///;
|
$key =~ s/^\///;
|
||||||
$value = $self->formatValue($key, $value);
|
$value = $self->formatValue( $key, $value );
|
||||||
while (1) {
|
while (1) {
|
||||||
if ( $key =~ /\// ) {
|
if ( $key =~ /\// ) {
|
||||||
my $k = $`;
|
my $k = $`;
|
||||||
|
|
|
@ -19,12 +19,11 @@ our $VERSION = '0.1';
|
||||||
sub cstruct {
|
sub cstruct {
|
||||||
shift;
|
shift;
|
||||||
my ( $h, $k ) = @_;
|
my ( $h, $k ) = @_;
|
||||||
my @tmp = split(/\//, $k);
|
my @tmp = split( /\//, $k );
|
||||||
return $h unless (scalar(@tmp) > 1);
|
return $h unless ( scalar(@tmp) > 1 );
|
||||||
my $k1 = $tmp[0];
|
my $k1 = $tmp[0];
|
||||||
my $k2 = $tmp[1];
|
my $k2 = $tmp[1];
|
||||||
if ($k1 =~ /^virtualHosts/i)
|
if ( $k1 =~ /^virtualHosts/i ) {
|
||||||
{
|
|
||||||
%$h = (
|
%$h = (
|
||||||
%$h,
|
%$h,
|
||||||
virtualHosts => {
|
virtualHosts => {
|
||||||
|
@ -42,8 +41,7 @@ sub cstruct {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
elsif ($k1 =~ /^samlIDPMetaDataNode/i)
|
elsif ( $k1 =~ /^samlIDPMetaDataNode/i ) {
|
||||||
{
|
|
||||||
%$h = (
|
%$h = (
|
||||||
%$h,
|
%$h,
|
||||||
samlIDPMetaDataNode => {
|
samlIDPMetaDataNode => {
|
||||||
|
@ -73,7 +71,9 @@ sub cstruct {
|
||||||
sub struct {
|
sub struct {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return {
|
return {
|
||||||
_nodes => [qw(n:generalParameters n:variables n:virtualHosts n:samlServiceMetaData n:samlIDPMetaDataNode)],
|
_nodes => [
|
||||||
|
qw(n:generalParameters n:variables n:virtualHosts n:samlServiceMetaData n:samlIDPMetaDataNode)
|
||||||
|
],
|
||||||
_help => 'default',
|
_help => 'default',
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -274,7 +274,9 @@ sub struct {
|
||||||
########
|
########
|
||||||
# virtual keys should not begin like configuration keys.
|
# virtual keys should not begin like configuration keys.
|
||||||
samlIDPMetaDataNode => {
|
samlIDPMetaDataNode => {
|
||||||
_nodes => ['nhash:/samlIDPMetaDataExportedAttributes:samlIDPMetaDataNode:samlMetaData'],
|
_nodes => [
|
||||||
|
'nhash:/samlIDPMetaDataExportedAttributes:samlIDPMetaDataNode:samlMetaData'
|
||||||
|
],
|
||||||
_upload => ['/samlIDPMetaDataXML'],
|
_upload => ['/samlIDPMetaDataXML'],
|
||||||
_help => 'default',
|
_help => 'default',
|
||||||
_call => '$(\'#newsamlmetadatab\').show();',
|
_call => '$(\'#newsamlmetadatab\').show();',
|
||||||
|
@ -333,9 +335,9 @@ sub struct {
|
||||||
],
|
],
|
||||||
_help => 'default',
|
_help => 'default',
|
||||||
samlSPSSODescriptorSingleLogoutServiceHTTP =>
|
samlSPSSODescriptorSingleLogoutServiceHTTP =>
|
||||||
'samlService:/samlSPSSODescriptorSingleLogoutServiceHTTP',
|
'samlService:/samlSPSSODescriptorSingleLogoutServiceHTTP',
|
||||||
samlSPSSODescriptorSingleLogoutServiceSOAP =>
|
samlSPSSODescriptorSingleLogoutServiceSOAP =>
|
||||||
'samlService:/samlSPSSODescriptorSingleLogoutServiceSOAP',
|
'samlService:/samlSPSSODescriptorSingleLogoutServiceSOAP',
|
||||||
},
|
},
|
||||||
|
|
||||||
samlSPSSODescriptorAssertionConsumerService => {
|
samlSPSSODescriptorAssertionConsumerService => {
|
||||||
|
@ -791,7 +793,8 @@ sub defaultConf {
|
||||||
# SAML #
|
# SAML #
|
||||||
########
|
########
|
||||||
samlIDPMetaDataXML => { 'authentic' => {} },
|
samlIDPMetaDataXML => { 'authentic' => {} },
|
||||||
samlIDPMetaDataExportedAttributes => { 'authentic' => { 'uid' => '0;uid;;' } },
|
samlIDPMetaDataExportedAttributes =>
|
||||||
|
{ 'authentic' => { 'uid' => '0;uid;;' } },
|
||||||
samlServicePrivateKey => '',
|
samlServicePrivateKey => '',
|
||||||
samlEntityID => 'http://auth.example.com/saml/metadata',
|
samlEntityID => 'http://auth.example.com/saml/metadata',
|
||||||
samlOrganizationDisplayName => 'Example',
|
samlOrganizationDisplayName => 'Example',
|
||||||
|
|
|
@ -249,7 +249,7 @@ sub process {
|
||||||
elsif ( $urldir eq $self->PC_LA_URLFTR ) {
|
elsif ( $urldir eq $self->PC_LA_URLFTR ) {
|
||||||
|
|
||||||
$self->{error} = $self->_subProcess(
|
$self->{error} = $self->_subProcess(
|
||||||
qw( libertyFederationTerminationReturn autoRedirect ) );
|
qw( libertyFederationTerminationReturn autoRedirect ));
|
||||||
|
|
||||||
# singleLogout : called when IDP request Logout.
|
# singleLogout : called when IDP request Logout.
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,9 @@ sub setGroups {
|
||||||
and $self->{ldapGroupAttributeNameGroup} ne "dn" );
|
and $self->{ldapGroupAttributeNameGroup} ne "dn" );
|
||||||
|
|
||||||
# Get value for group search
|
# Get value for group search
|
||||||
my $group_value = $self->{ldap}->getLdapValue( $self->{entry}, $self->{ldapGroupAttributeNameUser} );
|
my $group_value =
|
||||||
|
$self->{ldap}
|
||||||
|
->getLdapValue( $self->{entry}, $self->{ldapGroupAttributeNameUser} );
|
||||||
|
|
||||||
$self->lmLog(
|
$self->lmLog(
|
||||||
"Searching LDAP groups in "
|
"Searching LDAP groups in "
|
||||||
|
|
|
@ -29,7 +29,7 @@ sub getUser {
|
||||||
# @return Lemonldap::NG::Portal constant
|
# @return Lemonldap::NG::Portal constant
|
||||||
sub setSessionInfo {
|
sub setSessionInfo {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->{sessionInfo}->{$self->{whatToTrace}} = $self->{user};
|
$self->{sessionInfo}->{ $self->{whatToTrace} } = $self->{user};
|
||||||
PE_OK;
|
PE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,9 @@ sub searchGroups {
|
||||||
if ( $portal->{ldapGroupRecursive} ) {
|
if ( $portal->{ldapGroupRecursive} ) {
|
||||||
|
|
||||||
# Get searched value
|
# Get searched value
|
||||||
my $group_value = $self->getLdapValue( $entry, $portal->{ldapGroupAttributeNameGroup} );
|
my $group_value =
|
||||||
|
$self->getLdapValue( $entry,
|
||||||
|
$portal->{ldapGroupAttributeNameGroup} );
|
||||||
|
|
||||||
# Launch group search
|
# Launch group search
|
||||||
if ($group_value) {
|
if ($group_value) {
|
||||||
|
@ -446,7 +448,7 @@ sub getLdapValue {
|
||||||
|
|
||||||
my $value;
|
my $value;
|
||||||
|
|
||||||
foreach ( $entry->get_value( $attribute ) ) {
|
foreach ( $entry->get_value($attribute) ) {
|
||||||
$value .= $_;
|
$value .= $_;
|
||||||
$value .= ";";
|
$value .= ";";
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ sub send_mail {
|
||||||
$self->lmLog( "SMTP To " . $mail, 'debug' );
|
$self->lmLog( "SMTP To " . $mail, 'debug' );
|
||||||
$self->lmLog( "SMTP Subject " . $subject, 'debug' );
|
$self->lmLog( "SMTP Subject " . $subject, 'debug' );
|
||||||
$self->lmLog( "SMTP Body " . $body, 'debug' );
|
$self->lmLog( "SMTP Body " . $body, 'debug' );
|
||||||
$self->lmLog( "SMTP HTML flag " . ($html?"on":"off"), 'debug' );
|
$self->lmLog( "SMTP HTML flag " . ( $html ? "on" : "off" ), 'debug' );
|
||||||
eval {
|
eval {
|
||||||
my $message = MIME::Lite->new(
|
my $message = MIME::Lite->new(
|
||||||
From => $self->{mailFrom},
|
From => $self->{mailFrom},
|
||||||
|
@ -50,7 +50,7 @@ sub send_mail {
|
||||||
Type => "TEXT",
|
Type => "TEXT",
|
||||||
Data => $body,
|
Data => $body,
|
||||||
);
|
);
|
||||||
$message->attr("content-type" => "text/html; charset=utf-8") if $html;
|
$message->attr( "content-type" => "text/html; charset=utf-8" ) if $html;
|
||||||
$self->{SMTPServer}
|
$self->{SMTPServer}
|
||||||
? $message->send( "smtp", $self->{SMTPServer} )
|
? $message->send( "smtp", $self->{SMTPServer} )
|
||||||
: $message->send();
|
: $message->send();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user