[Bug 384157] [NEW] phpldapadmin fatal error renaming cn

Edwin Fine emofine at usa.net
Sat Jun 6 00:14:05 UTC 2009


Public bug reported:

Binary package hint: phpldapadmin

Ubuntu release: 9.04
phpLDAPAdmin version: 1.1.0.5-6ubuntu3

This bug occurs when attempting to rename a cn entry when the only
difference between the old and new cn entry is in capitalization. It's
easy to reproduce: just try to rename a cn for (say) an inetOrgPerson by
only changing the spelling (e.g. JohnMclean to JohnMcLean), and you
should see this:

Fatal error: Call to a member function rename() on a non-object in
/usr/share/phpldapadmin/lib/Tree.php on line 171

Line 171 of this file is as follows:

166: $olddnlower = $this->indexDN($oldDn);
167:	$newdnlower = $this->indexDN($newDn);
168:
169: $this->entries[$newdnlower] = $this->entries[$olddnlower];
170: unset($this->entries[$olddnlower]);
171: $this->entries[$newdnlower]->rename($newDn); // Fatal error

The problem is in line 170.

Let's say the cn was JohnMclean, and we wanted to change it to
JohnMcLean (uppercase '"L"). When the old and new names are both
lowercased in lines 166 and 167, the code that is executed is
effectively this:

unset($this->entries["johnmclean"]);
this->entries["johnmclean"]->rename("JohnMcLean"); // We just unset this very entry - BOOM

The fix is obviously not to unset the variable if old and new names are
equal when lowercased. Fixed code (works now, tested with same name,
different name, change only in spelling) is:

169: $this->entries[$newdnlower] = $this->entries[$olddnlower];
***:   if ($olddnlower != $newdnlower)
170:       unset($this->entries[$olddnlower]);
171: $this->entries[$newdnlower]->rename($newDn);

** Affects: phpldapadmin (Ubuntu)
     Importance: Undecided
         Status: New

-- 
phpldapadmin fatal error renaming cn
https://bugs.launchpad.net/bugs/384157
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list