Commit a6b7d090 authored by Dele Olajide's avatar Dele Olajide

Merge pull request #58 from surevine/dwd/OF-834

OF-834: Close Open_redirect
parents d0f3851d 549dc1a1
......@@ -17,6 +17,8 @@
<%@ page import="java.util.Map" %>
<%@ page import="org.jivesoftware.util.*" %>
<%@ page import="org.jivesoftware.admin.LoginLimitManager" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.lang.StringBuilder" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
......@@ -31,8 +33,30 @@
return "index.jsp";
}
else {
if (url.startsWith("/")) {
return url;
}
try {
URL u = new URL(url);
StringBuilder s = new StringBuilder();
if (u.getPath().equals("")) {
s.append("/");
} else {
s.append(u.getPath());
}
if (u.getQuery() != null) {
s.append('?');
s.append(u.getQuery());
}
if (u.getRef() != null) {
s.append('#');
s.append(u.getRef());
}
return s.toString();
} catch(Exception e) {
return "index.jsp";
}
}
}
%>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment