[Koha-bugs] [Bug 16719] New: LDAP: Using empty strings as 'failsafe' attribute mapping defeats database constraints

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 13 15:45:43 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16719

            Bug ID: 16719
           Summary: LDAP: Using empty strings as 'failsafe' attribute
                    mapping defeats database constraints
 Change sponsored?: ---
           Product: Koha
           Version: 3.22
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: Authentication
          Assignee: gmcharlt at gmail.com
          Reporter: oliver.bock at aei.mpg.de
        QA Contact: testopia at bugs.koha-community.org
                CC: dpavlin at rot13.org

Created attachment 52316
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52316&action=edit
Patch: proper NULL mapping

LDAP attributes with empty values are currently mapped as empty strings, which
is described as 'failsafe'. This defeats the existing database constraints
(NULL and UNIQUE) without an apparent need. If some kind of empty default is
required, it should be set in the mapping config itself, not the code.

Please note that this is not just a semantic issue since mapping empty LDAP
values as an empty string does indeed cause a constraint violation (read:
database error, hence our severity) when such an attribute bears a UNIQUE
constraint. This is due to the fact that an empty string is an actual value
validated by the constraint (NULL isn't).

I don't know the reasoning behind the empty-string mapping but should a
NULL-mapping have been the original intention then please note that this
behavior is database-dependent. The correct way to map NULL in a
database-agnostic way is to use "undef" (see my patch).

Thanks

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list