Net::LDAP::Control::PasswordPolicy is not always loaded
Concerned version
Version: %2.0.13
Platform: Apache
Summary
Sometimes, when authenticating to the portal, we get an Internal Server Error if passwordpolicy control is enabled.
In the logs we get:
[Tue Sep 21 10:11:13.096547 2021] [fcgid:warn] [pid 17288] [client ::1:41020] mod_fcgid: stderr: Can't locate object method "new" via package "Net::LDAP::Control::PasswordPolicy" at /usr/share/perl5/Lemonldap/NG/Portal/Lib/Net/LDAP.pm line 197., referer: https://auth.domain.com/
Here is the corresponding file, it seems that before new(), the package is not loaded:
## @method protected int userBind(string dn, hash args)
# Call bind() with dn/password and return
# @param $dn LDAP distinguish name
# @param %args See Net::LDAP(3) manpage for more
# @return Lemonldap::NG portal error code
sub userBind {
my $self = shift;
my $req = shift;
if ( $self->{conf}->{ldapPpolicyControl} ) {
# Create Control object
my $pp = Net::LDAP::Control::PasswordPolicy->new();
Need more investigation to understand why it is not correctly loaded.