New target 'tidy' in Makefile

This commit is contained in:
Xavier Guimard 2010-03-01 20:32:28 +00:00
parent b5e2407728
commit 40d2c70604
42 changed files with 638 additions and 615 deletions

View File

@ -592,3 +592,7 @@ default-diff:
@$(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
tidy: clean
find lemon*/ -type f -name '*.pm' -exec perltidy -b {} \;
find lemon*/ -name '*.bak' -delete

View File

@ -127,8 +127,10 @@ sub soapTest {
# If non form encoded datas are posted, we call SOAP Services
if ( $ENV{HTTP_SOAPACTION} ) {
require Lemonldap::NG::Common::CGI::SOAPServer; #link protected dispatcher
require Lemonldap::NG::Common::CGI::SOAPService; #link protected soapService
require
Lemonldap::NG::Common::CGI::SOAPServer; #link protected dispatcher
require
Lemonldap::NG::Common::CGI::SOAPService; #link protected soapService
my @func = (
ref($soapFunctions) ? @$soapFunctions : split /\s+/,
$soapFunctions

View File

@ -84,7 +84,8 @@ sub store {
$fields =~ s/'/''/gs;
my $tmp =
$self->_dbh->do( "insert into "
. $self->{dbiTable} . " (cfgNum,data) values ($cfgNum,'$fields')");
. $self->{dbiTable}
. " (cfgNum,data) values ($cfgNum,'$fields')" );
unless ($tmp) {
$self->logError;
return UNKNOWN_ERROR;
@ -109,7 +110,8 @@ sub load {
my $r;
eval { $r = Storable::thaw( $row->[1] ); };
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 $r;

View File

@ -106,16 +106,19 @@ sub ldap {
}
sub lock {
# No lock for LDAP
return 1;
}
sub isLocked {
# No lock for LDAP
return 0;
}
sub unlock {
# No lock for LDAP
return 1;
}

View File

@ -235,8 +235,7 @@ sub toConf {
sub toHash {
my $self = shift;
my $fields = ();
foreach (keys %$self)
{
foreach ( keys %$self ) {
$fields->{$_} = $self->{$_};
}
return $fields;

View File

@ -42,13 +42,15 @@ sub checkLogonHours {
$base2_logon_hours = unpack( "B*", $logon_hours );
}
if ( $syntax eq "hexadecimal" ) {
# Remove white spaces
$logon_hours =~ s/ //g;
$base2_logon_hours = unpack( "B*", pack( "H*", $logon_hours ) );
}
# 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
my $hourpos = $wday * 24 + $hour;
@ -88,7 +90,8 @@ sub checkDate {
$end ||= 999999999999999;
# 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;
$mon += 1;
$mon = "0" . $mon if ( $mon < 10 );
@ -103,7 +106,6 @@ sub checkDate {
return 0;
}
1;
__END__

View File

@ -24,6 +24,7 @@ use Lemonldap::NG::Common::Conf::Constants; #inherits
use Cache::Cache qw($EXPIRES_NEVER);
use base qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
#parameter reloadTime Time in second between 2 configuration check (600)
our $VERSION = '0.72';
@ -62,6 +63,7 @@ BEGIN {
# @param $args hash containing parameters
sub init($$) {
my ( $class, $args ) = splice @_;
# TODO reloadTime in defaultValuesInit ?
$reloadTime = $args->{reloadTime} || 600;
$class->localInit($args);

View File

@ -7,7 +7,8 @@ use Digest::MD5;
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'
or die "Unable to open /etc/lemonldap-ng/sympa.secret";
our $sympaSecret = join( '', <S> );
close S;
$sympaSecret =~ s/[\r\n]//g;
@ -21,7 +22,8 @@ sub run {
my $tmp = new Digest::MD5;
$tmp->reset;
$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
# problems) and set the new value

View File

@ -35,8 +35,10 @@ sub locationRulesInit {
}
else {
$locationCondition->{$vhost}->[ $locationCount->{$vhost} ] =
$class->conditionSub( $args->{locationRules}->{$vhost}->{$_} );
$locationRegexp->{$vhost}->[ $locationCount->{$vhost} ] = qr/$_/;
$class->conditionSub(
$args->{locationRules}->{$vhost}->{$_} );
$locationRegexp->{$vhost}->[ $locationCount->{$vhost} ] =
qr/$_/;
$locationCount->{$vhost}++;
}
}

View File

@ -67,7 +67,8 @@ sub confUpload {
$id =~ s/\r//g;
$id =~ s/^\///;
$id =~ s/(?:\/[^\/]*)?$/\/$name/ if ($NK);
next if ( $id =~ /^(generalParameters|virtualHosts|samlIDPMetaDataNode)/);
next
if ( $id =~ /^(generalParameters|virtualHosts|samlIDPMetaDataNode)/ );
my ( $confKey, $test ) = $self->getConfTests($id);
my ( $res, $m );
@ -317,15 +318,12 @@ sub findAllConfKeys {
sub formatValue {
my ( $self, $key, $value ) = @_;
my $newvalue = $value;
if ( $key =~ /^samlIDPMetaDataXML/ )
{
if ( $key =~ /^samlIDPMetaDataXML/ ) {
my $metadata = Lemonldap::NG::Common::Conf::SAML::Metadata->new();
if (ref($value))
{
if ( ref($value) ) {
$metadata->initializeFromConfHash($value);
}
else
{
else {
$metadata->initializeFromXML($value);
}
$newvalue = $metadata->toHash();

View File

@ -23,8 +23,7 @@ sub cstruct {
return $h unless ( scalar(@tmp) > 1 );
my $k1 = $tmp[0];
my $k2 = $tmp[1];
if ($k1 =~ /^virtualHosts/i)
{
if ( $k1 =~ /^virtualHosts/i ) {
%$h = (
%$h,
virtualHosts => {
@ -42,8 +41,7 @@ sub cstruct {
}
);
}
elsif ($k1 =~ /^samlIDPMetaDataNode/i)
{
elsif ( $k1 =~ /^samlIDPMetaDataNode/i ) {
%$h = (
%$h,
samlIDPMetaDataNode => {
@ -73,7 +71,9 @@ sub cstruct {
sub struct {
my $self = shift;
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',
######################
@ -274,7 +274,9 @@ sub struct {
########
# virtual keys should not begin like configuration keys.
samlIDPMetaDataNode => {
_nodes => ['nhash:/samlIDPMetaDataExportedAttributes:samlIDPMetaDataNode:samlMetaData'],
_nodes => [
'nhash:/samlIDPMetaDataExportedAttributes:samlIDPMetaDataNode:samlMetaData'
],
_upload => ['/samlIDPMetaDataXML'],
_help => 'default',
_call => '$(\'#newsamlmetadatab\').show();',
@ -791,7 +793,8 @@ sub defaultConf {
# SAML #
########
samlIDPMetaDataXML => { 'authentic' => {} },
samlIDPMetaDataExportedAttributes => { 'authentic' => { 'uid' => '0;uid;;' } },
samlIDPMetaDataExportedAttributes =>
{ 'authentic' => { 'uid' => '0;uid;;' } },
samlServicePrivateKey => '',
samlEntityID => 'http://auth.example.com/saml/metadata',
samlOrganizationDisplayName => 'Example',

View File

@ -135,7 +135,9 @@ sub setGroups {
and $self->{ldapGroupAttributeNameGroup} ne "dn" );
# 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(
"Searching LDAP groups in "

View File

@ -393,7 +393,9 @@ sub searchGroups {
if ( $portal->{ldapGroupRecursive} ) {
# Get searched value
my $group_value = $self->getLdapValue( $entry, $portal->{ldapGroupAttributeNameGroup} );
my $group_value =
$self->getLdapValue( $entry,
$portal->{ldapGroupAttributeNameGroup} );
# Launch group search
if ($group_value) {