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
c67ce9a7
Commit
c67ce9a7
authored
Sep 07, 2017
by
Richard Midwinter
Committed by
Guus der Kinderen
Sep 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1020: Admin Console Remote File Inclusion
parent
49628cb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
26 deletions
+49
-26
UpdateManager.java
src/java/org/jivesoftware/openfire/update/UpdateManager.java
+49
-26
No files found.
src/java/org/jivesoftware/openfire/update/UpdateManager.java
View file @
c67ce9a7
...
@@ -73,7 +73,7 @@ public class UpdateManager extends BasicModule {
...
@@ -73,7 +73,7 @@ public class UpdateManager extends BasicModule {
/**
/**
* URL of the servlet (JSP) that provides the "check for update" service.
* URL of the servlet (JSP) that provides the "check for update" service.
*/
*/
private
static
String
updateServiceURL
=
"http://www.igniterealtime.org/projects/openfire/versions.jsp"
;
private
static
String
updateServiceURL
=
"http
s
://www.igniterealtime.org/projects/openfire/versions.jsp"
;
/**
/**
* Information about the available server update.
* Information about the available server update.
...
@@ -267,34 +267,57 @@ public class UpdateManager extends BasicModule {
...
@@ -267,34 +267,57 @@ public class UpdateManager extends BasicModule {
hc
.
setProxy
(
getProxyHost
(),
getProxyPort
());
hc
.
setProxy
(
getProxyHost
(),
getProxyPort
());
httpClient
.
setHostConfiguration
(
hc
);
httpClient
.
setHostConfiguration
(
hc
);
}
}
GetMethod
getMethod
=
new
GetMethod
(
url
);
//execute the method
if
(
isKnownPlugin
(
url
))
{
try
{
GetMethod
getMethod
=
new
GetMethod
(
url
);
int
statusCode
=
httpClient
.
executeMethod
(
getMethod
);
//execute the method
if
(
statusCode
==
200
)
{
try
{
//get the resonse as an InputStream
int
statusCode
=
httpClient
.
executeMethod
(
getMethod
);
try
(
InputStream
in
=
getMethod
.
getResponseBodyAsStream
())
{
if
(
statusCode
==
200
)
{
String
pluginFilename
=
url
.
substring
(
url
.
lastIndexOf
(
"/"
)
+
1
);
//get the resonse as an InputStream
installed
=
XMPPServer
.
getInstance
().
getPluginManager
()
try
(
InputStream
in
=
getMethod
.
getResponseBodyAsStream
())
{
.
installPlugin
(
in
,
pluginFilename
);
String
pluginFilename
=
url
.
substring
(
url
.
lastIndexOf
(
"/"
)
+
1
);
}
installed
=
XMPPServer
.
getInstance
().
getPluginManager
()
if
(
installed
)
{
.
installPlugin
(
in
,
pluginFilename
);
// Remove the plugin from the list of plugins to update
}
for
(
Update
update
:
pluginUpdates
)
{
if
(
installed
)
{
if
(
update
.
getURL
().
equals
(
url
))
{
// Remove the plugin from the list of plugins to update
update
.
setDownloaded
(
true
);
for
(
Update
update
:
pluginUpdates
)
{
}
if
(
update
.
getURL
().
equals
(
url
))
{
}
update
.
setDownloaded
(
true
);
// Save response in a file for later retrieval
}
saveLatestServerInfo
();
}
}
// Save response in a file for later retrieval
}
saveLatestServerInfo
();
}
}
catch
(
IOException
e
)
{
}
Log
.
warn
(
"Error downloading new plugin version"
,
e
);
}
catch
(
IOException
e
)
{
Log
.
warn
(
"Error downloading new plugin version"
,
e
);
}
}
else
{
Log
.
error
(
"Invalid plugin download URL: "
+
url
);
}
}
return
installed
;
return
installed
;
}
}
/**
* Check if the plugin URL is in the known list of available plugins.
*
* i.e. that it's an approved download source.
*
* @param url The URL of the plugin to download.
* @return true if the URL is in the list. Otherwise false.
*/
private
boolean
isKnownPlugin
(
String
url
)
{
for
(
String
pluginName
:
availablePlugins
.
keySet
())
{
if
(
availablePlugins
.
get
(
pluginName
).
getDownloadURL
().
toString
().
equals
(
url
))
{
return
true
;
}
}
return
false
;
}
/**
/**
* Returns true if the plugin downloaded from the specified URL has been downloaded. Plugins
* Returns true if the plugin downloaded from the specified URL has been downloaded. Plugins
...
...
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