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
9d3b8cfa
Commit
9d3b8cfa
authored
Oct 29, 2015
by
Christian Schudt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #333 from sco0ter/appendchar
Prefer StringBuilder.append(char) over append(String).
parents
7e90fbfc
78bbd89f
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
131 additions
and
131 deletions
+131
-131
AuthCheckFilter.java
src/java/org/jivesoftware/admin/AuthCheckFilter.java
+1
-1
SchemaManager.java
src/java/org/jivesoftware/database/SchemaManager.java
+1
-1
AuditManagerImpl.java
...org/jivesoftware/openfire/audit/spi/AuditManagerImpl.java
+1
-1
ClearspaceVCardTranslator.java
...ftware/openfire/clearspace/ClearspaceVCardTranslator.java
+1
-1
PluginServlet.java
...va/org/jivesoftware/openfire/container/PluginServlet.java
+2
-2
FlashCrossDomainServlet.java
...g/jivesoftware/openfire/http/FlashCrossDomainServlet.java
+3
-3
LdapAuthorizationMapping.java
.../jivesoftware/openfire/ldap/LdapAuthorizationMapping.java
+1
-1
LdapGroupProvider.java
...ava/org/jivesoftware/openfire/ldap/LdapGroupProvider.java
+4
-4
LdapManager.java
src/java/org/jivesoftware/openfire/ldap/LdapManager.java
+8
-8
LdapUserProvider.java
...java/org/jivesoftware/openfire/ldap/LdapUserProvider.java
+4
-4
MultiUserChatServiceImpl.java
...vesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
+2
-2
DNSUtil.java
src/java/org/jivesoftware/openfire/net/DNSUtil.java
+35
-35
SASLAuthentication.java
...ava/org/jivesoftware/openfire/net/SASLAuthentication.java
+33
-33
SocketReadingMode.java
...java/org/jivesoftware/openfire/net/SocketReadingMode.java
+3
-3
StanzaHandler.java
src/java/org/jivesoftware/openfire/net/StanzaHandler.java
+1
-1
XMLLightweightParser.java
...a/org/jivesoftware/openfire/nio/XMLLightweightParser.java
+1
-1
PubSubModule.java
src/java/org/jivesoftware/openfire/pubsub/PubSubModule.java
+1
-1
PubSubPersistenceManager.java
...ivesoftware/openfire/pubsub/PubSubPersistenceManager.java
+2
-2
PublishedItem.java
src/java/org/jivesoftware/openfire/pubsub/PublishedItem.java
+1
-1
LocalClientSession.java
...org/jivesoftware/openfire/session/LocalClientSession.java
+3
-3
LocalIncomingServerSession.java
...software/openfire/session/LocalIncomingServerSession.java
+6
-6
DefaultUserProvider.java
...a/org/jivesoftware/openfire/user/DefaultUserProvider.java
+2
-2
JDBCUserProvider.java
...java/org/jivesoftware/openfire/user/JDBCUserProvider.java
+5
-5
LocaleUtils.java
src/java/org/jivesoftware/util/LocaleUtils.java
+3
-3
StringUtils.java
src/java/org/jivesoftware/util/StringUtils.java
+7
-7
No files found.
src/java/org/jivesoftware/admin/AuthCheckFilter.java
View file @
9d3b8cfa
...
...
@@ -170,7 +170,7 @@ public class AuthCheckFilter implements Filter {
buf
.
append
(
request
.
getRequestURI
());
String
qs
=
request
.
getQueryString
();
if
(
qs
!=
null
)
{
buf
.
append
(
"?"
).
append
(
qs
);
buf
.
append
(
'?'
).
append
(
qs
);
}
}
catch
(
Exception
e
)
{
...
...
src/java/org/jivesoftware/database/SchemaManager.java
View file @
9d3b8cfa
...
...
@@ -385,7 +385,7 @@ public class SchemaManager {
}
// Ignore comments and blank lines.
if
(
isSQLCommandPart
(
line
))
{
command
.
append
(
" "
).
append
(
line
);
command
.
append
(
' '
).
append
(
line
);
}
if
(
line
.
trim
().
endsWith
(
";"
))
{
break
;
...
...
src/java/org/jivesoftware/openfire/audit/spi/AuditManagerImpl.java
View file @
9d3b8cfa
...
...
@@ -221,7 +221,7 @@ public class AuditManagerImpl extends BasicModule implements AuditManager {
ignoreString
.
append
(
username
);
}
else
{
ignoreString
.
append
(
","
).
append
(
username
);
ignoreString
.
append
(
','
).
append
(
username
);
}
}
JiveGlobals
.
setProperty
(
"xmpp.audit.ignore"
,
ignoreString
.
toString
());
...
...
src/java/org/jivesoftware/openfire/clearspace/ClearspaceVCardTranslator.java
View file @
9d3b8cfa
...
...
@@ -960,7 +960,7 @@ class ClearspaceVCardTranslator {
private
void
translateAddressField
(
Element
addressElement
,
String
vCardFieldName
,
String
fieldName
,
StringBuilder
sb
)
{
String
field
=
addressElement
.
elementTextTrim
(
vCardFieldName
);
if
(
field
!=
null
&&
!
""
.
equals
(
field
))
{
sb
.
append
(
fieldName
).
append
(
":"
).
append
(
field
).
append
(
","
);
sb
.
append
(
fieldName
).
append
(
':'
).
append
(
field
).
append
(
','
);
}
}
...
...
src/java/org/jivesoftware/openfire/container/PluginServlet.java
View file @
9d3b8cfa
...
...
@@ -547,7 +547,7 @@ public class PluginServlet extends HttpServlet {
for
(
URL
url
:
pluginClassloader
.
getURLs
())
{
File
file
=
new
File
(
url
.
getFile
());
classpath
.
append
(
file
.
getAbsolutePath
()).
append
(
";"
);
classpath
.
append
(
file
.
getAbsolutePath
()).
append
(
';'
);
}
// Load all jars from lib
...
...
@@ -568,7 +568,7 @@ public class PluginServlet extends HttpServlet {
classpath
.
append
(
openfireLib
.
getAbsolutePath
()).
append
(
"//jasper-runtime.jar;"
);
if
(
pluginEnv
.
getClassesDir
()
!=
null
)
{
classpath
.
append
(
pluginEnv
.
getClassesDir
().
getAbsolutePath
()).
append
(
";"
);
classpath
.
append
(
pluginEnv
.
getClassesDir
().
getAbsolutePath
()).
append
(
';'
);
}
return
classpath
.
toString
();
}
...
...
src/java/org/jivesoftware/openfire/http/FlashCrossDomainServlet.java
View file @
9d3b8cfa
...
...
@@ -156,7 +156,7 @@ public class FlashCrossDomainServlet extends HttpServlet {
}
if
(
XMPPServer
.
getInstance
().
getConnectionManager
().
getClientSSLListenerPort
()
>
0
)
{
if
(
multiple
)
{
builder
.
append
(
","
);
builder
.
append
(
','
);
}
builder
.
append
(
XMPPServer
.
getInstance
().
getConnectionManager
().
getClientSSLListenerPort
());
multiple
=
true
;
...
...
@@ -166,14 +166,14 @@ public class FlashCrossDomainServlet extends HttpServlet {
// ports for http-binding may not be strictly needed in here, but it doesn't hurt
if
(
HttpBindManager
.
getInstance
().
getHttpBindUnsecurePort
()
>
0
)
{
if
(
multiple
)
{
builder
.
append
(
","
);
builder
.
append
(
','
);
}
builder
.
append
(
HttpBindManager
.
getInstance
().
getHttpBindUnsecurePort
());
multiple
=
true
;
}
if
(
HttpBindManager
.
getInstance
().
isHttpsBindActive
())
{
if
(
multiple
)
{
builder
.
append
(
","
);
builder
.
append
(
','
);
}
builder
.
append
(
HttpBindManager
.
getInstance
().
getHttpBindSecurePort
());
}
...
...
src/java/org/jivesoftware/openfire/ldap/LdapAuthorizationMapping.java
View file @
9d3b8cfa
...
...
@@ -79,7 +79,7 @@ public class LdapAuthorizationMapping implements AuthorizationMapping {
princSearchFilter
=
JiveGlobals
.
getProperty
(
"ldap.princSearchFilter"
);
StringBuilder
filter
=
new
StringBuilder
();
if
(
princSearchFilter
==
null
)
{
filter
.
append
(
"("
).
append
(
princField
).
append
(
"={0})"
);
filter
.
append
(
'('
).
append
(
princField
).
append
(
"={0})"
);
}
else
{
filter
.
append
(
"(&("
).
append
(
princField
).
append
(
"={0})("
);
filter
.
append
(
princSearchFilter
).
append
(
"))"
);
...
...
src/java/org/jivesoftware/openfire/ldap/LdapGroupProvider.java
View file @
9d3b8cfa
...
...
@@ -165,7 +165,7 @@ public class LdapGroupProvider extends AbstractGroupProvider {
StringBuilder
filter
=
new
StringBuilder
();
filter
.
append
(
"(&"
);
filter
.
append
(
MessageFormat
.
format
(
manager
.
getGroupSearchFilter
(),
"*"
));
filter
.
append
(
"("
).
append
(
key
).
append
(
"="
).
append
(
LdapManager
.
sanitizeSearchFilter
(
value
));
filter
.
append
(
'('
).
append
(
key
).
append
(
'='
).
append
(
LdapManager
.
sanitizeSearchFilter
(
value
));
filter
.
append
(
"))"
);
if
(
Log
.
isDebugEnabled
())
{
Log
.
debug
(
"Trying to find group names using query: "
+
filter
.
toString
());
...
...
@@ -191,7 +191,7 @@ public class LdapGroupProvider extends AbstractGroupProvider {
StringBuilder
filter
=
new
StringBuilder
();
// Make the query be a wildcard search by default. So, if the user searches for
// "Test", make the sanitized search be "Test*" instead.
filter
.
append
(
"("
).
append
(
manager
.
getGroupNameField
()).
append
(
"="
)
filter
.
append
(
'('
).
append
(
manager
.
getGroupNameField
()).
append
(
'='
)
.
append
(
LdapManager
.
sanitizeSearchFilter
(
query
)).
append
(
"*)"
);
// Perform the LDAP query
return
manager
.
retrieveList
(
...
...
@@ -268,9 +268,9 @@ public class LdapGroupProvider extends AbstractGroupProvider {
StringBuilder
userFilter
=
new
StringBuilder
();
userFilter
.
append
(
"(&("
);
userFilter
.
append
(
ldapName
.
get
(
ldapName
.
size
()
-
1
));
userFilter
.
append
(
")"
);
userFilter
.
append
(
')'
);
userFilter
.
append
(
MessageFormat
.
format
(
manager
.
getSearchFilter
(),
"*"
));
userFilter
.
append
(
")"
);
userFilter
.
append
(
')'
);
NamingEnumeration
usrAnswer
=
ctx
.
search
(
""
,
userFilter
.
toString
(),
searchControls
);
if
(
usrAnswer
!=
null
&&
usrAnswer
.
hasMoreElements
())
{
...
...
src/java/org/jivesoftware/openfire/ldap/LdapManager.java
View file @
9d3b8cfa
...
...
@@ -1191,11 +1191,11 @@ public class LdapManager {
// Create a correctly-encoded ldap URL for the PROVIDER_URL
ldapURL
.
append
(
"ldap://"
);
ldapURL
.
append
(
host
);
ldapURL
.
append
(
":"
);
ldapURL
.
append
(
':'
);
ldapURL
.
append
(
port
);
ldapURL
.
append
(
"/"
);
ldapURL
.
append
(
'/'
);
ldapURL
.
append
(
baseDN
);
ldapURL
.
append
(
" "
);
ldapURL
.
append
(
' '
);
}
return
ldapURL
.
toString
();
}
...
...
@@ -1224,7 +1224,7 @@ public class LdapManager {
this
.
hosts
=
hosts
;
StringBuilder
hostProperty
=
new
StringBuilder
();
for
(
String
host
:
hosts
)
{
hostProperty
.
append
(
host
).
append
(
","
);
hostProperty
.
append
(
host
).
append
(
','
);
}
if
(!
hosts
.
isEmpty
())
{
// Remove the last comma
...
...
@@ -1604,11 +1604,11 @@ public class LdapManager {
public
String
getSearchFilter
()
{
StringBuilder
filter
=
new
StringBuilder
();
if
(
searchFilter
==
null
)
{
filter
.
append
(
"("
).
append
(
usernameField
).
append
(
"={0})"
);
filter
.
append
(
'('
).
append
(
usernameField
).
append
(
"={0})"
);
}
else
{
filter
.
append
(
"(&("
).
append
(
usernameField
).
append
(
"={0})"
);
filter
.
append
(
searchFilter
).
append
(
")"
);
filter
.
append
(
searchFilter
).
append
(
')'
);
}
return
filter
.
toString
();
}
...
...
@@ -1784,11 +1784,11 @@ public class LdapManager {
public
String
getGroupSearchFilter
()
{
StringBuilder
groupFilter
=
new
StringBuilder
();
if
(
groupSearchFilter
==
null
)
{
groupFilter
.
append
(
"("
).
append
(
groupNameField
).
append
(
"={0})"
);
groupFilter
.
append
(
'('
).
append
(
groupNameField
).
append
(
"={0})"
);
}
else
{
groupFilter
.
append
(
"(&("
).
append
(
groupNameField
).
append
(
"={0})"
);
groupFilter
.
append
(
groupSearchFilter
).
append
(
")"
);
groupFilter
.
append
(
groupSearchFilter
).
append
(
')'
);
}
return
groupFilter
.
toString
();
}
...
...
src/java/org/jivesoftware/openfire/ldap/LdapUserProvider.java
View file @
9d3b8cfa
...
...
@@ -295,7 +295,7 @@ public class LdapUserProvider implements UserProvider {
//are returned from the directory
filter
.
append
(
"(&("
);
filter
.
append
(
MessageFormat
.
format
(
manager
.
getSearchFilter
(),
"*"
));
filter
.
append
(
")"
);
filter
.
append
(
')'
);
if
(
fields
.
size
()
>
1
)
{
filter
.
append
(
"(|"
);
}
...
...
@@ -303,13 +303,13 @@ public class LdapUserProvider implements UserProvider {
String
attribute
=
searchFields
.
get
(
field
);
// Make the query be a wildcard search by default. So, if the user searches for
// "John", make the sanitized search be "John*" instead.
filter
.
append
(
"("
).
append
(
attribute
).
append
(
"="
)
filter
.
append
(
'('
).
append
(
attribute
).
append
(
'='
)
.
append
(
LdapManager
.
sanitizeSearchFilter
(
query
)).
append
(
"*)"
);
}
if
(
fields
.
size
()
>
1
)
{
filter
.
append
(
")"
);
filter
.
append
(
')'
);
}
filter
.
append
(
")"
);
filter
.
append
(
')'
);
List
<
String
>
userlist
=
manager
.
retrieveList
(
manager
.
getUsernameField
(),
filter
.
toString
(),
...
...
src/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
View file @
9d3b8cfa
...
...
@@ -1559,7 +1559,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
buf
.
append
(
array
[
i
]);
if
(
i
!=
array
.
length
-
1
)
{
buf
.
append
(
","
);
buf
.
append
(
','
);
}
}
return
buf
.
toString
();
...
...
@@ -1574,7 +1574,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
private
static
String
fromCollection
(
Collection
<
JID
>
coll
)
{
StringBuilder
buf
=
new
StringBuilder
();
for
(
JID
elem:
coll
)
{
buf
.
append
(
elem
.
toBareJID
()).
append
(
","
);
buf
.
append
(
elem
.
toBareJID
()).
append
(
','
);
}
int
endPos
=
buf
.
length
()
>
1
?
buf
.
length
()
-
1
:
0
;
return
buf
.
substring
(
0
,
endPos
);
...
...
src/java/org/jivesoftware/openfire/net/DNSUtil.java
View file @
9d3b8cfa
...
...
@@ -165,11 +165,11 @@ public class DNSUtil {
StringBuilder
sb
=
new
StringBuilder
(
100
);
for
(
String
key
:
internalDNS
.
keySet
())
{
if
(
sb
.
length
()
>
0
)
{
sb
.
append
(
","
);
sb
.
append
(
','
);
}
sb
.
append
(
"{"
).
append
(
key
).
append
(
","
);
sb
.
append
(
internalDNS
.
get
(
key
).
getHost
()).
append
(
":"
);
sb
.
append
(
internalDNS
.
get
(
key
).
getPort
()).
append
(
"}"
);
sb
.
append
(
'{'
).
append
(
key
).
append
(
','
);
sb
.
append
(
internalDNS
.
get
(
key
).
getHost
()).
append
(
':'
);
sb
.
append
(
internalDNS
.
get
(
key
).
getPort
()).
append
(
'}'
);
}
return
sb
.
toString
();
}
...
...
@@ -213,37 +213,37 @@ public class DNSUtil {
}
/**
* Checks if the provided DNS pattern matches the provided name. For example, this method will:
* return <em>true</em> for name: <tt>xmpp.example.org</tt>, pattern: <tt>*.example.org</tt>
* return <em>false</em> for name: <tt>xmpp.example.org</tt>, pattern: <tt>example.org</tt>
*
* This method is not case sensitive.
*
* @param name The name to check against a pattern (cannot be null or empty).
* @param pattern the pattern (cannot be null or empty).
* @return true when the name is covered by the pattern, otherwise false.
*/
public
static
boolean
isNameCoveredByPattern
(
String
name
,
String
pattern
)
{
if
(
name
==
null
||
name
.
isEmpty
()
||
pattern
==
null
||
pattern
.
isEmpty
()
)
{
throw
new
IllegalArgumentException
(
"Arguments cannot be null or empty."
);
}
final
String
needle
=
name
.
toLowerCase
();
final
String
hayStack
=
pattern
.
toLowerCase
();
if
(
needle
.
equals
(
hayStack
))
{
return
true
;
}
if
(
hayStack
.
startsWith
(
"*."
)
)
{
return
needle
.
endsWith
(
hayStack
.
substring
(
2
)
);
}
return
false
;
}
/**
* Checks if the provided DNS pattern matches the provided name. For example, this method will:
* return <em>true</em> for name: <tt>xmpp.example.org</tt>, pattern: <tt>*.example.org</tt>
* return <em>false</em> for name: <tt>xmpp.example.org</tt>, pattern: <tt>example.org</tt>
*
* This method is not case sensitive.
*
* @param name The name to check against a pattern (cannot be null or empty).
* @param pattern the pattern (cannot be null or empty).
* @return true when the name is covered by the pattern, otherwise false.
*/
public
static
boolean
isNameCoveredByPattern
(
String
name
,
String
pattern
)
{
if
(
name
==
null
||
name
.
isEmpty
()
||
pattern
==
null
||
pattern
.
isEmpty
()
)
{
throw
new
IllegalArgumentException
(
"Arguments cannot be null or empty."
);
}
final
String
needle
=
name
.
toLowerCase
();
final
String
hayStack
=
pattern
.
toLowerCase
();
if
(
needle
.
equals
(
hayStack
))
{
return
true
;
}
if
(
hayStack
.
startsWith
(
"*."
)
)
{
return
needle
.
endsWith
(
hayStack
.
substring
(
2
)
);
}
return
false
;
}
/**
* Encapsulates a hostname and port.
*/
public
static
class
HostAddress
{
...
...
src/java/org/jivesoftware/openfire/net/SASLAuthentication.java
View file @
9d3b8cfa
...
...
@@ -22,7 +22,7 @@ package org.jivesoftware.openfire.net;
import
java.io.UnsupportedEncodingException
;
import
java.net.UnknownHostException
;
import
java.security.KeyStore
;
import
java.security.KeyStore
;
import
java.security.Security
;
import
java.security.cert.Certificate
;
import
java.security.cert.X509Certificate
;
...
...
@@ -48,7 +48,7 @@ import org.jivesoftware.openfire.XMPPServer;
import
org.jivesoftware.openfire.auth.AuthFactory
;
import
org.jivesoftware.openfire.auth.AuthToken
;
import
org.jivesoftware.openfire.auth.AuthorizationManager
;
import
org.jivesoftware.openfire.keystore.Purpose
;
import
org.jivesoftware.openfire.keystore.Purpose
;
import
org.jivesoftware.openfire.lockout.LockOutManager
;
import
org.jivesoftware.openfire.session.ClientSession
;
import
org.jivesoftware.openfire.session.ConnectionSettings
;
...
...
@@ -192,19 +192,19 @@ public class SASLAuthentication {
return
null
;
}
Element
mechs
=
DocumentHelper
.
createElement
(
new
QName
(
"mechanisms"
,
new
Namespace
(
""
,
"urn:ietf:params:xml:ns:xmpp-sasl"
)
)
);
Element
mechs
=
DocumentHelper
.
createElement
(
new
QName
(
"mechanisms"
,
new
Namespace
(
""
,
"urn:ietf:params:xml:ns:xmpp-sasl"
)
)
);
if
(
session
instanceof
LocalIncomingServerSession
)
{
// Server connections don't follow the same rules as clients
if
(
session
.
isSecure
())
{
LocalIncomingServerSession
svr
=
(
LocalIncomingServerSession
)
session
;
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
final
KeyStore
trustStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_S2S_TRUSTSTORE
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
svr
.
getConnection
().
getPeerCertificates
(),
keyStore
,
trustStore
);
boolean
haveTrustedCertificate
=
trusted
!=
null
;
if
(
trusted
!=
null
&&
svr
.
getDefaultIdentity
()
!=
null
)
{
haveTrustedCertificate
=
verifyCertificate
(
trusted
,
svr
.
getDefaultIdentity
());
LocalIncomingServerSession
svr
=
(
LocalIncomingServerSession
)
session
;
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
final
KeyStore
trustStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_S2S_TRUSTSTORE
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
svr
.
getConnection
().
getPeerCertificates
(),
keyStore
,
trustStore
);
boolean
haveTrustedCertificate
=
trusted
!=
null
;
if
(
trusted
!=
null
&&
svr
.
getDefaultIdentity
()
!=
null
)
{
haveTrustedCertificate
=
verifyCertificate
(
trusted
,
svr
.
getDefaultIdentity
());
}
if
(
haveTrustedCertificate
)
{
// Offer SASL EXTERNAL only if TLS has already been negotiated and the peer has a trusted cert.
...
...
@@ -469,7 +469,7 @@ public class SASLAuthentication {
return
false
;
}
String
sharedSecert
=
getSharedSecret
();
return
StringUtils
.
hash
(
sharedSecert
).
equals
(
digest
);
return
StringUtils
.
hash
(
sharedSecert
).
equals
(
digest
);
}
...
...
@@ -555,7 +555,7 @@ public class SASLAuthentication {
if
(!
verify
)
{
authenticationSuccessful
(
session
,
hostname
,
null
);
return
Status
.
authenticated
;
}
else
if
(
verifyCertificates
(
session
.
getConnection
().
getPeerCertificates
(),
hostname
,
true
))
{
}
else
if
(
verifyCertificates
(
session
.
getConnection
().
getPeerCertificates
(),
hostname
,
true
))
{
authenticationSuccessful
(
session
,
hostname
,
null
);
LocalIncomingServerSession
s
=
(
LocalIncomingServerSession
)
session
;
if
(
s
!=
null
)
{
...
...
@@ -565,7 +565,7 @@ public class SASLAuthentication {
}
}
else
if
(
session
instanceof
LocalClientSession
)
{
// Client EXTERNAL login
// Client EXTERNAL login
Log
.
debug
(
"SASLAuthentication: EXTERNAL authentication via SSL certs for c2s connection"
);
// This may be null, we will deal with that later
...
...
@@ -579,10 +579,10 @@ public class SASLAuthentication {
return
Status
.
failed
;
}
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
final
KeyStore
trustStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_C2S_TRUSTSTORE
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
connection
.
getPeerCertificates
(),
keyStore
,
trustStore
);
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
final
KeyStore
trustStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_C2S_TRUSTSTORE
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
connection
.
getPeerCertificates
(),
keyStore
,
trustStore
);
if
(
trusted
==
null
)
{
Log
.
debug
(
"SASLAuthentication: EXTERNAL authentication requested, but EE cert untrusted."
);
authenticationFailed
(
session
,
Failure
.
NOT_AUTHORIZED
);
...
...
@@ -651,20 +651,20 @@ public class SASLAuthentication {
return
false
;
}
/**
* @deprecated Use {@link #verifyCertificates(Certificate[], String, boolean)} instead.
*/
@Deprecated
/**
* @deprecated Use {@link #verifyCertificates(Certificate[], String, boolean)} instead.
*/
@Deprecated
public
static
boolean
verifyCertificates
(
Certificate
[]
chain
,
String
hostname
)
{
return
verifyCertificates
(
chain
,
hostname
,
true
);
}
return
verifyCertificates
(
chain
,
hostname
,
true
);
}
public
static
boolean
verifyCertificates
(
Certificate
[]
chain
,
String
hostname
,
boolean
isS2S
)
{
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
final
KeyStore
trustStore
=
SSLConfig
.
getStore
(
isS2S
?
Purpose
.
SOCKETBASED_S2S_TRUSTSTORE
:
Purpose
.
SOCKETBASED_C2S_TRUSTSTORE
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
chain
,
keyStore
,
trustStore
);
if
(
trusted
!=
null
)
{
return
verifyCertificate
(
trusted
,
hostname
);
public
static
boolean
verifyCertificates
(
Certificate
[]
chain
,
String
hostname
,
boolean
isS2S
)
{
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
final
KeyStore
trustStore
=
SSLConfig
.
getStore
(
isS2S
?
Purpose
.
SOCKETBASED_S2S_TRUSTSTORE
:
Purpose
.
SOCKETBASED_C2S_TRUSTSTORE
);
final
X509Certificate
trusted
=
CertificateManager
.
getEndEntityCertificate
(
chain
,
keyStore
,
trustStore
);
if
(
trusted
!=
null
)
{
return
verifyCertificate
(
trusted
,
hostname
);
}
return
false
;
}
...
...
@@ -722,12 +722,12 @@ public class SASLAuthentication {
reply
.
append
(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\""
);
if
(
successData
!=
null
)
{
String
successData_b64
=
StringUtils
.
encodeBase64
(
successData
).
trim
();
reply
.
append
(
">"
).
append
(
successData_b64
).
append
(
"</success>"
);
reply
.
append
(
'>'
).
append
(
successData_b64
).
append
(
"</success>"
);
}
else
{
reply
.
append
(
"/>"
);
}
session
.
deliverRawText
(
reply
.
toString
()
);
session
.
deliverRawText
(
reply
.
toString
()
);
// We only support SASL for c2s
if
(
session
instanceof
ClientSession
)
{
((
LocalClientSession
)
session
).
setAuthToken
(
new
AuthToken
(
username
));
...
...
src/java/org/jivesoftware/openfire/net/SocketReadingMode.java
View file @
9d3b8cfa
...
...
@@ -259,9 +259,9 @@ abstract class SocketReadingMode {
sb
.
append
(
"<stream:stream "
);
}
sb
.
append
(
"xmlns:stream=\"http://etherx.jabber.org/streams\" xmlns=\""
);
sb
.
append
(
socketReader
.
getNamespace
()).
append
(
"\""
);
sb
.
append
(
socketReader
.
getNamespace
()).
append
(
'\"'
);
if
(
socketReader
.
getExtraNamespaces
()
!=
null
)
{
sb
.
append
(
" "
);
sb
.
append
(
' '
);
sb
.
append
(
socketReader
.
getExtraNamespaces
());
}
sb
.
append
(
" from=\""
);
...
...
@@ -271,7 +271,7 @@ abstract class SocketReadingMode {
sb
.
append
(
"\" xml:lang=\""
);
sb
.
append
(
socketReader
.
connection
.
getLanguage
());
sb
.
append
(
"\" version=\""
);
sb
.
append
(
Session
.
MAJOR_VERSION
).
append
(
"."
).
append
(
Session
.
MINOR_VERSION
);
sb
.
append
(
Session
.
MAJOR_VERSION
).
append
(
'.'
).
append
(
Session
.
MINOR_VERSION
);
sb
.
append
(
"\">"
);
return
sb
.
toString
();
}
...
...
src/java/org/jivesoftware/openfire/net/StanzaHandler.java
View file @
9d3b8cfa
...
...
@@ -582,7 +582,7 @@ public abstract class StanzaHandler {
sb
.
append
(
"\" xml:lang=\""
);
sb
.
append
(
connection
.
getLanguage
());
sb
.
append
(
"\" version=\""
);
sb
.
append
(
Session
.
MAJOR_VERSION
).
append
(
"."
).
append
(
Session
.
MINOR_VERSION
);
sb
.
append
(
Session
.
MAJOR_VERSION
).
append
(
'.'
).
append
(
Session
.
MINOR_VERSION
);
sb
.
append
(
"\">"
);
return
sb
.
toString
();
}
...
...
src/java/org/jivesoftware/openfire/nio/XMLLightweightParser.java
View file @
9d3b8cfa
...
...
@@ -353,7 +353,7 @@ class XMLLightweightParser {
}
else
if
(
status
==
XMLLightweightParser
.
HEAD
)
{
if
(
ch
==
' '
||
ch
==
'>'
)
{
// Append > to head to allow searching </tag>
head
.
append
(
">"
);
head
.
append
(
'>'
);
if
(
ch
==
'>'
)
status
=
XMLLightweightParser
.
OUTSIDE
;
else
...
...
src/java/org/jivesoftware/openfire/pubsub/PubSubModule.java
View file @
9d3b8cfa
...
...
@@ -756,7 +756,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
buf
.
append
(
array
[
i
]);
if
(
i
!=
array
.
length
-
1
)
{
buf
.
append
(
","
);
buf
.
append
(
','
);
}
}
return
buf
.
toString
();
...
...
src/java/org/jivesoftware/openfire/pubsub/PubSubPersistenceManager.java
View file @
9d3b8cfa
...
...
@@ -1818,14 +1818,14 @@ public class PubSubPersistenceManager {
private
static
String
encodeWithComma
(
Collection
<
String
>
strings
)
{
StringBuilder
sb
=
new
StringBuilder
(
90
);
for
(
String
group
:
strings
)
{
sb
.
append
(
group
).
append
(
","
);
sb
.
append
(
group
).
append
(
','
);
}
if
(!
strings
.
isEmpty
())
{
sb
.
setLength
(
sb
.
length
()-
1
);
}
else
{
// Add a blank so an empty string is never replaced with NULL (oracle...arggg!!!)
sb
.
append
(
" "
);
sb
.
append
(
' '
);
}
return
sb
.
toString
();
}
...
...
src/java/org/jivesoftware/openfire/pubsub/PublishedItem.java
View file @
9d3b8cfa
...
...
@@ -308,6 +308,6 @@ public class PublishedItem implements Serializable {
*/
public
static
String
getItemKey
(
String
nodeId
,
String
itemId
)
{
return
new
StringBuilder
(
nodeId
)
.
append
(
":"
).
append
(
itemId
).
toString
();
.
append
(
':'
).
append
(
itemId
).
toString
();
}
}
src/java/org/jivesoftware/openfire/session/LocalClientSession.java
View file @
9d3b8cfa
...
...
@@ -34,7 +34,7 @@ import org.jivesoftware.openfire.XMPPServer;
import
org.jivesoftware.openfire.auth.AuthToken
;
import
org.jivesoftware.openfire.auth.UnauthorizedException
;
import
org.jivesoftware.openfire.cluster.ClusterManager
;
import
org.jivesoftware.openfire.keystore.Purpose
;
import
org.jivesoftware.openfire.keystore.Purpose
;
import
org.jivesoftware.openfire.net.SASLAuthentication
;
import
org.jivesoftware.openfire.net.SSLConfig
;
import
org.jivesoftware.openfire.net.SocketConnection
;
...
...
@@ -256,7 +256,7 @@ public class LocalClientSession extends LocalSession implements ClientSession {
if
(!
connection
.
isSecure
())
{
boolean
hasCertificates
=
false
;
try
{
hasCertificates
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
).
size
()
>
0
;
hasCertificates
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
).
size
()
>
0
;
}
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -300,7 +300,7 @@ public class LocalClientSession extends LocalSession implements ClientSession {
// Don't include version info if the version is 0.0.
if
(
majorVersion
!=
0
)
{
sb
.
append
(
"\" version=\""
);
sb
.
append
(
majorVersion
).
append
(
"."
).
append
(
minorVersion
);
sb
.
append
(
majorVersion
).
append
(
'.'
).
append
(
minorVersion
);
}
sb
.
append
(
"\">"
);
connection
.
deliverRawText
(
sb
.
toString
());
...
...
src/java/org/jivesoftware/openfire/session/LocalIncomingServerSession.java
View file @
9d3b8cfa
...
...
@@ -20,7 +20,7 @@
package
org
.
jivesoftware
.
openfire
.
session
;
import
java.io.IOException
;
import
java.security.KeyStore
;
import
java.security.KeyStore
;
import
java.security.KeyStoreException
;
import
java.security.cert.Certificate
;
import
java.security.cert.X509Certificate
;
...
...
@@ -35,7 +35,7 @@ import org.jivesoftware.openfire.Connection;
import
org.jivesoftware.openfire.SessionManager
;
import
org.jivesoftware.openfire.StreamID
;
import
org.jivesoftware.openfire.auth.UnauthorizedException
;
import
org.jivesoftware.openfire.keystore.Purpose
;
import
org.jivesoftware.openfire.keystore.Purpose
;
import
org.jivesoftware.openfire.net.SASLAuthentication
;
import
org.jivesoftware.openfire.net.SSLConfig
;
import
org.jivesoftware.openfire.net.SocketConnection
;
...
...
@@ -139,7 +139,7 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
if
(
serverVersion
[
0
]
>=
1
)
{
openingStream
.
append
(
" version=\"1.0\">"
);
}
else
{
openingStream
.
append
(
">"
);
openingStream
.
append
(
'>'
);
}
connection
.
deliverRawText
(
openingStream
.
toString
());
...
...
@@ -153,7 +153,7 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
Connection
.
TLSPolicy
.
required
;
boolean
hasCertificates
=
false
;
try
{
hasCertificates
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
).
size
()
>
0
;
hasCertificates
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
).
size
()
>
0
;
}
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -373,8 +373,8 @@ public class LocalIncomingServerSession extends LocalServerSession implements In
usingSelfSigned
=
true
;
}
else
{
try
{
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
usingSelfSigned
=
CertificateManager
.
isSelfSignedCertificate
(
keyStore
,
(
X509Certificate
)
chain
[
0
]);
final
KeyStore
keyStore
=
SSLConfig
.
getStore
(
Purpose
.
SOCKETBASED_IDENTITYSTORE
);
usingSelfSigned
=
CertificateManager
.
isSelfSignedCertificate
(
keyStore
,
(
X509Certificate
)
chain
[
0
]);
}
catch
(
KeyStoreException
ex
)
{
Log
.
warn
(
"Exception occurred while trying to determine whether local certificate is self-signed. Proceeding as if it is."
,
ex
);
usingSelfSigned
=
true
;
...
...
src/java/org/jivesoftware/openfire/user/DefaultUserProvider.java
View file @
9d3b8cfa
...
...
@@ -500,10 +500,10 @@ public class DefaultUserProvider implements UserProvider {
sb
.
delete
(
0
,
sb
.
length
());
count
=
0
;
}
sb
.
append
(
element
).
append
(
","
);
sb
.
append
(
element
).
append
(
','
);
count
++;
}
sb
.
append
(
"."
);
sb
.
append
(
'.'
);
Log
.
debug
(
callingMethod
+
" results: "
+
sb
.
toString
());
}
}
src/java/org/jivesoftware/openfire/user/JDBCUserProvider.java
View file @
9d3b8cfa
...
...
@@ -319,7 +319,7 @@ public class JDBCUserProvider implements UserProvider {
sql
.
append
(
searchSQL
);
boolean
first
=
true
;
if
(
fields
.
contains
(
"Username"
))
{
sql
.
append
(
" "
);
sql
.
append
(
' '
);
sql
.
append
(
usernameField
);
sql
.
append
(
" LIKE ?"
);
queries
++;
...
...
@@ -329,7 +329,7 @@ public class JDBCUserProvider implements UserProvider {
if
(!
first
)
{
sql
.
append
(
" AND"
);
}
sql
.
append
(
" "
);
sql
.
append
(
' '
);
sql
.
append
(
nameField
);
sql
.
append
(
" LIKE ?"
);
queries
++;
...
...
@@ -339,7 +339,7 @@ public class JDBCUserProvider implements UserProvider {
if
(!
first
)
{
sql
.
append
(
" AND"
);
}
sql
.
append
(
" "
);
sql
.
append
(
' '
);
sql
.
append
(
emailField
);
sql
.
append
(
" LIKE ?"
);
queries
++;
...
...
@@ -416,10 +416,10 @@ public class JDBCUserProvider implements UserProvider {
sb
.
delete
(
0
,
sb
.
length
());
count
=
0
;
}
sb
.
append
(
element
).
append
(
","
);
sb
.
append
(
element
).
append
(
','
);
count
++;
}
sb
.
append
(
"."
);
sb
.
append
(
'.'
);
Log
.
debug
(
callingMethod
+
" results: "
+
sb
.
toString
());
}
...
...
src/java/org/jivesoftware/util/LocaleUtils.java
View file @
9d3b8cfa
...
...
@@ -307,7 +307,7 @@ public class LocaleUtils {
offset
+=
(
int
)
JiveConstants
.
HOUR
;
}
buf
.
append
(
"("
);
buf
.
append
(
'('
);
if
(
offset
<
0
)
{
buf
.
append
(
"GMT-"
);
}
...
...
@@ -317,9 +317,9 @@ public class LocaleUtils {
offset
=
Math
.
abs
(
offset
);
int
hours
=
offset
/
(
int
)
JiveConstants
.
HOUR
;
int
minutes
=
(
offset
%
(
int
)
JiveConstants
.
HOUR
)
/
(
int
)
JiveConstants
.
MINUTE
;
buf
.
append
(
hours
).
append
(
":"
);
buf
.
append
(
hours
).
append
(
':'
);
if
(
minutes
<
10
)
{
buf
.
append
(
"0"
).
append
(
minutes
);
buf
.
append
(
'0'
).
append
(
minutes
);
}
else
{
buf
.
append
(
minutes
);
...
...
src/java/org/jivesoftware/util/StringUtils.java
View file @
9d3b8cfa
...
...
@@ -458,7 +458,7 @@ public class StringUtils {
for
(
i
=
0
;
i
<
bytes
.
length
;
i
++)
{
if
(((
int
)
bytes
[
i
]
&
0xff
)
<
0x10
)
{
buf
.
append
(
"0"
);
buf
.
append
(
'0'
);
}
buf
.
append
(
Long
.
toString
((
int
)
bytes
[
i
]
&
0xff
,
16
));
}
...
...
@@ -1010,7 +1010,7 @@ public class StringUtils {
else
if
(
delta
<
JiveConstants
.
HOUR
)
{
long
mins
=
delta
/
JiveConstants
.
MINUTE
;
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
mins
).
append
(
" "
);
sb
.
append
(
mins
).
append
(
' '
);
sb
.
append
((
mins
==
1
)
?
LocaleUtils
.
getLocalizedString
(
"global.minute"
)
:
LocaleUtils
.
getLocalizedString
(
"global.minutes"
));
return
sb
.
toString
();
}
...
...
@@ -1019,10 +1019,10 @@ public class StringUtils {
delta
-=
hours
*
JiveConstants
.
HOUR
;
long
mins
=
delta
/
JiveConstants
.
MINUTE
;
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
hours
).
append
(
" "
);
sb
.
append
(
hours
).
append
(
' '
);
sb
.
append
((
hours
==
1
)
?
LocaleUtils
.
getLocalizedString
(
"global.hour"
)
:
LocaleUtils
.
getLocalizedString
(
"global.hours"
));
sb
.
append
(
", "
);
sb
.
append
(
mins
).
append
(
" "
);
sb
.
append
(
mins
).
append
(
' '
);
sb
.
append
((
mins
==
1
)
?
LocaleUtils
.
getLocalizedString
(
"global.minute"
)
:
LocaleUtils
.
getLocalizedString
(
"global.minutes"
));
return
sb
.
toString
();
}
else
{
...
...
@@ -1032,13 +1032,13 @@ public class StringUtils {
delta
-=
hours
*
JiveConstants
.
HOUR
;
long
mins
=
delta
/
JiveConstants
.
MINUTE
;
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
days
).
append
(
" "
);
sb
.
append
(
days
).
append
(
' '
);
sb
.
append
((
days
==
1
)
?
LocaleUtils
.
getLocalizedString
(
"global.day"
)
:
LocaleUtils
.
getLocalizedString
(
"global.days"
));
sb
.
append
(
", "
);
sb
.
append
(
hours
).
append
(
" "
);
sb
.
append
(
hours
).
append
(
' '
);
sb
.
append
((
hours
==
1
)
?
LocaleUtils
.
getLocalizedString
(
"global.hour"
)
:
LocaleUtils
.
getLocalizedString
(
"global.hours"
));
sb
.
append
(
", "
);
sb
.
append
(
mins
).
append
(
" "
);
sb
.
append
(
mins
).
append
(
' '
);
sb
.
append
((
mins
==
1
)
?
LocaleUtils
.
getLocalizedString
(
"global.minute"
)
:
LocaleUtils
.
getLocalizedString
(
"global.minutes"
));
return
sb
.
toString
();
}
...
...
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