Commit a4f5b2ac authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove old code

parent 2fa181c0
Pipeline #42934 canceled with stage
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.16.41")
set(PIM_VERSION "5.16.42")
project(KLdap VERSION ${PIM_VERSION})
......
......@@ -71,108 +71,6 @@ void LdapClientSearchConfig::clearWalletPassword()
}
}
//Move as async.
void LdapClientSearchConfig::readConfig(KLDAP::LdapServer &server, KConfigGroup &config, int j, bool active)
{
QString prefix;
if (active) {
prefix = QStringLiteral("Selected");
}
const QString host = config.readEntry(prefix + QStringLiteral("Host%1").arg(j),
QString()).trimmed();
if (!host.isEmpty()) {
server.setHost(host);
}
const int port = config.readEntry(prefix + QStringLiteral("Port%1").arg(j), 389);
server.setPort(port);
const QString base = config.readEntry(prefix + QStringLiteral("Base%1").arg(j),
QString()).trimmed();
if (!base.isEmpty()) {
server.setBaseDn(KLDAP::LdapDN(base));
}
const QString user = config.readEntry(prefix + QStringLiteral("User%1").arg(j),
QString()).trimmed();
if (!user.isEmpty()) {
server.setUser(user);
}
const QString bindDN = config.readEntry(prefix + QStringLiteral("Bind%1").arg(j), QString()).trimmed();
if (!bindDN.isEmpty()) {
server.setBindDn(bindDN);
}
const QString pwdBindBNEntry = prefix + QStringLiteral("PwdBind%1").arg(j);
QString pwdBindDN = config.readEntry(pwdBindBNEntry, QString());
if (!pwdBindDN.isEmpty()) {
if (d->askWallet && KMessageBox::Yes == KMessageBox::questionYesNo(nullptr, i18n("LDAP password is stored as clear text, do you want to store it in kwallet?"),
i18n("Store clear text password in Wallet"),
KStandardGuiItem::yes(),
KStandardGuiItem::no(),
QStringLiteral("DoAskToStoreToWallet"))) {
d->wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(), 0);
if (d->wallet) {
connect(d->wallet, &KWallet::Wallet::walletClosed, this, &LdapClientSearchConfig::slotWalletClosed);
d->useWallet = true;
if (!d->wallet->hasFolder(QStringLiteral("ldapclient"))) {
d->wallet->createFolder(QStringLiteral("ldapclient"));
}
d->wallet->setFolder(QStringLiteral("ldapclient"));
d->wallet->writePassword(pwdBindBNEntry, pwdBindDN);
config.deleteEntry(pwdBindBNEntry);
config.sync();
}
}
server.setPassword(pwdBindDN);
} else if (d->askWallet) { //Look at in Wallet
//Move as async here.
d->wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(), 0);
if (d->wallet) {
d->useWallet = true;
if (!d->wallet->setFolder(QStringLiteral("ldapclient"))) {
d->wallet->createFolder(QStringLiteral("ldapclient"));
d->wallet->setFolder(QStringLiteral("ldapclient"));
}
d->wallet->readPassword(pwdBindBNEntry, pwdBindDN);
if (!pwdBindDN.isEmpty()) {
server.setPassword(pwdBindDN);
}
} else {
d->useWallet = false;
}
}
server.setTimeLimit(config.readEntry(prefix + QStringLiteral("TimeLimit%1").arg(j), 0));
server.setSizeLimit(config.readEntry(prefix + QStringLiteral("SizeLimit%1").arg(j), 0));
server.setPageSize(config.readEntry(prefix + QStringLiteral("PageSize%1").arg(j), 0));
server.setVersion(config.readEntry(prefix + QStringLiteral("Version%1").arg(j), 3));
QString tmp = config.readEntry(prefix + QStringLiteral("Security%1").arg(j),
QStringLiteral("None"));
server.setSecurity(KLDAP::LdapServer::None);
if (tmp == QLatin1String("SSL")) {
server.setSecurity(KLDAP::LdapServer::SSL);
} else if (tmp == QLatin1String("TLS")) {
server.setSecurity(KLDAP::LdapServer::TLS);
}
tmp = config.readEntry(prefix + QStringLiteral("Auth%1").arg(j),
QStringLiteral("Anonymous"));
server.setAuth(KLDAP::LdapServer::Anonymous);
if (tmp == QLatin1String("Simple")) {
server.setAuth(KLDAP::LdapServer::Simple);
} else if (tmp == QLatin1String("SASL")) {
server.setAuth(KLDAP::LdapServer::SASL);
}
server.setMech(config.readEntry(prefix + QStringLiteral("Mech%1").arg(j), QString()));
server.setFilter(config.readEntry(prefix + QStringLiteral("UserFilter%1").arg(j), QString()));
server.setCompletionWeight(config.readEntry(prefix + QStringLiteral("CompletionWeight%1").arg(j), -1));
}
void LdapClientSearchConfig::slotWalletClosed()
{
delete d->wallet;
......
......@@ -33,14 +33,6 @@ public:
*/
static KConfig *config();
/**
* Reads the LDAP @p server settings from the given config @p group for the
* given LDAP @p clientNumber.
*
* @param active Defines whether the active settings shall be read.
*/
void readConfig(KLDAP::LdapServer &server, KConfigGroup &group, int clientNumber, bool active);
/**
* Should LdapClientSearchConfig ask, if it should use the Wallet to store passwords
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment