• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7509: LdapContrib 2014-05-21 shortcomings

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension LdapContrib Normal Closed   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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

ItemTemplate
Summary LdapContrib 2014-05-21 shortcomings
ReportedBy TWiki:Main.HideyoImazu
Codebase ~twiki4
SVN Range TWiki-6.0.1-trunk, Fri, 23 May 2014, build 27512
AppliesTo Extension
Component LdapContrib
Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:27612
TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r5 - 2014-08-03 - TerjeAndersen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback