Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
40d2c706
Commit
40d2c706
authored
Mar 01, 2010
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New target 'tidy' in Makefile
parent
b5e24077
Changes
42
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
641 additions
and
618 deletions
+641
-618
build/lemonldap-ng/Makefile
build/lemonldap-ng/Makefile
+4
-0
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common.pm
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common.pm
+1
-1
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Apache/Session/SOAP.pm
...-ng-common/lib/Lemonldap/NG/Common/Apache/Session/SOAP.pm
+4
-4
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm
+4
-2
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI/SOAPService.pm
...ldap-ng-common/lib/Lemonldap/NG/Common/CGI/SOAPService.pm
+6
-6
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm
+1
-1
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/CDBI.pm
.../lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/CDBI.pm
+6
-4
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/File.pm
.../lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/File.pm
+3
-3
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/LDAP.pm
.../lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/LDAP.pm
+5
-2
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RDBI.pm
.../lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RDBI.pm
+1
-1
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm
...p-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm
+4
-5
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SOAP.pm
.../lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SOAP.pm
+1
-1
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
...ldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
+2
-2
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Crypto.pm
...les/lemonldap-ng-common/lib/Lemonldap/NG/Common/Crypto.pm
+1
-1
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Safelib.pm
...es/lemonldap-ng-common/lib/Lemonldap/NG/Common/Safelib.pm
+26
-24
modules/lemonldap-ng-handler/example/MyHandler.pm
modules/lemonldap-ng-handler/example/MyHandler.pm
+5
-5
modules/lemonldap-ng-handler/example/MyHandlerLog4Perl.pm
modules/lemonldap-ng-handler/example/MyHandlerLog4Perl.pm
+5
-5
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm
+5
-5
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SharedConf.pm
...monldap-ng-handler/lib/Lemonldap/NG/Handler/SharedConf.pm
+6
-4
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm
...s/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm
+58
-58
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SympaAutoLogin.pm
...dap-ng-handler/lib/Lemonldap/NG/Handler/SympaAutoLogin.pm
+15
-13
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm
...es/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Vhost.pm
+5
-3
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
+5
-5
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm
...monldap-ng-manager/lib/Lemonldap/NG/Manager/Downloader.pm
+11
-11
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Help.pm
...les/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Help.pm
+1
-1
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm
...lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm
+4
-4
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm
...lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm
+6
-8
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm
.../lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm
+229
-226
modules/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm
...es/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_i18n.pm
+142
-142
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthLA.pm
...les/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthLA.pm
+1
-1
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Menu.pm
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Menu.pm
+9
-9
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Notification.pm
...monldap-ng-portal/lib/Lemonldap/NG/Portal/Notification.pm
+1
-1
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/PasswordDBDBI.pm
...onldap-ng-portal/lib/Lemonldap/NG/Portal/PasswordDBDBI.pm
+2
-2
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm
...les/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm
+15
-15
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBLDAP.pm
...lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBLDAP.pm
+6
-4
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBNull.pm
...lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBNull.pm
+1
-1
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm
+8
-8
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_LDAP.pm
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_LDAP.pm
+15
-13
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SMTP.pm
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SMTP.pm
+11
-11
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SOAP.pm
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SOAP.pm
+1
-1
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_WebForm.pm
...s/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_WebForm.pm
+3
-3
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_i18n.pm
modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_i18n.pm
+2
-2
No files found.
build/lemonldap-ng/Makefile
View file @
40d2c706
...
...
@@ -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
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common.pm
View file @
40d2c706
package
Lemonldap::NG::
Common
;
our
$VERSION
=
'
0.95
';
our
$VERSION
=
'
0.95
';
use
strict
;
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Apache/Session/SOAP.pm
View file @
40d2c706
...
...
@@ -194,12 +194,12 @@ sub get_key_from_all_sessions() {
my
$r
=
$self
->
_soapCall
(
"
get_key_from_all_sessions
",
$args
);
my
$res
;
if
(
$r
)
{
foreach
my
$k
(
keys
%$r
)
{
my
$tmp
=
&$data
(
$r
->
{
$k
},
$k
);
$res
->
{
$k
}
=
$tmp
if
(
defined
(
$tmp
)
);
foreach
my
$k
(
keys
%$r
)
{
my
$tmp
=
&$data
(
$r
->
{
$k
},
$k
);
$res
->
{
$k
}
=
$tmp
if
(
defined
(
$tmp
)
);
}
}
}
}
else
{
return
$self
->
_soapCall
(
"
get_key_from_all_sessions
",
$args
,
$data
);
}
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI.pm
View file @
40d2c706
...
...
@@ -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
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/CGI/SOAPService.pm
View file @
40d2c706
...
...
@@ -15,9 +15,9 @@ our $VERSION = '0.2';
# @param @func authorizated methods
# @return Lemonldap::NG::Common::CGI::SOAPService object
sub
new
{
my
(
$class
,
$obj
,
@func
)
=
@_
;
s/.*:://
foreach
(
@func
);
return
bless
{
obj
=>
$obj
,
func
=>\
@func
},
$class
;
my
(
$class
,
$obj
,
@func
)
=
@_
;
s/.*:://
foreach
(
@func
);
return
bless
{
obj
=>
$obj
,
func
=>
\
@func
},
$class
;
}
## @method datas AUTOLOAD()
...
...
@@ -29,14 +29,14 @@ sub new {
sub
AUTOLOAD
{
my
$self
=
shift
;
$AUTOLOAD
=~
s/.*:://
;
if
(
grep
{
$_
eq
$AUTOLOAD
}
@
{
$self
->
{
func
}
})
{
if
(
grep
{
$_
eq
$AUTOLOAD
}
@
{
$self
->
{
func
}
}
)
{
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
);
}
return
$tmp
;
}
elsif
(
$AUTOLOAD
ne
'
DESTROY
')
{
elsif
(
$AUTOLOAD
ne
'
DESTROY
'
)
{
die
"
$AUTOLOAD
is not an authorizated function
";
}
1
;
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm
View file @
40d2c706
...
...
@@ -9,7 +9,7 @@ package Lemonldap::NG::Common::Conf;
use
strict
;
no
strict
'
refs
';
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
use
Lemonldap::NG::Common::
Crypto
;
#link protected cipher Object "cypher" in configuration hash
use
Regexp::
Assemble
;
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/CDBI.pm
View file @
40d2c706
...
...
@@ -3,7 +3,7 @@ package Lemonldap::NG::Common::Conf::CDBI;
use
strict
;
use
DBI
;
require
Storable
;
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
our
$VERSION
=
0.1
;
...
...
@@ -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
;
...
...
@@ -107,9 +108,10 @@ sub load {
return
0
;
}
my
$r
;
eval
{
$r
=
Storable::
thaw
(
$row
->
[
1
]);
}
;
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
;
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/File.pm
View file @
40d2c706
package
Lemonldap::NG::Common::Conf::
File
;
use
strict
;
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
use
Lemonldap::NG::Common::Conf::
Serializer
;
our
$VERSION
=
0.23
;
...
...
@@ -74,8 +74,8 @@ sub store {
$self
->
unlock
;
return
UNKNOWN_ERROR
;
}
foreach
my
$k
(
sort
keys
%$fields
)
{
print
FILE
"
$k
\n\t
$fields
->{
$k
}
\n\n
";
foreach
my
$k
(
sort
keys
%$fields
)
{
print
FILE
"
$k
\n\t
$fields
->{
$k
}
\n\n
";
}
close
FILE
;
umask
(
$mask
);
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/LDAP.pm
View file @
40d2c706
...
...
@@ -13,7 +13,7 @@ use Lemonldap::NG::Common::Conf::Serializer;
our
$VERSION
=
0.02
;
BEGIN
{
*
Lemonldap::NG::Common::Conf::
ldap
=
\
&ldap
;
*
Lemonldap::NG::Common::Conf::
ldap
=
\
&ldap
;
}
sub
prereq
{
...
...
@@ -56,7 +56,7 @@ sub lastCfg {
sub
ldap
{
my
$self
=
shift
;
return
$self
->
{
ldap
}
if
(
$self
->
{
ldap
});
return
$self
->
{
ldap
}
if
(
$self
->
{
ldap
}
);
# Parse servers configuration
my
$useTls
=
0
;
...
...
@@ -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
;
}
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/RDBI.pm
View file @
40d2c706
...
...
@@ -119,7 +119,7 @@ sub load {
while
(
@row
=
$sth
->
fetchrow_array
)
{
$res
->
{
$row
[
1
]
}
=
$row
[
2
];
}
unless
(
$res
)
{
unless
(
$res
)
{
$
Lemonldap::NG::Common::Conf::
msg
.=
"
No configuration
$cfgNum
found
";
return
0
;
}
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SAML/Metadata.pm
View file @
40d2c706
...
...
@@ -218,7 +218,7 @@ sub toXML {
# Return this object in configuration string format.
# @return string
sub
toConf
{
my
$self
=
shift
;
my
$self
=
shift
;
my
$fields
=
$self
->
toHash
();
local
$
Data::Dumper::
Indent
=
0
;
local
$
Data::Dumper::
Varname
=
"
data
";
...
...
@@ -233,11 +233,10 @@ sub toConf {
# Return this object in configuration hash format.
# @return hashref
sub
toHash
{
my
$self
=
shift
;
my
$self
=
shift
;
my
$fields
=
();
foreach
(
keys
%$self
)
{
$fields
->
{
$_
}
=
$self
->
{
$_
};
foreach
(
keys
%$self
)
{
$fields
->
{
$_
}
=
$self
->
{
$_
};
}
return
$fields
;
}
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/SOAP.pm
View file @
40d2c706
...
...
@@ -10,7 +10,7 @@ our $VERSION = 0.21;
BEGIN
{
*
Lemonldap::NG::Common::Conf::
_soapCall
=
\
&_soapCall
;
*
Lemonldap::NG::Common::Conf::
_connect
=
\
&_connect
;
*
Lemonldap::NG::Common::Conf::
_connect
=
\
&_connect
;
sub
SOAP
::Transport::HTTP::Client::get_basic_credentials {
return
$
Lemonldap::NG::Common::Conf::SOAP::
username
=>
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Serializer.pm
View file @
40d2c706
...
...
@@ -3,14 +3,14 @@ package Lemonldap::NG::Common::Conf::Serializer;
use
Data::
Dumper
;
BEGIN
{
*
Lemonldap::NG::Common::Conf::
serialize
=
\
&serialize
;
*
Lemonldap::NG::Common::Conf::
serialize
=
\
&serialize
;
*
Lemonldap::NG::Common::Conf::
unserialize
=
\
&unserialize
;
}
sub
serialize
{
my
(
$self
,
$conf
)
=
@_
;
my
$fields
;
local
$
Data::Dumper::
Indent
=
0
;
local
$
Data::Dumper::
Indent
=
0
;
local
$
Data::Dumper::
Varname
=
"
data
";
while
(
my
(
$k
,
$v
)
=
each
(
%$conf
)
)
{
next
if
(
$k
=~
/^(?:reVHosts|cipher)$/
);
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Crypto.pm
View file @
40d2c706
...
...
@@ -66,7 +66,7 @@ sub decrypt {
$msg
=
'';
# Obscure Perl re bug...
$tmp
.=
"
\
0
";
$tmp
.=
"
\
0
";
$tmp
=~
s/\0*$//
;
return
$tmp
;
}
...
...
modules/lemonldap-ng-common/lib/Lemonldap/NG/Common/Safelib.pm
View file @
40d2c706
...
...
@@ -23,7 +23,7 @@ our $functions = [qw(&checkLogonHours &checkDate)];
# @param $default_access optional what result to return for users without logons hours
# @return 1 if access allowed, 0 else
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
# Samba - sambaLogonHours: ???
...
...
@@ -39,29 +39,31 @@ sub checkLogonHours {
# Begin with sunday at 0h00
my
$base2_logon_hours
;
if
(
$syntax
eq
"
octetstring
"
)
{
$base2_logon_hours
=
unpack
("
B*
",
$logon_hours
);
$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
)
);
$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
;
my
$hourpos
=
$wday
*
24
+
$hour
;
# Use time_correction
if
(
$time_correction
)
{
my
(
$sign
,
$time
)
=
(
$time_correction
=~
/([+|-]?)(\d+)/
);
if
(
$sign
=~
/-/
)
{
$hourpos
-=
$time
;
}
else
{
$hourpos
+=
$time
;
}
my
(
$sign
,
$time
)
=
(
$time_correction
=~
/([+|-]?)(\d+)/
);
if
(
$sign
=~
/-/
)
{
$hourpos
-=
$time
;
}
else
{
$hourpos
+=
$time
;
}
}
# 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)
...
...
@@ -71,15 +73,15 @@ sub checkLogonHours {
# @param $default_access optional what result to return for users without start or end start
# @return 1 if access allowed, 0 else
sub
checkDate
{
my
(
$start
,
$end
,
$default_access
)
=
@_
;
my
(
$start
,
$end
,
$default_access
)
=
@_
;
# Get date in string
$start
=
substr
(
$start
,
0
,
14
);
$end
=
substr
(
$end
,
0
,
14
);
$start
=
substr
(
$start
,
0
,
14
);
$end
=
substr
(
$end
,
0
,
14
);
# Default access if no value
$default_access
||=
"
0
";
return
$default_access
unless
(
$start
or
$end
);
return
$default_access
unless
(
$start
or
$end
);
# If no start, set start to 0
$start
||=
0
;
...
...
@@ -88,22 +90,22 @@ 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
);
$mday
=
"
0
"
.
$mday
if
(
$mday
<
10
);
$hour
=
"
0
"
.
$hour
if
(
$hour
<
10
);
$min
=
"
0
"
.
$min
if
(
$min
<
10
);
$sec
=
"
0
"
.
$sec
if
(
$sec
<
10
);
$mon
+=
1
;
$mon
=
"
0
"
.
$mon
if
(
$mon
<
10
);
$mday
=
"
0
"
.
$mday
if
(
$mday
<
10
);
$hour
=
"
0
"
.
$hour
if
(
$hour
<
10
);
$min
=
"
0
"
.
$min
if
(
$min
<
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
;
}
1
;
__END__
...
...
modules/lemonldap-ng-handler/example/MyHandler.pm
View file @
40d2c706
...
...
@@ -7,11 +7,11 @@ __PACKAGE__->init(
# ACCESS TO CONFIGURATION
# By default, Lemonldap::NG uses the default lemonldap-ng.ini file to know
# where to find is configuration
# (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
# You can specify by yourself this file :
#configStorage => { confFile => '/path/to/my/file' },
# By default, Lemonldap::NG uses the default lemonldap-ng.ini file to know
# where to find is configuration
# (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
# You can specify by yourself this file :
#configStorage => { confFile => '/path/to/my/file' },
# You can also specify directly the configuration
# (see Lemonldap::NG::Handler::SharedConf(3))
...
...
modules/lemonldap-ng-handler/example/MyHandlerLog4Perl.pm
View file @
40d2c706
...
...
@@ -20,11 +20,11 @@ __PACKAGE__->init(
# ACCESS TO CONFIGURATION
# By default, Lemonldap::NG uses the default lemonldap-ng.ini file to know
# where to find is configuration
# (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
# You can specify by yourself this file :
#configStorage => { confFile => '/path/to/my/file' },
# By default, Lemonldap::NG uses the default lemonldap-ng.ini file to know
# where to find is configuration
# (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
# You can specify by yourself this file :
#configStorage => { confFile => '/path/to/my/file' },
# You can also specify directly the configuration
# (see Lemonldap::NG::Handler::SharedConf(3))
...
...
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm
View file @
40d2c706
...
...
@@ -25,7 +25,7 @@ our $VERSION = '0.4';
# @return new object
sub
new
{
my
$class
=
shift
;
my
$self
=
$class
->
SUPER::
new
()
or
$class
->
abort
("
Unable to build CGI
");
my
$self
=
$class
->
SUPER::
new
()
or
$class
->
abort
("
Unable to build CGI
");
$
Lemonldap::NG::Handler::_CGI::
_cgi
=
$self
;
unless
(
$
Lemonldap::NG::Handler::_CGI::
cookieName
)
{
Lemonldap::NG::Handler::
_CGI
->
init
(
@
_
);
...
...
@@ -216,9 +216,9 @@ sub grant {
$vhost
||=
$ENV
{
SERVER_NAME
};
$apacheRequest
=
Lemonldap::NG::Apache::
Request
->
new
(
{
uri
=>
$uri
,
hostname
=>
$vhost
,
args
=>
'',
uri
=>
$uri
,
hostname
=>
$vhost
,
args
=>
'',
}
);
for
(
my
$i
=
0
;
$i
<
$locationCount
->
{
$vhost
}
;
$i
++
)
{
...
...
@@ -240,7 +240,7 @@ package Lemonldap::NG::Apache::Request;
sub
new
{
my
$class
=
shift
;
my
$self
=
shift
;
my
$self
=
shift
;
return
bless
$self
,
$class
;
}
...
...
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/SharedConf.pm
View file @
40d2c706
...
...
@@ -19,11 +19,12 @@ use strict;
use
Lemonldap::NG::Handler::
Simple
qw(:all)
;
use
Lemonldap::NG::Handler::
Vhost
;
use
Lemonldap::NG::Common::
Conf
;
#link protected lmConf
use
Lemonldap::NG::Common::Conf::
Constants
;
#inherits
use
Lemonldap::NG::Common::
Conf
;
#link protected lmConf
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
);
...
...
@@ -91,8 +93,8 @@ sub localInit {
Lemonldap::NG::Common::
Conf
->
new
(
$args
->
{
configStorage
}
)
);
# Get local configuration parameters
my
$localconf
=
$lmConf
->
getLocalConf
(
HANDLERSECTION
);
if
(
$localconf
)
{
my
$localconf
=
$lmConf
->
getLocalConf
(
HANDLERSECTION
);
if
(
$localconf
)
{
$args
->
{
$_
}
||=
$localconf
->
{
$_
}
foreach
(
keys
%$localconf
);
}
...
...
modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Status.pm
View file @
40d2c706
...
...
@@ -9,7 +9,7 @@ use Data::Dumper;
#inherits Cache::Cache
our
$VERSION
=
"
0.21
";
our
$VERSION
=
"
0.21
";
our
$status
=
{};
our
$activity
=
[]
;
...
...
@@ -142,86 +142,86 @@ sub run {
}
else
{
# Total requests
print
"
<h2>Total</h2>
\n
<div id=
\"
total
\"
><pre>
\n
";
print
sprintf
(
"
%-30s :
\
%6d (%.02f / mn)
\n
",
$_
,
$c
->
{
$_
},
$c
->
{
$_
}
/
$mn
)
foreach
(
sort
keys
%$c
);
print
"
\n
</pre></div>
\n
";
# Average
print
"
<h2>Average for last
"
.
MN_COUNT
.
"
minutes</h2>
\n
<div id=
\"
average
\"
><pre>
\n
";
print
sprintf
(
"
%-30s : %6s / mn
\n
",
$_
,
$m
->
{
$_
}
)
foreach
(
sort
keys
%$m
);
print
"
\n
</pre></div>
\n
";
# Users connected
print
"
<div id=
\"
users
\"
><p>
\n
Total users :
$u
\n
</p></div>
\n
";
# Local cache
my
@t
=
# Total requests
print
"
<h2>Total</h2>
\n
<div id=
\"
total
\"
><pre>
\n
";
print
sprintf
(
"
%-30s :
\
%6d (%.02f / mn)
\n
",
$_
,
$c
->
{
$_
},
$c
->
{
$_
}
/
$mn
)
foreach
(
sort
keys
%$c
);
print
"
\n
</pre></div>
\n
";
# Average
print
"
<h2>Average for last
"
.
MN_COUNT
.
"
minutes</h2>
\n
<div id=
\"
average
\"
><pre>
\n
";
print
sprintf
(
"
%-30s : %6s / mn
\n
",
$_
,
$m
->
{
$_
}
)
foreach
(
sort
keys
%$m
);
print
"
\n
</pre></div>
\n
";
# Users connected
print
"
<div id=
\"
users
\"
><p>
\n
Total users :
$u
\n
</p></div>
\n
";
# Local cache
my
@t
=
$refLocalStorage
->
get_keys
(
$localStorageOptions
->
{
namespace
}
);
print
"
<div id=
\"
cache
\"
><p>
\n
Local Cache :
"
.
@t
.
"
objects
\n
</p></div>
\n
";
print
"
<div id=
\"
cache
\"
><p>
\n
Local Cache :
"
.
@t
.
"
objects
\n
</p></div>
\n
";
# Uptime
print
"
<div id=
\"
up
\"
><p>
\n
Server up for :
"
.
&timeUp
(
$mn
)
.
"
\n
</p></div>
\n
";
# Top uri
if
(
$args
->
{
top
}
)
{
print
"
<hr/>
\n
";
# Top uri
if
(
$args
->
{
top
}
)
{
print
"
<hr/>
\n
";
$args
->
{
categories
}
||=
'
REJECT,PORTAL_FIRSTACCESS,LOGOUT,OK
';
# Vhost activity
print
# Vhost activity
print
"
<h2>Virtual Host activity</h2>
\n
<div id=
\"
vhost
\"
><pre>
\n
";
foreach
(
sort
{
$count
->
{
vhost
}
->
{
$b
}
<=>
$count
->
{
vhost
}
->
{
$a
}
}
keys
%
{
$count
->
{
vhost
}
}
)
{
foreach
(
sort
{
$count
->
{
vhost
}
->
{
$b
}
<=>
$count
->
{
vhost
}
->
{
$a
}
}
keys
%
{
$count
->
{
vhost
}
}
)
{
print
sprintf
(
"
%-40s : %6d
\n
",
$_
,
$count
->
{
vhost
}
->
{
$_
}
);
}
print
"
\n
</pre></div>
\n
";
# General
print
"
<h2>Top used URI</h2>
\n
<div id=
\"
uri
\"
><pre>
\n
";
my
$i
=
0
;
foreach
(
sort
{
$count
->
{
uri
}
->
{
$b
}
<=>
$count
->
{
uri
}
->
{
$a
}
}
keys
%
{
$count
->
{
uri
}
}
)
{
last
if
(
$i
==
$args
->
{
top
}
);
last
unless
(
$count
->
{
uri
}
->
{
$_
}
);
$i
++
;
}
print
"
\n
</pre></div>
\n
";
# General
print
"
<h2>Top used URI</h2>
\n
<div id=
\"
uri
\"
><pre>
\n
";
my
$i
=
0
;
foreach
(
sort
{
$count
->
{
uri
}
->
{
$b
}
<=>
$count
->
{
uri
}
->
{
$a
}
}