Bug 218353

Summary: LDAP directory contacts cannot be modified
Product: [Applications] kdepimlibs Reporter: rdratlos
Component: kldapAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 4.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch for kdepimlibs

Description rdratlos 2009-12-12 04:04:32 UTC
Version:            (using KDE 4.3.2)
OS:                Linux
Installed from:    Ubuntu Packages

I tested kaddressbook (4.3) as front-end to manage contacts in a LDAP directory
(addressbook). The server runs openldap 2.4. 

kaddressbook perfectly adds and deletes contacts. 

But it fails to modify attribute values of a contact within the LDAP directory.
After changing e. g. the facsimile number of a contact, kaddressbook shows the
updated number but the new number is not saved in the LDAP directory. OpenLDAP
reports following failure: 'value #0 invalid per syntax'. 

kaddressbook uses kdepimlibs for communication with the LDAP server. kdepimlibs use the modify->replace operation of the LDAP protocol for modification of attribute values. In case of empty attributes (especially numbers) kdepimlibs does not comply to IETF RFC 2849. After the replace <attribute name> statement kdepimlibs adds an empty line before end of operation ('-'). When parsing such a request, the LDAP server reports the above mentioned error notification and denies the complete modification request. kaddressbook does not report this problem to the user.
Comment 1 rdratlos 2009-12-12 04:18:02 UTC
Correction:
kdepimlibs does not add an empty line but the attribute name without a value. This is not allowed by RFC 2849.
Comment 2 rdratlos 2009-12-12 04:27:15 UTC
Created attachment 39004 [details]
Patch for kdepimlibs

proposed patch
Comment 3 rdratlos 2009-12-12 04:28:12 UTC
There seems to be a simple fix for this problem. The kabc plugin ldapkio within kdepimlibs has a private addEntry method that can be changed to solve this bug. It resides in the file resourceldapkio.cpp.

The addEntry method should check itself (again), if the calling function has handed over a value for a particular attribute or not. If not, the attribute name should not be added (and afterwards sent to the LDAP directory). This applies for modification (i. e. replace) operations and add operations.

I've tested this solution under Ubuntu karmic and it works fine. Attribute values can be added, modified and deleted again. Attached there is the patch I've applied. 

I have not identified further side-effects of this patch. But I recommed some further testing.
Comment 4 Allen Winter 2009-12-13 16:20:07 UTC
SVN commit 1062016 by winterz:

Fix "LDAP directory contents cannot be modified"
Thanks to the patch from rdratlos@yahoo.co.uk

BUG: 218353
MERGE: 4.3,e4



 M  +3 -1      resourceldapkio.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1062016
Comment 5 Allen Winter 2009-12-13 18:12:45 UTC
SVN commit 1062059 by winterz:

Backport r1062016 by winterz from trunk to the 4.3 branch:

Fix "LDAP directory contents cannot be modified"
Thanks to the patch from rdratlos@yahoo.co.uk

CCBUG: 218353
MERGE: 4.3,e4




 M  +3 -1      resourceldapkio.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1062059