If the ldap driver is not valid, the error messages were not printed.
There was just "Couldn't contact LDAP server for authentication" - But
why?
This commit adds a print loop for all messages from the global
$c->messages message array.
As I could see at other locations in the code, the ldap driver instance
can be invalid. And if the instance is invalid, the getStaticLdap()
function gets called again. Caching would prevent the function from
retrying to initiate the ldapDrivers object.
This commit adds conditional caching: only if the ldap driver instance is
valid, the object gets cached. This ensures that a retry with this function
would really try to create a new ldapDrivers object and not simply
return the (invalid) cached one.
There was already a variable to cache the ldap driver instance, and a
check if this variable was already set was there, too! But there was no
code to return the cached instance if the function gets called twice!
Maybe this was simply forgotten...
* In places where the CGI variable REMOTE_USER is read, support alternatively
REDIRECT_REMOTE_USER, which is used by the Apache HTTPD Server instead, when a
redirect was used.
Note: This alone is not enough yet, to fully support it in DAViCal. An analogous
change (commit 29ddd89baaf65bda2560e51665a2e761abef4147) is necessary in
AWL.
* Changed the end-of-line encodings of all non-Windows-related and non-autogenerated text files to use UNIX LF (lots of them had mixed LF/CRLF).
Conflicts:
inc/caldav-PUT-functions.php
This fixes a bug in the Principal class when updating where
fields are set on the principal, but are not being updated and
end up getting set to NULL as a result.
This is a significant refactoring, replacing the old getUserBy*()
functions with a new Principal class, and replacing the old
CalDAVPrincipal class with a new DAVPrincipal class which extends
the Principal class.
At this point all regression tests pass (again) but there could
well be issues for people who use alternative authenticators
such as LDAP, although I have endeavoured to resolve those
potential issues.
Signed-off-by: Andrew McMillan <andrew@morphoss.com>