2014-05-21 version of
LdapContrib has following problems:
-
TWiki::Contrib::LdapContrib::getLdapContrib()
assumes it is used only for UserMappingManager or PasswordManager. There are cases where LdapContrib is used only for LdapNgPlug doing LDAP queries without doing anything else
-
TWiki::Contrib::LdapContrib::new()
- forcing
$this->{userBase}
and $this->{groupBase}
to make array reference is wrong. At least with Net::LDAP version 0.43, it causes an error
- If
$TWiki::cfg{Ldap}Prefcase}
is set 0, it's regarded as 'all'
- It's causing warning at
if ($this->{preCache} == 1) {
--
TWiki:Main/HideyoImazu
- 2014-06-06
Hi there,
If
{userBase}
and
{groupBase}
are not changed from a string to an array reference, the following error will occur:
Can't use string ("OU=Users,DC=example,DC=com") as an ARRAY ref while "strict refs" in use at /twiki/lib/TWiki/Contrib/LdapContrib.pm line 1058, <DATA> line 522.
This happens if the
{UserBase}
and
{GroupBase}
are string values in
/lib/LocalSite.cfg
:
$TWiki::cfg{Ldap}{UserBase} = 'OU=Users,DC=example,DC=com';
$TWiki::cfg{Ldap}{GroupBase} = 'OU=groups,DC=example,DC=com';
This is the case if a user upgrades his LdapContrib installation from a version not supporting multiple user bases.
Upgrading LdapContrib will
not change the preference values to the new format (from String to Array), and the error will occur.
This is line 1058 of TWiki::Contrib::LdapContrib:
for my $userBase (@{$this->{userBase}}) {
How about this for a solution:
# Prevent using string as array ref in case $this->{userBase} is a string. (Legacy)
my @userBases = ref $this->{userBase} eq 'ARRAY' ? @{$this->{userBase}} : $this->{userBase};
for my $userBase (@userBases) {
Similar logic will have to be applied to line 595, 1309, 3528 as well.
What do you think?
--
TWiki:Main.TerjeAndersen
- 2014-08-03