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
8175a5ea
Commit
8175a5ea
authored
Dec 01, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding debug logging.
parent
6587a3c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
LocalOutgoingServerSession.java
...software/openfire/session/LocalOutgoingServerSession.java
+10
-1
No files found.
src/java/org/jivesoftware/openfire/session/LocalOutgoingServerSession.java
View file @
8175a5ea
...
@@ -122,13 +122,16 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
...
@@ -122,13 +122,16 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
* @return True if the domain was authenticated by the remote server.
* @return True if the domain was authenticated by the remote server.
*/
*/
public
static
boolean
authenticateDomain
(
final
String
domain
,
final
String
hostname
)
{
public
static
boolean
authenticateDomain
(
final
String
domain
,
final
String
hostname
)
{
Log
.
debug
(
"[domain {} hostname {}]: Start authentication."
,
domain
,
hostname
);
if
(
hostname
==
null
||
hostname
.
length
()
==
0
||
hostname
.
trim
().
indexOf
(
' '
)
>
-
1
)
{
if
(
hostname
==
null
||
hostname
.
length
()
==
0
||
hostname
.
trim
().
indexOf
(
' '
)
>
-
1
)
{
// Do nothing if the target hostname is empty, null or contains whitespaces
// Do nothing if the target hostname is empty, null or contains whitespaces
Log
.
debug
(
"[domain {} hostname {}]: Authentication failed - null or whitespace in hostname."
,
domain
,
hostname
);
return
false
;
return
false
;
}
}
try
{
try
{
// Check if the remote hostname is in the blacklist
// Check if the remote hostname is in the blacklist
if
(!
RemoteServerManager
.
canAccess
(
hostname
))
{
if
(!
RemoteServerManager
.
canAccess
(
hostname
))
{
Log
.
debug
(
"[domain {} hostname {}]: Authentication failed - hostname in blacklist."
,
domain
,
hostname
);
return
false
;
return
false
;
}
}
...
@@ -139,11 +142,14 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
...
@@ -139,11 +142,14 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
SessionManager
sessionManager
=
SessionManager
.
getInstance
();
SessionManager
sessionManager
=
SessionManager
.
getInstance
();
if
(
sessionManager
==
null
)
{
if
(
sessionManager
==
null
)
{
// Server is shutting down while we are trying to create a new s2s connection
// Server is shutting down while we are trying to create a new s2s connection
Log
.
debug
(
"[domain {} hostname {}]: Authentication failed - no session manager available. Server might be shutting down."
,
domain
,
hostname
);
return
false
;
return
false
;
}
}
Log
.
debug
(
"[domain {} hostname {}]: Locating pre-exisiting outgoing session..."
,
domain
,
hostname
);
session
=
sessionManager
.
getOutgoingServerSession
(
hostname
);
session
=
sessionManager
.
getOutgoingServerSession
(
hostname
);
if
(
session
==
null
)
{
if
(
session
==
null
)
{
// Try locating if the remote server has previously authenticated with this server
// Try locating if the remote server has previously authenticated with this server
Log
.
debug
(
"[domain {} hostname {}]: Outgoing session found. Locating related incoming session..."
,
domain
,
hostname
);
for
(
IncomingServerSession
incomingSession
:
sessionManager
.
getIncomingServerSessions
(
hostname
))
{
for
(
IncomingServerSession
incomingSession
:
sessionManager
.
getIncomingServerSessions
(
hostname
))
{
for
(
String
otherHostname
:
incomingSession
.
getValidatedDomains
())
{
for
(
String
otherHostname
:
incomingSession
.
getValidatedDomains
())
{
session
=
sessionManager
.
getOutgoingServerSession
(
otherHostname
);
session
=
sessionManager
.
getOutgoingServerSession
(
otherHostname
);
...
@@ -151,6 +157,7 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
...
@@ -151,6 +157,7 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
if
(
session
.
isUsingServerDialback
())
{
if
(
session
.
isUsingServerDialback
())
{
// A session to the same remote server but with different hostname
// A session to the same remote server but with different hostname
// was found. Use this session.
// was found. Use this session.
Log
.
debug
(
"[domain {} hostname {}]: Incoming session found. Reuse this connection."
,
domain
,
hostname
);
break
;
break
;
}
else
{
}
else
{
session
=
null
;
session
=
null
;
...
@@ -160,6 +167,7 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
...
@@ -160,6 +167,7 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
}
}
}
}
if
(
session
==
null
)
{
if
(
session
==
null
)
{
Log
.
debug
(
"[domain {} hostname {}]: No re-usable existing connecting. Create new session."
,
domain
,
hostname
);
int
port
=
RemoteServerManager
.
getPortForServer
(
hostname
);
int
port
=
RemoteServerManager
.
getPortForServer
(
hostname
);
session
=
createOutgoingSession
(
domain
,
hostname
,
port
);
session
=
createOutgoingSession
(
domain
,
hostname
,
port
);
if
(
session
!=
null
)
{
if
(
session
!=
null
)
{
...
@@ -178,10 +186,11 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
...
@@ -178,10 +186,11 @@ public class LocalOutgoingServerSession extends LocalServerSession implements Ou
// A session already exists. The session was established using server dialback so
// A session already exists. The session was established using server dialback so
// it is possible to do piggybacking to authenticate more domains
// it is possible to do piggybacking to authenticate more domains
if
(
session
.
getAuthenticatedDomains
().
contains
(
domain
)
&&
session
.
getHostnames
().
contains
(
hostname
))
{
if
(
session
.
getAuthenticatedDomains
().
contains
(
domain
)
&&
session
.
getHostnames
().
contains
(
hostname
))
{
// Do nothing since the domain has already been authenticated
Log
.
debug
(
"[domain {} hostname {}]: Do nothing since the domain has already been authenticated."
,
domain
,
hostname
);
return
true
;
return
true
;
}
}
// A session already exists so authenticate the domain using that session
// A session already exists so authenticate the domain using that session
Log
.
debug
(
"[domain {} hostname {}]: An session already exists, so authenticate the domain using that session."
,
domain
,
hostname
);
return
session
.
authenticateSubdomain
(
domain
,
hostname
);
return
session
.
authenticateSubdomain
(
domain
,
hostname
);
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
...
...
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