Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
43da2b45
Commit
43da2b45
authored
Feb 14, 2017
by
Hal Deadman
Committed by
daryl herzmann
Feb 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid NullPointerException if peer certificates array is null
Treat null array the same as empty array
parent
3e10288f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
ExternalClientSaslServer.java
.../jivesoftware/openfire/sasl/ExternalClientSaslServer.java
+4
-2
No files found.
src/java/org/jivesoftware/openfire/sasl/ExternalClientSaslServer.java
View file @
43da2b45
...
...
@@ -11,6 +11,7 @@ import javax.security.sasl.Sasl;
import
javax.security.sasl.SaslException
;
import
javax.security.sasl.SaslServer
;
import
java.nio.charset.StandardCharsets
;
import
java.security.cert.Certificate
;
import
java.security.KeyStore
;
import
java.security.cert.X509Certificate
;
import
java.util.ArrayList
;
...
...
@@ -57,14 +58,15 @@ public class ExternalClientSaslServer implements SaslServer
complete
=
true
;
final
Connection
connection
=
session
.
getConnection
();
if
(
connection
.
getPeerCertificates
().
length
<
1
)
Certificate
[]
peerCertificates
=
connection
.
getPeerCertificates
();
if
(
peerCertificates
==
null
||
peerCertificates
.
length
<
1
)
{
throw
new
SaslException
(
"No peer certificates."
);
}
final
KeyStore
keyStore
=
connection
.
getConfiguration
().
getIdentityStore
().
getStore
();
final
KeyStore
trustStore
=
connection
.
getConfiguration
().
getTrustStore
().
getStore
();
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
connection
.
getPeerCertificates
()
,
keyStore
,
trustStore
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
peerCertificates
,
keyStore
,
trustStore
);
if
(
trusted
==
null
)
{
throw
new
SaslException
(
"Certificate chain of peer is not trusted."
);
...
...
Write
Preview
Markdown
is supported
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