Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KLDAP
Commits
1b2b9f70
Commit
1b2b9f70
authored
Dec 04, 2020
by
Laurent Montel
😁
Browse files
Revert "Remove old code"
This reverts commit
a4f5b2ac
.
parent
ef4f9ad8
Pipeline
#42944
passed with stage
in 8 minutes and 30 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
1b2b9f70
cmake_minimum_required
(
VERSION 3.5
)
set
(
PIM_VERSION
"5.16.4
2
"
)
set
(
PIM_VERSION
"5.16.4
1
"
)
project
(
KLdap VERSION
${
PIM_VERSION
}
)
...
...
src/widgets/ldapclientsearchconfig.cpp
View file @
1b2b9f70
...
...
@@ -71,6 +71,108 @@ 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
;
...
...
src/widgets/ldapclientsearchconfig.h
View file @
1b2b9f70
...
...
@@ -33,6 +33,14 @@ 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
*/
...
...
Laurent Montel
😁
@mlaurent
mentioned in commit
c8ba85ee
·
Dec 04, 2020
mentioned in commit
c8ba85ee
mentioned in commit c8ba85ee7991f4552930dadd4e9dcd42a05d945b
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment