ldap: Some cleanups for GH-170
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 19 Oct 2016 21:17:47 +0000 (23:17 +0200)
committerBen Rosser <rosser.bjr@gmail.com>
Sat, 27 May 2017 18:01:06 +0000 (14:01 -0400)
Mostly formatting and a few other bits.

CMakeLists.txt
src/core/authenticator.cpp
src/core/authenticator.h
src/core/core.cpp
src/core/coreauthhandler.cpp
src/core/coresettings.cpp
src/core/ldapauthenticator.cpp
src/core/ldapauthenticator.h
src/core/sqlauthenticator.cpp
src/core/sqlauthenticator.h
src/qtui/coreconfigwizard.cpp

index d527ee6..2e74374 100644 (file)
@@ -136,7 +136,7 @@ endif()
 # List of authenticators and the cmake flags to build them
 # (currently that's just LDAP, but more can be added here).
 ####################################################################
 # List of authenticators and the cmake flags to build them
 # (currently that's just LDAP, but more can be added here).
 ####################################################################
-option(WITH_LDAP     "Enable LDAP authentication support if present on system"  ON)
+option(WITH_LDAP "Enable LDAP authentication support if present on system" ON)
 
 # Setup CMake
 #####################################################################
 
 # Setup CMake
 #####################################################################
@@ -521,20 +521,18 @@ endif()
 
 # Setup LDAP Authentication support.
 #####################################################################
 
 # Setup LDAP Authentication support.
 #####################################################################
-if(WITH_LDAP)
+if (WITH_LDAP)
     find_package(Ldap)
     find_package(Ldap)
-    if(LDAP_FOUND)
+    if (LDAP_FOUND)
         message(STATUS "Enabling LDAP authentication support")
         set(HAVE_LDAP true)
         message(STATUS "Enabling LDAP authentication support")
         set(HAVE_LDAP true)
-        if(HAVE_LDAP)
-            add_definitions(-DHAVE_LDAP)
-        endif(HAVE_LDAP)
-    else(LDAP_FOUND)
+        add_definitions(-DHAVE_LDAP)
+    else()
         message(STATUS "Disabling LDAP authentication support")
         message(STATUS "Disabling LDAP authentication support")
-    endif(LDAP_FOUND)
-else(WITH_LDAP)
+    endif()
+else()
     message(STATUS "Not enabling LDAP authentication support")
     message(STATUS "Not enabling LDAP authentication support")
-endif(WITH_LDAP)
+endif()
 
 # Setup KDE / KDE Frameworks
 #####################################################################
 
 # Setup KDE / KDE Frameworks
 #####################################################################
index fa52b62..21b6e48 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2016 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
index ce8a42a..97091ef 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2016 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef AUTHENTICATOR_H
-#define AUTHENTICATOR_H
+#pragma once
 
 
-#include <QtCore>
+#include <QObject>
+#include <QString>
+#include <QStringList>
+#include <QVariant>
 
 #include "types.h"
 
 
 #include "types.h"
 
@@ -34,9 +36,9 @@ public:
     virtual ~Authenticator() {};
 
     enum State {
     virtual ~Authenticator() {};
 
     enum State {
-        IsReady,        // ready to go
-        NeedsSetup,        // need basic setup (ask the user for input)
-        NotAvailable     // remove the authenticator backend from the list of avaliable authenticators.
+        IsReady,      // ready to go
+        NeedsSetup,   // need basic setup (ask the user for input)
+        NotAvailable  // remove the authenticator backend from the list of avaliable authenticators.
     };
 
 
     };
 
 
@@ -91,5 +93,3 @@ public slots:
 private:
 
 };
 private:
 
 };
-
-#endif
index 6ad6702..ec19aaa 100644 (file)
@@ -317,7 +317,7 @@ QString Core::setupCore(const QString &adminUser, const QString &adminPassword,
         return tr("Could not setup storage!");
     }
 
         return tr("Could not setup storage!");
     }
 
-    quInfo() << "Selected authenticator: " << authenticator;
+    quInfo() << "Selected authenticator:" << authenticator;
     if (!(_configured = initAuthenticator(authenticator, authSetupData, true)))
     {
         return tr("Could not setup authenticator!");
     if (!(_configured = initAuthenticator(authenticator, authSetupData, true)))
     {
         return tr("Could not setup authenticator!");
@@ -372,6 +372,7 @@ bool Core::registerStorageBackend(Storage *backend)
     }
 }
 
     }
 }
 
+
 void Core::unregisterStorageBackends()
 {
     foreach(Storage *s, _storageBackends.values()) {
 void Core::unregisterStorageBackends()
 {
     foreach(Storage *s, _storageBackends.values()) {
@@ -397,30 +398,31 @@ void Core::registerAuthenticators()
 #ifdef HAVE_LDAP
     registerAuthenticator(new LdapAuthenticator(this));
 #endif
 #ifdef HAVE_LDAP
     registerAuthenticator(new LdapAuthenticator(this));
 #endif
-
 }
 
 }
 
+
 bool Core::registerAuthenticator(Authenticator *authenticator)
 {
 bool Core::registerAuthenticator(Authenticator *authenticator)
 {
-    if (authenticator->isAvailable())
-    {
+    if (authenticator->isAvailable()) {
         _authenticators[authenticator->backendId()] = authenticator;
         return true;
         _authenticators[authenticator->backendId()] = authenticator;
         return true;
-    } else {
+    }
+    else {
         authenticator->deleteLater();
         return false;
     }
 }
 
         authenticator->deleteLater();
         return false;
     }
 }
 
+
 void Core::unregisterAuthenticators()
 {
 void Core::unregisterAuthenticators()
 {
-    foreach(Authenticator* a, _authenticators.values())
-    {
+    foreach(Authenticator* a, _authenticators.values()) {
         a->deleteLater();
     }
     _authenticators.clear();
 }
 
         a->deleteLater();
     }
     _authenticators.clear();
 }
 
+
 void Core::unregisterAuthenticator(Authenticator *backend)
 {
     _authenticators.remove(backend->backendId());
 void Core::unregisterAuthenticator(Authenticator *backend)
 {
     _authenticators.remove(backend->backendId());
@@ -506,6 +508,7 @@ bool Core::initAuthenticator(const QString &backend, const QVariantMap &settings
     return true;
 }
 
     return true;
 }
 
+
 void Core::syncStorage()
 {
     if (_storage)
 void Core::syncStorage()
 {
     if (_storage)
@@ -790,6 +793,7 @@ QVariantList Core::backendInfo()
     return backends;
 }
 
     return backends;
 }
 
+
 QVariantList Core::authenticatorInfo()
 {
     QVariantList backends;
 QVariantList Core::authenticatorInfo()
 {
     QVariantList backends;
@@ -925,9 +929,9 @@ bool Core::selectAuthenticator(const QString &backend)
         saveAuthenticatorSettings(backend, settings);
         qWarning() << "Switched auth backend to:" << qPrintable(backend);
     }
         saveAuthenticatorSettings(backend, settings);
         qWarning() << "Switched auth backend to:" << qPrintable(backend);
     }
-    
+
     _authenticator = authenticator;
     _authenticator = authenticator;
-       return true;
+    return true;
 }
 
 
 }
 
 
@@ -981,8 +985,7 @@ bool Core::changeUserPass(const QString &username)
         return false;
     }
 
         return false;
     }
 
-    if (!canChangeUserPassword(userId))
-    {
+    if (!canChangeUserPassword(userId)) {
         out << "User " << username << " is configured through an auth provider that has forbidden manual password changing." << endl;
         return false;
     }
         out << "User " << username << " is configured through an auth provider that has forbidden manual password changing." << endl;
         return false;
     }
@@ -1038,17 +1041,18 @@ bool Core::changeUserPassword(UserId userId, const QString &password)
 bool Core::canChangeUserPassword(UserId userId)
 {
     QString authProvider = instance()->_storage->getUserAuthenticator(userId);
 bool Core::canChangeUserPassword(UserId userId)
 {
     QString authProvider = instance()->_storage->getUserAuthenticator(userId);
-    if (authProvider != "Database")
-    {
+    if (authProvider != "Database") {
         if (authProvider != instance()->_authenticator->backendId()) {
             return false;
         if (authProvider != instance()->_authenticator->backendId()) {
             return false;
-        } else if (instance()->_authenticator->canChangePassword()) {
+        }
+        else if (instance()->_authenticator->canChangePassword()) {
             return false;
         }
     }
     return true;
 }
 
             return false;
         }
     }
     return true;
 }
 
+
 AbstractSqlMigrationReader *Core::getMigrationReader(Storage *storage)
 {
     if (!storage)
 AbstractSqlMigrationReader *Core::getMigrationReader(Storage *storage)
 {
     if (!storage)
@@ -1089,6 +1093,7 @@ bool Core::saveBackendSettings(const QString &backend, const QVariantMap &settin
     return s.sync();
 }
 
     return s.sync();
 }
 
+
 void Core::saveAuthenticatorSettings(const QString &backend, const QVariantMap &settings)
 {
     QVariantMap dbsettings;
 void Core::saveAuthenticatorSettings(const QString &backend, const QVariantMap &settings)
 {
     QVariantMap dbsettings;
@@ -1154,9 +1159,9 @@ QVariantMap Core::promptForSettings(const Storage *storage)
     QStringList keys = storage->setupKeys();
     QVariantMap defaults = storage->setupDefaults();
     return Core::promptForSettings(keys, defaults);
     QStringList keys = storage->setupKeys();
     QVariantMap defaults = storage->setupDefaults();
     return Core::promptForSettings(keys, defaults);
-    
 }
 
 }
 
+
 QVariantMap Core::promptForSettings(const Authenticator *authenticator)
 {
     QStringList keys = authenticator->setupKeys();
 QVariantMap Core::promptForSettings(const Authenticator *authenticator)
 {
     QStringList keys = authenticator->setupKeys();
index c7251cf..6f454fa 100644 (file)
@@ -174,8 +174,7 @@ void CoreAuthHandler::handle(const RegisterClient &msg)
     QVariantList backends;
     QVariantList authenticators;
     bool configured = Core::isConfigured();
     QVariantList backends;
     QVariantList authenticators;
     bool configured = Core::isConfigured();
-    if (!configured)
-    {
+    if (!configured) {
         backends = Core::backendInfo();
         authenticators = Core::authenticatorInfo();
     }
         backends = Core::backendInfo();
         authenticators = Core::authenticatorInfo();
     }
@@ -200,8 +199,7 @@ void CoreAuthHandler::handle(const SetupData &msg)
     // Maybe this should be hardcoded elsewhere, i.e. as a define.
     QString authenticator = msg.authenticator;
     quInfo() << "[" << authenticator << "]";
     // Maybe this should be hardcoded elsewhere, i.e. as a define.
     QString authenticator = msg.authenticator;
     quInfo() << "[" << authenticator << "]";
-    if (authenticator.trimmed().isEmpty() || authenticator == 0)
-    {
+    if (authenticator.trimmed().isEmpty()) {
         authenticator = QString("Database");
     }
 
         authenticator = QString("Database");
     }
 
@@ -221,8 +219,7 @@ void CoreAuthHandler::handle(const Login &msg)
     // First attempt local auth using the real username and password.
     // If that fails, move onto the auth provider.
     UserId uid = Core::validateUser(msg.user, msg.password);
     // First attempt local auth using the real username and password.
     // If that fails, move onto the auth provider.
     UserId uid = Core::validateUser(msg.user, msg.password);
-    if (uid == 0)
-    {
+    if (uid == 0) {
         uid = Core::authenticateUser(msg.user, msg.password);
     }
 
         uid = Core::authenticateUser(msg.user, msg.password);
     }
 
index 45d9f67..11888ab 100644 (file)
@@ -43,11 +43,13 @@ QVariant CoreSettings::storageSettings(const QVariant &def)
     return localValue("StorageSettings", def);
 }
 
     return localValue("StorageSettings", def);
 }
 
+
 QVariant CoreSettings::authSettings(const QVariant &def)
 {
     return localValue("AuthSettings", def);
 }
 
 QVariant CoreSettings::authSettings(const QVariant &def)
 {
     return localValue("AuthSettings", def);
 }
 
+
 void CoreSettings::setAuthSettings(const QVariant &data)
 {
     setLocalValue("AuthSettings", data);
 void CoreSettings::setAuthSettings(const QVariant &data)
 {
     setLocalValue("AuthSettings", data);
index 240e0ea..d79ebf1 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2016 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -50,8 +50,7 @@ LdapAuthenticator::LdapAuthenticator(QObject *parent)
 
 LdapAuthenticator::~LdapAuthenticator()
 {
 
 LdapAuthenticator::~LdapAuthenticator()
 {
-    if (_connection != 0)
-    {
+    if (_connection != 0) {
         ldap_unbind_ext(_connection, 0, 0);
     }
 }
         ldap_unbind_ext(_connection, 0, 0);
     }
 }
@@ -63,6 +62,7 @@ bool LdapAuthenticator::isAvailable() const
     return true;
 }
 
     return true;
 }
 
+
 QString LdapAuthenticator::backendId() const
 {
     // We identify the backend to use for the monolithic core by its displayname.
 QString LdapAuthenticator::backendId() const
 {
     // We identify the backend to use for the monolithic core by its displayname.
@@ -71,6 +71,7 @@ QString LdapAuthenticator::backendId() const
     return QString("LDAP");
 }
 
     return QString("LDAP");
 }
 
+
 QString LdapAuthenticator::description() const
 {
     return tr("Authenticate users using an LDAP server.");
 QString LdapAuthenticator::description() const
 {
     return tr("Authenticate users using an LDAP server.");
@@ -90,6 +91,7 @@ QStringList LdapAuthenticator::setupKeys() const
     return keys;
 }
 
     return keys;
 }
 
+
 QVariantMap LdapAuthenticator::setupDefaults() const
 {
     QVariantMap map;
 QVariantMap LdapAuthenticator::setupDefaults() const
 {
     QVariantMap map;
@@ -99,6 +101,7 @@ QVariantMap LdapAuthenticator::setupDefaults() const
     return map;
 }
 
     return map;
 }
 
+
 void LdapAuthenticator::setConnectionProperties(const QVariantMap &properties)
 {
     _hostName = properties["Hostname"].toString();
 void LdapAuthenticator::setConnectionProperties(const QVariantMap &properties)
 {
     _hostName = properties["Hostname"].toString();
@@ -117,8 +120,7 @@ void LdapAuthenticator::setConnectionProperties(const QVariantMap &properties)
 UserId LdapAuthenticator::validateUser(const QString &username, const QString &password)
 {
     bool result = ldapAuth(username, password);
 UserId LdapAuthenticator::validateUser(const QString &username, const QString &password)
 {
     bool result = ldapAuth(username, password);
-    if (!result)
-    {
+    if (!result) {
         return UserId();
     }
 
         return UserId();
     }
 
@@ -127,18 +129,17 @@ UserId LdapAuthenticator::validateUser(const QString &username, const QString &p
     // Users created via LDAP have empty passwords, but authenticator column = LDAP.
     // On the other hand, if auth succeeds and the user already exists, do a final
     // cross-check to confirm we're using the right auth provider.
     // Users created via LDAP have empty passwords, but authenticator column = LDAP.
     // On the other hand, if auth succeeds and the user already exists, do a final
     // cross-check to confirm we're using the right auth provider.
-    UserId quasselID = Core::validateUser(username, QString());
-    if (!quasselID.isValid())
-    {
+    UserId quasselId = Core::validateUser(username, QString());
+    if (!quasselId.isValid()) {
         return Core::addUser(username, QString(), backendId());
     }
         return Core::addUser(username, QString(), backendId());
     }
-    else if (!(Core::checkAuthProvider(quasselID, backendId())))
-    {
+    else if (!(Core::checkAuthProvider(quasselId, backendId()))) {
         return 0;
     }
         return 0;
     }
-    return quasselID;
+    return quasselId;
 }
 
 }
 
+
 bool LdapAuthenticator::setup(const QVariantMap &settings)
 {
     setConnectionProperties(settings);
 bool LdapAuthenticator::setup(const QVariantMap &settings)
 {
     setConnectionProperties(settings);
@@ -146,13 +147,13 @@ bool LdapAuthenticator::setup(const QVariantMap &settings)
     return status;
 }
 
     return status;
 }
 
+
 Authenticator::State LdapAuthenticator::init(const QVariantMap &settings)
 {
     setConnectionProperties(settings);
 
     bool status = ldapConnect();
 Authenticator::State LdapAuthenticator::init(const QVariantMap &settings)
 {
     setConnectionProperties(settings);
 
     bool status = ldapConnect();
-    if (!status)
-    {
+    if (!status) {
         quInfo() << qPrintable(backendId()) << "Authenticator cannot connect.";
         return NotAvailable;
     }
         quInfo() << qPrintable(backendId()) << "Authenticator cannot connect.";
         return NotAvailable;
     }
@@ -195,6 +196,7 @@ bool LdapAuthenticator::ldapConnect()
     return true;
 }
 
     return true;
 }
 
+
 void LdapAuthenticator::ldapDisconnect()
 {
     if (_connection == 0) {
 void LdapAuthenticator::ldapDisconnect()
 {
     if (_connection == 0) {
@@ -205,6 +207,7 @@ void LdapAuthenticator::ldapDisconnect()
     _connection = 0;
 }
 
     _connection = 0;
 }
 
+
 bool LdapAuthenticator::ldapAuth(const QString &username, const QString &password)
 {
     if (password.isEmpty()) {
 bool LdapAuthenticator::ldapAuth(const QString &username, const QString &password)
 {
     if (password.isEmpty()) {
@@ -215,7 +218,7 @@ bool LdapAuthenticator::ldapAuth(const QString &username, const QString &passwor
 
     // Attempt to establish a connection.
     if (_connection == 0) {
 
     // Attempt to establish a connection.
     if (_connection == 0) {
-        if (not ldapConnect()) {
+        if (!ldapConnect()) {
             return false;
         }
     }
             return false;
         }
     }
@@ -228,7 +231,7 @@ bool LdapAuthenticator::ldapAuth(const QString &username, const QString &passwor
     QByteArray baseDN = _baseDN.toLocal8Bit();
     QByteArray uidAttribute = _uidAttribute.toLocal8Bit();
 
     QByteArray baseDN = _baseDN.toLocal8Bit();
     QByteArray uidAttribute = _uidAttribute.toLocal8Bit();
 
-    cred.bv_val = const_cast<char*>(bindPassword.size() > 0 ? bindPassword.constData() : NULL);
+    cred.bv_val = (bindPassword.size() > 0 ? bindPassword.data() : NULL);
     cred.bv_len = bindPassword.size();
 
     res = ldap_sasl_bind_s(_connection, bindDN.size() > 0 ? bindDN.constData() : 0, LDAP_SASL_SIMPLE, &cred, 0, 0, 0);
     cred.bv_len = bindPassword.size();
 
     res = ldap_sasl_bind_s(_connection, bindDN.size() > 0 ? bindDN.constData() : 0, LDAP_SASL_SIMPLE, &cred, 0, 0, 0);
@@ -264,8 +267,8 @@ bool LdapAuthenticator::ldapAuth(const QString &username, const QString &passwor
         return false;
     }
 
         return false;
     }
 
-    const QByteArray passwordArray = password.toLocal8Bit();
-    cred.bv_val = const_cast<char*>(passwordArray.constData());
+    QByteArray passwordArray = password.toLocal8Bit();
+    cred.bv_val = passwordArray.data();
     cred.bv_len = password.size();
 
     char *userDN = ldap_get_dn(_connection, entry);
     cred.bv_len = password.size();
 
     char *userDN = ldap_get_dn(_connection, entry);
index ff05c4f..a149806 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2016 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -26,8 +26,7 @@
  *
  */
 
  *
  */
 
-#ifndef LDAPAUTHENTICATOR_H
-#define LDAPAUTHENTICATOR_H
+#pragma once
 
 #include "authenticator.h"
 
 
 #include "authenticator.h"
 
@@ -93,6 +92,3 @@ private:
     LDAP *_connection;
 
 };
     LDAP *_connection;
 
 };
-
-
-#endif
index e7f057b..4977218 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2016 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -36,12 +36,14 @@ SqlAuthenticator::~SqlAuthenticator()
 {
 }
 
 {
 }
 
+
 bool SqlAuthenticator::isAvailable() const
 {
     // FIXME: probably this should query the current storage (see the ::init routine too).
     return true;
 }
 
 bool SqlAuthenticator::isAvailable() const
 {
     // FIXME: probably this should query the current storage (see the ::init routine too).
     return true;
 }
 
+
 QString SqlAuthenticator::backendId() const
 {
     // We identify the backend to use for the monolithic core by its displayname.
 QString SqlAuthenticator::backendId() const
 {
     // We identify the backend to use for the monolithic core by its displayname.
@@ -50,23 +52,27 @@ QString SqlAuthenticator::backendId() const
     return QString("Database");
 }
 
     return QString("Database");
 }
 
+
 QString SqlAuthenticator::description() const
 {
     return tr("Do not auth against any remote authentication service, but instead save a hashed and salted password "
               "in the selected database.");
 }
 
 QString SqlAuthenticator::description() const
 {
     return tr("Do not auth against any remote authentication service, but instead save a hashed and salted password "
               "in the selected database.");
 }
 
+
 UserId SqlAuthenticator::validateUser(const QString &user, const QString &password)
 {
     return Core::validateUser(user, password);
 }
 
 UserId SqlAuthenticator::validateUser(const QString &user, const QString &password)
 {
     return Core::validateUser(user, password);
 }
 
+
 bool SqlAuthenticator::setup(const QVariantMap &settings)
 {
     Q_UNUSED(settings)
     return true;
 }
 
 bool SqlAuthenticator::setup(const QVariantMap &settings)
 {
     Q_UNUSED(settings)
     return true;
 }
 
+
 Authenticator::State SqlAuthenticator::init(const QVariantMap &settings)
 {
     Q_UNUSED(settings)
 Authenticator::State SqlAuthenticator::init(const QVariantMap &settings)
 {
     Q_UNUSED(settings)
index 4f2c71f..c392045 100644 (file)
@@ -18,8 +18,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef SQLAUTHENTICATOR_H
-#define SQLAUTHENTICATOR_H
+#pragma once
 
 #include "authenticator.h"
 
 
 #include "authenticator.h"
 
@@ -49,6 +48,3 @@ public slots:
     //virtual UserId getUserId(const QString &username);
 
 };
     //virtual UserId getUserId(const QString &username);
 
 };
-
-
-#endif
index ee9dd0d..a4cfe16 100644 (file)
@@ -37,10 +37,10 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QList<QVari
     setAttribute(Qt::WA_DeleteOnClose);
 
     foreach(const QVariant &v, backends)
     setAttribute(Qt::WA_DeleteOnClose);
 
     foreach(const QVariant &v, backends)
-    _backends[v.toMap()["DisplayName"].toString()] = v;
+        _backends[v.toMap()["DisplayName"].toString()] = v;
 
     foreach(const QVariant &v, authenticators)
 
     foreach(const QVariant &v, authenticators)
-    _authenticators[v.toMap()["DisplayName"].toString()] = v;
+        _authenticators[v.toMap()["DisplayName"].toString()] = v;
 
     setPage(IntroPage, new CoreConfigWizardPages::IntroPage(this));
     setPage(AdminUserPage, new CoreConfigWizardPages::AdminUserPage(this));
 
     setPage(IntroPage, new CoreConfigWizardPages::IntroPage(this));
     setPage(AdminUserPage, new CoreConfigWizardPages::AdminUserPage(this));
@@ -89,11 +89,13 @@ QHash<QString, QVariant> CoreConfigWizard::backends() const
     return _backends;
 }
 
     return _backends;
 }
 
+
 QHash<QString, QVariant> CoreConfigWizard::authenticators() const
 {
     return _authenticators;
 }
 
 QHash<QString, QVariant> CoreConfigWizard::authenticators() const
 {
     return _authenticators;
 }
 
+
 void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authenticator, const QVariantMap &authProperties)
 {
     // Prevent the user from changing any settings he already specified...
 void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMap &properties, const QString &authenticator, const QVariantMap &authProperties)
 {
     // Prevent the user from changing any settings he already specified...
@@ -102,10 +104,10 @@ void CoreConfigWizard::prepareCoreSetup(const QString &backend, const QVariantMa
 
     // FIXME? We need to be able to set up older cores that don't have auth backend support.
     // So if the core doesn't support that feature, don't pass those parameters.
 
     // FIXME? We need to be able to set up older cores that don't have auth backend support.
     // So if the core doesn't support that feature, don't pass those parameters.
-    if (!(Client::coreFeatures() & Quassel::Authenticators))
-    {
+    if (!(Client::coreFeatures() & Quassel::Authenticators)) {
         coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties));
         coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties));
-    } else {
+    }
+    else {
         coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties, authenticator, authProperties));
     }
 }
         coreConnection()->setupCore(Protocol::SetupData(field("adminUser.user").toString(), field("adminUser.password").toString(), backend, properties, authenticator, authProperties));
     }
 }
@@ -194,10 +196,10 @@ AdminUserPage::AdminUserPage(QWidget *parent) : QWizardPage(parent)
 int AdminUserPage::nextId() const
 {
     // If the core doesn't support auth backends, skip that page!
 int AdminUserPage::nextId() const
 {
     // If the core doesn't support auth backends, skip that page!
-    if (!(Client::coreFeatures() & Quassel::Authenticators))
-    {
+    if (!(Client::coreFeatures() & Quassel::Authenticators)) {
         return CoreConfigWizard::StorageSelectionPage;
         return CoreConfigWizard::StorageSelectionPage;
-    } else {
+    }
+    else {
         return CoreConfigWizard::AuthenticationSelectionPage;
     }
 }
         return CoreConfigWizard::AuthenticationSelectionPage;
     }
 }
@@ -276,31 +278,6 @@ QVariantMap AuthenticationSelectionPage::connectionProperties() const
             properties[key] = def;
         }
     }
             properties[key] = def;
         }
     }
-    qDebug() << properties;
-
-//   QVariantMap properties = _backends[backend].toMap()["ConnectionProperties"].toMap();
-//   if(!properties.isEmpty() && _connectionBox) {
-//     QVariantMap::iterator propertyIter = properties.begin();
-//     while(propertyIter != properties.constEnd()) {
-//       QWidget *widget = _connectionBox->findChild<QWidget *>(propertyIter.key());
-//       switch(propertyIter.value().type()) {
-//       case QVariant::Int:
-//      {
-//        QSpinBox *spinbox = qobject_cast<QSpinBox *>(widget);
-//        Q_ASSERT(spinbox);
-//        propertyIter.value() = QVariant(spinbox->value());
-//      }
-//      break;
-//       default:
-//      {
-//        QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
-//        Q_ASSERT(lineEdit);
-//        propertyIter.value() = QVariant(lineEdit->text());
-//      }
-//       }
-//       propertyIter++;
-//     }
-//   }
     return properties;
 }
 
     return properties;
 }