Core: only try local auth if a user has the "database" auth provider set
authorBen Rosser <rosser.bjr@gmail.com>
Thu, 7 Feb 2019 19:47:50 +0000 (14:47 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 31 May 2019 14:54:43 +0000 (16:54 +0200)
commit8efbb2ef22f5f007b5dc6d5b15ecf070ccef08ca
tree6cf6912b6cedf18df85ebf68c569aa56b516ebe4
parentdd1d9d68c406b993230161208cbd17db55dc85a9
Core: only try local auth if a user has the "database" auth provider set

This commit attempts to resolve issue #1501; currently, quassel will
always attempt to do local authentication, and *then* try LDAP auth. This
makes it difficult to migrate a core from local auth to LDAP auth; users
who have local passwords can always use those passwords to log in, and there
is not a simple way to migrate them to non-local auth.

There is an "authenticator" column in the database for each user, but it
is currently only used to stop passwords from being changed for LDAP users.
This commit modifies the login flow to first check that database field--
if authenticator is not "Database", we don't try local authentication and
proceed directly to non-local authentication.

This is a bit clumsy-- I added a method to the core to look up a user's
authenticator by string. But there's no way to map that to the actual
authenticator object, because we only store one configured authenticator
per core-- so we then just check if that authenticator is "Database" or
not. I think this is something that should be improved in the future,
but as a quick fix to #1501 this is probably good enough.
src/core/core.h
src/core/coreauthhandler.cpp