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
a3b358d8
Commit
a3b358d8
authored
Dec 02, 2020
by
Laurent Montel
😁
Browse files
Const'ify
parent
f8e617e8
Pipeline
#42726
canceled with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/testkldap.cpp
View file @
a3b358d8
...
...
@@ -35,7 +35,7 @@ void KLdapTest::initTestCase()
The specified server should not be a production server in case we break anything here.
You have been warned!
*/
QString
filename
(
QStringLiteral
(
"testurl.txt"
));
const
QString
filename
(
QStringLiteral
(
"testurl.txt"
));
QFile
file
(
filename
);
if
(
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
))
{
QTextStream
stream
(
&
file
);
...
...
@@ -203,7 +203,7 @@ void KLdapTest::testLdapSearch()
this
,
&
KLdapTest
::
searchResult
);
connect
(
m_search
,
&
LdapSearch
::
data
,
this
,
&
KLdapTest
::
searchData
);
bool
success
=
m_search
->
search
(
url
);
const
bool
success
=
m_search
->
search
(
url
);
QCoreApplication
::
processEvents
();
QEXPECT_FAIL
(
""
,
"Will fail since no server is available for testing"
,
Abort
);
...
...
@@ -215,7 +215,7 @@ void KLdapTest::testLdapSearch()
void
KLdapTest
::
searchResult
(
KLDAP
::
LdapSearch
*
search
)
{
qDebug
();
int
err
=
search
->
error
();
const
int
err
=
search
->
error
();
if
(
err
)
{
qDebug
()
<<
"Search returned the following error:"
<<
search
->
errorString
();
}
...
...
@@ -233,8 +233,8 @@ void KLdapTest::searchData(KLDAP::LdapSearch *search, const KLDAP::LdapObject &o
void
KLdapTest
::
testLdapDN
()
{
QString
strDN
(
QStringLiteral
(
"uid=Test
\\
+Person+ou=accounts
\\
,outgoing,dc=kde,dc=org"
));
LdapDN
dn
(
strDN
);
const
QString
strDN
(
QStringLiteral
(
"uid=Test
\\
+Person+ou=accounts
\\
,outgoing,dc=kde,dc=org"
));
const
LdapDN
dn
(
strDN
);
QCOMPARE
(
dn
.
isValid
(),
true
);
QCOMPARE
(
dn
.
rdnString
(),
QStringLiteral
(
"uid=Test
\\
+Person+ou=accounts
\\
,outgoing"
));
}
...
...
src/core/ldapconnection.cpp
View file @
a3b358d8
...
...
@@ -353,7 +353,7 @@ int LdapConnection::connect()
}
qCDebug
(
LDAP_LOG
)
<<
"initializing SASL client"
;
int
saslresult
=
sasl_client_new
(
"ldap"
,
d
->
mServer
.
host
().
toLatin1
().
constData
(),
const
int
saslresult
=
sasl_client_new
(
"ldap"
,
d
->
mServer
.
host
().
toLatin1
().
constData
(),
nullptr
,
nullptr
,
callbacks
,
0
,
&
d
->
mSASLconn
);
if
(
saslresult
!=
SASL_OK
)
{
d
->
mConnectionError
=
i18n
(
"Cannot initialize the SASL client."
);
...
...
src/core/ldapdn.cpp
View file @
a3b358d8
...
...
@@ -134,7 +134,7 @@ QString LdapDN::toString() const
QString
LdapDN
::
toString
(
int
depth
)
const
{
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
const
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
if
(
depth
>=
rdns
.
size
())
{
return
QString
();
}
...
...
@@ -153,13 +153,13 @@ QString LdapDN::toString(int depth) const
QString
LdapDN
::
rdnString
()
const
{
/** \TODO We should move this into the d pointer as we calculate rdns quite a lot */
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
const
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
return
rdns
.
at
(
0
);
}
QString
LdapDN
::
rdnString
(
int
depth
)
const
{
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
const
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
if
(
depth
>=
rdns
.
size
())
{
return
QString
();
}
...
...
@@ -186,7 +186,7 @@ bool LdapDN::isValid() const
int
LdapDN
::
depth
()
const
{
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
const
QStringList
rdns
=
d
->
splitOnNonEscapedChar
(
d
->
m_dn
,
QLatin1Char
(
','
));
return
rdns
.
size
();
}
...
...
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