Bug 28587 - ldap auth fails unless <ldapserver id="ldapserver">
Summary: ldap auth fails unless <ldapserver id="ldapserver">
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Authentication (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 28385
Blocks:
  Show dependency treegraph
 
Reported: 2021-06-17 16:30 UTC by Jerry Marceau
Modified: 2021-06-23 13:32 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerry Marceau 2021-06-17 16:30:21 UTC
This is related/similar to bug 28385.  Apologies if this should be posted there instead.  The fix there only works if ldapserver id is set to "ldapserver" and not anything else (such as <ldapserver id="ad.domain.com">).  In previous versions ldapserver id could be set to anything.  There is nothing in the release notes noting this behavior change so it seems to be a bug.  

To reproduce simply set ldapserver id to something else and restart plack.  There should be lots of errors in the plack-error.log, most useful is:

No ldapserver "hostname" defined in KOHA_CONF: /etc/koha/sites/instance/koha-conf.xml

The problem is in Auth_with_ldap.pm, specifically:

if ( exists $ldap->{ldapserver} ) {
    $ldap = $ldap->{ldapserver}   or die ldapserver_error('id="ldapserver"');
}

The code is assuming the id is "ldapserver".  Better behavior would be to evaluate $ldap and find what the id is set to.  It should be the only key in $ldap, and then do:

$ldap=$ldap->{$ldapserveridname}

The easy fix is just to set the id to ldapserver, but again, that isn't documented anywhere.  I can probably provide a patch in in the next few days.
Comment 1 Dobrica Pavlinusic 2021-06-17 19:13:11 UTC
Thanks for reporting this. My proposed fix for this is in comment 7
on original bug:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28385#c7

POD documentation in C4::Auth_with_ldap does suggest that id should
be ldapserver, so I made assumption that all configurations will have it,
which in retrospect seems to be incorrect.
Comment 2 David Cook 2021-06-17 23:32:37 UTC
(This is a totally unrealted tangent but curious how the University of New Hampshire uses Koha! Doesn't seem to be for the university library?)
Comment 3 Jerry Marceau 2021-06-21 14:50:45 UTC
For Dobrica - thanks for the response.  It doesn't really matter to me if this gets 'fixed' or not - I put the bug in so other people could find it if they had the same situation.  Making the change in koha-conf.xml is trivial.  

You're right that the documentation has id="ldapserver", but I don't think it is clear that it has to be set that way.  I read the id="ldapserver" as variable - you'd set this to whatever you wanted to call your ldapserver (in our case the short server name).  This seems to fit better with HTML and XML in general - you wouldn't have <div id="div">, you'd want the ID to be unique to set it apart.  But in this case there aren't going to be multiple ldapservers, so maybe it doesn't matter.  

David - you're right - it is not for the main/official libraries.  We have a few 'media lab' spaces that circulate AV gear - still and video cameras, microphones, etc.  They found the library's system (millennium, I think) didn't work well for this sort of equipment.  They did the research and settled on Koha - it has worked well for them and hasn't been too much work for me as an administrator.