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
7c49987e
Commit
7c49987e
authored
Mar 30, 2016
by
Dave Cridland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-777 CVE-2015-6973 CSRF protection (part 4)
parent
d17904be
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
235 additions
and
9 deletions
+235
-9
server-locale.jsp
src/web/server-locale.jsp
+15
-0
server-properties.jsp
src/web/server-properties.jsp
+17
-1
server-props.jsp
src/web/server-props.jsp
+15
-0
server-session-row.jspf
src/web/server-session-row.jspf
+1
-1
server-session-summary.jsp
src/web/server-session-summary.jsp
+13
-0
session-conflict.jsp
src/web/session-conflict.jsp
+13
-0
session-details.jsp
src/web/session-details.jsp
+14
-3
session-row.jspf
src/web/session-row.jspf
+1
-1
session-summary.jsp
src/web/session-summary.jsp
+13
-0
system-cache.jsp
src/web/system-cache.jsp
+13
-0
system-clustering.jsp
src/web/system-clustering.jsp
+14
-0
system-email.jsp
src/web/system-email.jsp
+11
-0
system-emailtest.jsp
src/web/system-emailtest.jsp
+13
-0
user-groups.jsp
src/web/user-groups.jsp
+18
-3
user-message.jsp
src/web/user-message.jsp
+14
-0
user-roster-add.jsp
src/web/user-roster-add.jsp
+13
-0
user-roster-delete.jsp
src/web/user-roster-delete.jsp
+12
-0
user-roster-edit.jsp
src/web/user-roster-edit.jsp
+13
-0
user-roster-view.jsp
src/web/user-roster-view.jsp
+12
-0
No files found.
src/web/server-locale.jsp
View file @
7c49987e
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
<%@ page
import=
"org.jivesoftware.util.JiveGlobals,
<%@ page
import=
"org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.LocaleUtils,
org.jivesoftware.util.LocaleUtils,
org.jivesoftware.util.Log,
org.jivesoftware.util.Log,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.util.ParamUtils"
org.jivesoftware.util.ParamUtils"
%>
%>
<%@ page
import=
"java.util.HashMap"
%>
<%@ page
import=
"java.util.HashMap"
%>
...
@@ -40,6 +42,18 @@
...
@@ -40,6 +42,18 @@
// TODO: We're not displaying this error ever.
// TODO: We're not displaying this error ever.
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
save
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
save
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
save
)
{
if
(
save
)
{
// Set the timezeone
// Set the timezeone
try
{
try
{
...
@@ -90,6 +104,7 @@
...
@@ -90,6 +104,7 @@
<!-- BEGIN locale settings -->
<!-- BEGIN locale settings -->
<form
action=
"server-locale.jsp"
method=
"post"
name=
"sform"
>
<form
action=
"server-locale.jsp"
method=
"post"
name=
"sform"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<div
class=
"jive-contentBoxHeader"
>
<div
class=
"jive-contentBoxHeader"
>
<fmt:message
key=
"locale.system.set"
/>
<fmt:message
key=
"locale.system.set"
/>
</div>
</div>
...
...
src/web/server-properties.jsp
View file @
7c49987e
...
@@ -72,6 +72,21 @@
...
@@ -72,6 +72,21 @@
return
;
return
;
}
}
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
encrypt
||
save
||
delete
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
encrypt
=
false
;
save
=
false
;
delete
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
delete
)
{
if
(
delete
)
{
if
(
propName
!=
null
)
{
if
(
propName
!=
null
)
{
JiveGlobals
.
deleteProperty
(
propName
);
JiveGlobals
.
deleteProperty
(
propName
);
...
@@ -82,7 +97,6 @@
...
@@ -82,7 +97,6 @@
}
}
}
}
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
if
(
save
)
{
if
(
save
)
{
if
(
propName
==
null
||
""
.
equals
(
propName
.
trim
())
||
propName
.
startsWith
(
"\""
))
{
if
(
propName
==
null
||
""
.
equals
(
propName
.
trim
())
||
propName
.
startsWith
(
"\""
))
{
errors
.
put
(
"propName"
,
""
);
errors
.
put
(
"propName"
,
""
);
...
@@ -254,6 +268,7 @@ function dodelete(propName) {
...
@@ -254,6 +268,7 @@ function dodelete(propName) {
</script>
</script>
<form
action=
"server-properties.jsp"
method=
"post"
name=
"propform"
>
<form
action=
"server-properties.jsp"
method=
"post"
name=
"propform"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<input
type=
"hidden"
name=
"edit"
value=
""
>
<input
type=
"hidden"
name=
"edit"
value=
""
>
<input
type=
"hidden"
name=
"encrypt"
value=
""
>
<input
type=
"hidden"
name=
"encrypt"
value=
""
>
<input
type=
"hidden"
name=
"del"
value=
""
>
<input
type=
"hidden"
name=
"del"
value=
""
>
...
@@ -346,6 +361,7 @@ function dodelete(propName) {
...
@@ -346,6 +361,7 @@ function dodelete(propName) {
<a
name=
"edit"
></a>
<a
name=
"edit"
></a>
<form
action=
"server-properties.jsp"
method=
"post"
name=
"editform"
>
<form
action=
"server-properties.jsp"
method=
"post"
name=
"editform"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<div
class=
"jive-table"
>
<div
class=
"jive-table"
>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
width=
"100%"
>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
width=
"100%"
>
...
...
src/web/server-props.jsp
View file @
7c49987e
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
<%@ page
import=
"org.jivesoftware.util.JiveGlobals,
<%@ page
import=
"org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.openfire.ConnectionManager,
org.jivesoftware.openfire.ConnectionManager,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.openfire.XMPPServer,
org.jivesoftware.openfire.JMXManager,
org.jivesoftware.openfire.JMXManager,
...
@@ -76,6 +78,18 @@
...
@@ -76,6 +78,18 @@
XMPPServer
server
=
webManager
.
getXMPPServer
();
XMPPServer
server
=
webManager
.
getXMPPServer
();
ConnectionManager
connectionManager
=
XMPPServer
.
getInstance
().
getConnectionManager
();
ConnectionManager
connectionManager
=
XMPPServer
.
getInstance
().
getConnectionManager
();
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
save
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
save
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
save
)
{
if
(
save
)
{
if
(
serverName
==
null
)
{
if
(
serverName
==
null
)
{
errors
.
put
(
"serverName"
,
""
);
errors
.
put
(
"serverName"
,
""
);
...
@@ -206,6 +220,7 @@
...
@@ -206,6 +220,7 @@
<%
}
%>
<%
}
%>
<form
action=
"server-props.jsp"
name=
"editform"
method=
"post"
>
<form
action=
"server-props.jsp"
name=
"editform"
method=
"post"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<div
class=
"jive-table"
>
<div
class=
"jive-table"
>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
width=
"100%"
>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
width=
"100%"
>
...
...
src/web/server-session-row.jspf
View file @
7c49987e
...
@@ -120,7 +120,7 @@
...
@@ -120,7 +120,7 @@
</td>
</td>
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
<a href="server-session-summary.jsp?hostname=<%= URLEncoder.encode(host, "UTF-8") %>&close=true"
<a href="server-session-summary.jsp?hostname=<%= URLEncoder.encode(host, "UTF-8") %>&close=true
&csrf=${csrf}
"
title="<fmt:message key="session.row.cliked_kill_session" />"
title="<fmt:message key="session.row.cliked_kill_session" />"
onclick="return confirm('<fmt:message key="session.row.confirm_close" />');"
onclick="return confirm('<fmt:message key="session.row.confirm_close" />');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
...
...
src/web/server-session-summary.jsp
View file @
7c49987e
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
org.jivesoftware.openfire.session.OutgoingServerSession,
org.jivesoftware.openfire.session.OutgoingServerSession,
org.jivesoftware.openfire.session.Session,
org.jivesoftware.openfire.session.Session,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
java.util.*"
java.util.*"
errorPage=
"error.jsp"
errorPage=
"error.jsp"
%>
%>
...
@@ -41,6 +43,17 @@
...
@@ -41,6 +43,17 @@
boolean
close
=
ParamUtils
.
getBooleanParameter
(
request
,
"close"
);
boolean
close
=
ParamUtils
.
getBooleanParameter
(
request
,
"close"
);
String
hostname
=
ParamUtils
.
getParameter
(
request
,
"hostname"
);
String
hostname
=
ParamUtils
.
getParameter
(
request
,
"hostname"
);
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
close
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
close
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
request
.
getParameter
(
"range"
)
!=
null
)
{
if
(
request
.
getParameter
(
"range"
)
!=
null
)
{
webManager
.
setRowsPerPage
(
"server-session-summary"
,
range
);
webManager
.
setRowsPerPage
(
"server-session-summary"
,
range
);
}
}
...
...
src/web/session-conflict.jsp
View file @
7c49987e
...
@@ -49,6 +49,18 @@
...
@@ -49,6 +49,18 @@
// Update the session kick policy if requested
// Update the session kick policy if requested
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
update
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
update
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
update
)
{
if
(
update
)
{
// Validate params
// Validate params
if
(
kickPolicy
!=
0
&&
kickPolicy
!=
1
&&
kickPolicy
!=
SessionManager
.
NEVER_KICK
)
{
if
(
kickPolicy
!=
0
&&
kickPolicy
!=
1
&&
kickPolicy
!=
SessionManager
.
NEVER_KICK
)
{
...
@@ -93,6 +105,7 @@
...
@@ -93,6 +105,7 @@
<!-- BEGIN 'Set Conflict Policy' -->
<!-- BEGIN 'Set Conflict Policy' -->
<form
action=
"session-conflict.jsp"
method=
"post"
>
<form
action=
"session-conflict.jsp"
method=
"post"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<div
class=
"jive-contentBoxHeader"
>
<div
class=
"jive-contentBoxHeader"
>
<fmt:message
key=
"session.conflict.policy"
/>
<fmt:message
key=
"session.conflict.policy"
/>
</div>
</div>
...
...
src/web/session-details.jsp
View file @
7c49987e
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
java.text.NumberFormat,
java.text.NumberFormat,
java.util.Collection"
java.util.Collection"
errorPage=
"error.jsp"
errorPage=
"error.jsp"
...
@@ -41,7 +42,15 @@
...
@@ -41,7 +42,15 @@
<%
// Get parameters
<%
// Get parameters
String
jid
=
ParamUtils
.
getParameter
(
request
,
"jid"
);
String
jid
=
ParamUtils
.
getParameter
(
request
,
"jid"
);
// Handle a "go back" click:
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
// ATTN: No check here, because no actions.
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Handle a "go back" click:
if
(
request
.
getParameter
(
"back"
)
!=
null
)
{
if
(
request
.
getParameter
(
"back"
)
!=
null
)
{
response
.
sendRedirect
(
"session-summary.jsp"
);
response
.
sendRedirect
(
"session-summary.jsp"
);
return
;
return
;
...
@@ -71,8 +80,10 @@
...
@@ -71,8 +80,10 @@
// Handle a "message" click:
// Handle a "message" click:
if
(
request
.
getParameter
(
"message"
)
!=
null
)
{
if
(
request
.
getParameter
(
"message"
)
!=
null
)
{
response
.
sendRedirect
(
"user-message.jsp?username="
+
URLEncoder
.
encode
(
user
.
getUsername
(),
"UTF-8"
));
if
(
csrfCookie
!=
null
&&
csrfParam
!=
null
&&
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
return
;
response
.
sendRedirect
(
"user-message.jsp?username="
+
URLEncoder
.
encode
(
user
.
getUsername
(),
"UTF-8"
));
return
;
}
}
}
// See if there are multiple sessions for this user:
// See if there are multiple sessions for this user:
...
...
src/web/session-row.jspf
View file @
7c49987e
...
@@ -178,7 +178,7 @@
...
@@ -178,7 +178,7 @@
</td>
</td>
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
<td width="1%" nowrap align="center" style="border-right:1px #ccc solid;">
<a href="session-summary.jsp?jid=<%= URLEncoder.encode(sess.getAddress().toString(), "UTF-8") %>&close=true"
<a href="session-summary.jsp?jid=<%= URLEncoder.encode(sess.getAddress().toString(), "UTF-8") %>&close=true
&csrf=${csrf}
"
title="<fmt:message key="session.row.cliked_kill_session" />"
title="<fmt:message key="session.row.cliked_kill_session" />"
onclick="return confirm('<fmt:message key="session.row.confirm_close" />');"
onclick="return confirm('<fmt:message key="session.row.confirm_close" />');"
><img src="images/delete-16x16.gif" width="16" height="16" border="0" alt=""></a>
><img src="images/delete-16x16.gif" width="16" height="16" border="0" alt=""></a>
...
...
src/web/session-summary.jsp
View file @
7c49987e
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
org.jivesoftware.openfire.session.ClientSession,
org.jivesoftware.openfire.session.ClientSession,
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.util.StringUtils,
java.util.Collection"
java.util.Collection"
errorPage=
"error.jsp"
errorPage=
"error.jsp"
%>
%>
...
@@ -68,6 +70,17 @@
...
@@ -68,6 +70,17 @@
// Get the session count
// Get the session count
int
sessionCount
=
sessionManager
.
getUserSessionsCount
(
false
);
int
sessionCount
=
sessionManager
.
getUserSessionsCount
(
false
);
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
close
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
close
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Close a connection if requested
// Close a connection if requested
if
(
close
)
{
if
(
close
)
{
JID
address
=
new
JID
(
jid
);
JID
address
=
new
JID
(
jid
);
...
...
src/web/system-cache.jsp
View file @
7c49987e
<%@ page
import=
"org.jivesoftware.util.cache.Cache"
%>
<%@ page
import=
"org.jivesoftware.util.cache.Cache"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.StringUtils"
%>
<%@ page
import=
"org.jivesoftware.util.StringUtils"
%>
<%@ page
import=
"org.jivesoftware.util.CookieUtils"
%>
<%@ page
import=
"java.text.DecimalFormat"
%>
<%@ page
import=
"java.text.DecimalFormat"
%>
<%--
<%--
- $RCSfile$
- $RCSfile$
...
@@ -108,6 +109,17 @@
...
@@ -108,6 +109,17 @@
// Get the list of existing caches
// Get the list of existing caches
Cache
[]
caches
=
webManager
.
getCaches
();
Cache
[]
caches
=
webManager
.
getCaches
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
doClearCache
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
doClearCache
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Clear one or multiple caches if requested.
// Clear one or multiple caches if requested.
if
(
doClearCache
)
{
if
(
doClearCache
)
{
for
(
int
cacheID
:
cacheIDs
)
{
for
(
int
cacheID
:
cacheIDs
)
{
...
@@ -152,6 +164,7 @@
...
@@ -152,6 +164,7 @@
%>
%>
<form
action=
"system-cache.jsp"
method=
"post"
name=
"cacheForm"
>
<form
action=
"system-cache.jsp"
method=
"post"
name=
"cacheForm"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<div
class=
"jive-table"
>
<div
class=
"jive-table"
>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
width=
"100%"
>
<table
cellpadding=
"0"
cellspacing=
"0"
border=
"0"
width=
"100%"
>
...
...
src/web/system-clustering.jsp
View file @
7c49987e
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
<%@ page
import=
"org.jivesoftware.util.JiveGlobals"
%>
<%@ page
import=
"org.jivesoftware.util.JiveGlobals"
%>
<%@ page
import=
"org.jivesoftware.util.Log"
%>
<%@ page
import=
"org.jivesoftware.util.Log"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.CookieUtils"
%>
<%@ page
import=
"org.jivesoftware.util.StringUtils"
%>
<%@ page
import=
"org.jivesoftware.util.cache.CacheFactory"
%>
<%@ page
import=
"org.jivesoftware.util.cache.CacheFactory"
%>
<%@ page
import=
"java.text.DecimalFormat"
%>
<%@ page
import=
"java.text.DecimalFormat"
%>
<%@ page
import=
"java.util.Arrays"
%>
<%@ page
import=
"java.util.Arrays"
%>
...
@@ -60,6 +62,17 @@
...
@@ -60,6 +62,17 @@
boolean
clusteringEnabled
=
ParamUtils
.
getBooleanParameter
(
request
,
"clusteringEnabled"
);
boolean
clusteringEnabled
=
ParamUtils
.
getBooleanParameter
(
request
,
"clusteringEnabled"
);
boolean
updateSucess
=
false
;
boolean
updateSucess
=
false
;
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
update
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
update
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
update
)
{
if
(
update
)
{
if
(!
clusteringEnabled
)
{
if
(!
clusteringEnabled
)
{
ClusterManager
.
setClusteringEnabled
(
false
);
ClusterManager
.
setClusteringEnabled
(
false
);
...
@@ -187,6 +200,7 @@
...
@@ -187,6 +200,7 @@
<!-- BEGIN 'Clustering Enabled' -->
<!-- BEGIN 'Clustering Enabled' -->
<form
action=
"system-clustering.jsp"
method=
"post"
>
<form
action=
"system-clustering.jsp"
method=
"post"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<div
class=
"jive-contentBoxHeader"
>
<div
class=
"jive-contentBoxHeader"
>
<fmt:message
key=
"system.clustering.enabled.legend"
/>
<fmt:message
key=
"system.clustering.enabled.legend"
/>
</div>
</div>
...
...
src/web/system-email.jsp
View file @
7c49987e
...
@@ -36,6 +36,17 @@
...
@@ -36,6 +36,17 @@
boolean
test
=
request
.
getParameter
(
"test"
)
!=
null
;
boolean
test
=
request
.
getParameter
(
"test"
)
!=
null
;
boolean
debug
=
ParamUtils
.
getBooleanParameter
(
request
,
"debug"
);
boolean
debug
=
ParamUtils
.
getBooleanParameter
(
request
,
"debug"
);
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
save
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
save
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Handle a test request
// Handle a test request
if
(
test
)
{
if
(
test
)
{
response
.
sendRedirect
(
"system-emailtest.jsp"
);
response
.
sendRedirect
(
"system-emailtest.jsp"
);
...
...
src/web/system-emailtest.jsp
View file @
7c49987e
...
@@ -53,6 +53,18 @@
...
@@ -53,6 +53,18 @@
// Validate input
// Validate input
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
doTest
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
doTest
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
doTest
)
{
if
(
doTest
)
{
if
(
from
==
null
)
{
if
(
from
==
null
)
{
errors
.
put
(
"from"
,
""
);
errors
.
put
(
"from"
,
""
);
...
@@ -215,6 +227,7 @@ function checkClick(el) {
...
@@ -215,6 +227,7 @@ function checkClick(el) {
<%
}
%>
<%
}
%>
<form
action=
"system-emailtest.jsp"
method=
"post"
name=
"f"
onsubmit=
"return checkClick(this);"
>
<form
action=
"system-emailtest.jsp"
method=
"post"
name=
"f"
onsubmit=
"return checkClick(this);"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<table
cellpadding=
"3"
cellspacing=
"0"
border=
"0"
>
<table
cellpadding=
"3"
cellspacing=
"0"
border=
"0"
>
<tbody>
<tbody>
...
...
src/web/user-groups.jsp
View file @
7c49987e
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
<%@ page
import=
"org.jivesoftware.util.Log"
%>
<%@ page
import=
"org.jivesoftware.util.Log"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.ParamUtils"
%>
<%@ page
import=
"org.jivesoftware.util.StringUtils"
%>
<%@ page
import=
"org.jivesoftware.util.StringUtils"
%>
<%@ page
import=
"org.jivesoftware.util.CookieUtils"
%>
<%@ page
import=
"org.xmpp.packet.JID"
%>
<%@ page
import=
"org.xmpp.packet.JID"
%>
<%@ page
import=
"org.xmpp.packet.Presence"
%>
<%@ page
import=
"org.xmpp.packet.Presence"
%>
<%@ page
import=
"java.io.UnsupportedEncodingException"
%>
<%@ page
import=
"java.io.UnsupportedEncodingException"
%>
...
@@ -53,7 +54,21 @@
...
@@ -53,7 +54,21 @@
boolean
success
=
ParamUtils
.
getBooleanParameter
(
request
,
"updatesuccess"
);
boolean
success
=
ParamUtils
.
getBooleanParameter
(
request
,
"updatesuccess"
);
String
username
=
StringUtils
.
escapeHTMLTags
(
ParamUtils
.
getParameter
(
request
,
"username"
));
String
username
=
StringUtils
.
escapeHTMLTags
(
ParamUtils
.
getParameter
(
request
,
"username"
));
JID
jid
=
webManager
.
getXMPPServer
().
createJID
(
username
,
null
);
JID
jid
=
webManager
.
getXMPPServer
().
createJID
(
username
,
null
);
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
add
!=
null
||
delete
!=
null
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
add
=
null
;
delete
=
null
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
add
!=
null
)
{
if
(
add
!=
null
)
{
try
{
try
{
Group
group
=
webManager
.
getGroupManager
().
getGroup
(
add
);
Group
group
=
webManager
.
getGroupManager
().
getGroup
(
add
);
...
@@ -191,7 +206,7 @@
...
@@ -191,7 +206,7 @@
%></td>
%></td>
<td
width=
"5%"
><a
<td
width=
"5%"
><a
href=
"user-groups.jsp?username=
<%=
URLEncoder
.
encode
(
user
.
getUsername
(),
"UTF-8"
)
%>
&delete=
<%=
groupName
%>
"
href=
"user-groups.jsp?username=
<%=
URLEncoder
.
encode
(
user
.
getUsername
(),
"UTF-8"
)
%>
&delete=
<%=
groupName
%>
&csrf=${csrf}
"
title=
"
<fmt:message
key=
"global.click_delete"
/>
"
><img
title=
"
<fmt:message
key=
"global.click_delete"
/>
"
><img
src=
"images/delete-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
src=
"images/delete-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
"
<fmt:message
key=
"global.click_delete"
/>
"
></a></td>
alt=
"
<fmt:message
key=
"global.click_delete"
/>
"
></a></td>
...
@@ -319,7 +334,7 @@
...
@@ -319,7 +334,7 @@
%></td>
%></td>
<td
width=
"5%"
><a
<td
width=
"5%"
><a
href=
"user-groups.jsp?username=
<%=
URLEncoder
.
encode
(
user
.
getUsername
(),
"UTF-8"
)
%>
&add=
<%=
groupName
%>
"
href=
"user-groups.jsp?username=
<%=
URLEncoder
.
encode
(
user
.
getUsername
(),
"UTF-8"
)
%>
&add=
<%=
groupName
%>
&csrf=${csrf}
"
title=
"
<fmt:message
key=
"global.click_add"
/>
"
>
<img
title=
"
<fmt:message
key=
"global.click_add"
/>
"
>
<img
src=
"images/add-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
src=
"images/add-16x16.gif"
width=
"16"
height=
"16"
border=
"0"
alt=
"
<fmt:message
key=
"global.click_add"
/>
"
></a></td>
alt=
"
<fmt:message
key=
"global.click_add"
/>
"
></a></td>
...
...
src/web/user-message.jsp
View file @
7c49987e
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
org.jivesoftware.openfire.SessionManager,
org.jivesoftware.openfire.SessionManager,
org.jivesoftware.openfire.session.ClientSession,
org.jivesoftware.openfire.session.ClientSession,
org.jivesoftware.openfire.user.User,
org.jivesoftware.openfire.user.User,
...
@@ -71,6 +72,18 @@
...
@@ -71,6 +72,18 @@
// Handle the request to send a message:
// Handle the request to send a message:
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Map
<
String
,
String
>
errors
=
new
HashMap
<
String
,
String
>
();
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
send
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
send
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
if
(
send
)
{
if
(
send
)
{
// Validate the message and jid
// Validate the message and jid
if
(
jid
==
null
&&
!
sendToAll
&&
user
!=
null
)
{
if
(
jid
==
null
&&
!
sendToAll
&&
user
!=
null
)
{
...
@@ -169,6 +182,7 @@ function updateSelect(el) {
...
@@ -169,6 +182,7 @@ function updateSelect(el) {
</script>
</script>
<form
action=
"user-message.jsp"
method=
"post"
name=
"f"
>
<form
action=
"user-message.jsp"
method=
"post"
name=
"f"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<%
if
(
username
!=
null
){
%>
<%
if
(
username
!=
null
){
%>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
<%
}
%>
<%
}
%>
...
...
src/web/user-roster-add.jsp
View file @
7c49987e
...
@@ -50,6 +50,18 @@
...
@@ -50,6 +50,18 @@
response
.
sendRedirect
(
"user-roster.jsp?username="
+
URLEncoder
.
encode
(
username
,
"UTF-8"
));
response
.
sendRedirect
(
"user-roster.jsp?username="
+
URLEncoder
.
encode
(
username
,
"UTF-8"
));
return
;
return
;
}
}
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
add
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
add
=
false
;
errors
.
put
(
"csrf"
,
"CSRF Failure!"
);
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Handle a request to create a user:
// Handle a request to create a user:
if
(
add
)
{
if
(
add
)
{
...
@@ -155,6 +167,7 @@
...
@@ -155,6 +167,7 @@
<%
}
%>
<%
}
%>
<form
name=
"f"
action=
"user-roster-add.jsp"
method=
"get"
>
<form
name=
"f"
action=
"user-roster-add.jsp"
method=
"get"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
...
...
src/web/user-roster-delete.jsp
View file @
7c49987e
...
@@ -42,6 +42,17 @@
...
@@ -42,6 +42,17 @@
pageContext
.
setAttribute
(
"usernameUrlEncoded"
,
usernameUrlEncoded
);
pageContext
.
setAttribute
(
"usernameUrlEncoded"
,
usernameUrlEncoded
);
pageContext
.
setAttribute
(
"jid"
,
jid
);
pageContext
.
setAttribute
(
"jid"
,
jid
);
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
delete
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
delete
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Handle a cancel
// Handle a cancel
if
(
cancel
)
{
if
(
cancel
)
{
response
.
sendRedirect
(
"user-roster.jsp?username="
+
usernameUrlEncoded
);
response
.
sendRedirect
(
"user-roster.jsp?username="
+
usernameUrlEncoded
);
...
@@ -79,6 +90,7 @@
...
@@ -79,6 +90,7 @@
</p>
</p>
<form
action=
"user-roster-delete.jsp"
>
<form
action=
"user-roster-delete.jsp"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<input
type=
"hidden"
name=
"username"
value=
"${usernameUrlEncoded}"
>
<input
type=
"hidden"
name=
"username"
value=
"${usernameUrlEncoded}"
>
<input
type=
"hidden"
name=
"jid"
value=
"${jid}"
>
<input
type=
"hidden"
name=
"jid"
value=
"${jid}"
>
<input
type=
"submit"
name=
"delete"
value=
"
<fmt:message
key=
"user.roster.delete.delete"
/>
"
>
<input
type=
"submit"
name=
"delete"
value=
"
<fmt:message
key=
"user.roster.delete.delete"
/>
"
>
...
...
src/web/user-roster-edit.jsp
View file @
7c49987e
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
java.net.URLEncoder"
java.net.URLEncoder"
errorPage=
"error.jsp"
errorPage=
"error.jsp"
%><%@ page
import=
"org.xmpp.packet.JID"
%>
%><%@ page
import=
"org.xmpp.packet.JID"
%>
...
@@ -54,6 +55,17 @@
...
@@ -54,6 +55,17 @@
// Load the roster item from the user's roster.
// Load the roster item from the user's roster.
RosterItem
item
=
roster
.
getRosterItem
(
new
JID
(
jid
));
RosterItem
item
=
roster
.
getRosterItem
(
new
JID
(
jid
));
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
save
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
save
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Handle a roster item delete:
// Handle a roster item delete:
if
(
save
)
{
if
(
save
)
{
...
@@ -91,6 +103,7 @@
...
@@ -91,6 +103,7 @@
</p>
</p>
<form
action=
"user-roster-edit.jsp"
>
<form
action=
"user-roster-edit.jsp"
>
<input
type=
"hidden"
name=
"csrf"
value=
"${csrf}"
>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
<input
type=
"hidden"
name=
"username"
value=
"
<%=
StringUtils
.
escapeForXML
(
username
)
%>
"
>
<input
type=
"hidden"
name=
"jid"
value=
"
<%=
StringUtils
.
escapeForXML
(
jid
)
%>
"
>
<input
type=
"hidden"
name=
"jid"
value=
"
<%=
StringUtils
.
escapeForXML
(
jid
)
%>
"
>
...
...
src/web/user-roster-view.jsp
View file @
7c49987e
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
<%@ page
import=
"org.jivesoftware.util.ParamUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.StringUtils,
org.jivesoftware.util.CookieUtils,
java.net.URLEncoder"
java.net.URLEncoder"
errorPage=
"error.jsp"
errorPage=
"error.jsp"
%><%@ page
import=
"org.xmpp.packet.JID"
%>
%><%@ page
import=
"org.xmpp.packet.JID"
%>
...
@@ -54,6 +55,17 @@
...
@@ -54,6 +55,17 @@
// Load the roster item from the user's roster.
// Load the roster item from the user's roster.
RosterItem
item
=
roster
.
getRosterItem
(
new
JID
(
jid
));
RosterItem
item
=
roster
.
getRosterItem
(
new
JID
(
jid
));
Cookie
csrfCookie
=
CookieUtils
.
getCookie
(
request
,
"csrf"
);
String
csrfParam
=
ParamUtils
.
getParameter
(
request
,
"csrf"
);
if
(
save
)
{
if
(
csrfCookie
==
null
||
csrfParam
==
null
||
!
csrfCookie
.
getValue
().
equals
(
csrfParam
))
{
save
=
false
;
}
}
csrfParam
=
StringUtils
.
randomString
(
15
);
CookieUtils
.
setCookie
(
request
,
response
,
"csrf"
,
csrfParam
,
-
1
);
pageContext
.
setAttribute
(
"csrf"
,
csrfParam
);
// Handle a roster item delete:
// Handle a roster item delete:
if
(
save
)
{
if
(
save
)
{
List
<
String
>
groupList
=
new
ArrayList
<
String
>
();
List
<
String
>
groupList
=
new
ArrayList
<
String
>
();
...
...
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