Fixes for file manager access via webmin servers index
authorJamie Cameron <jcameron@webmin.com>
Fri, 21 May 2010 06:18:35 +0000 (23:18 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 21 May 2010 06:18:35 +0000 (23:18 -0700)
file/CHANGELOG
file/FileManager.java
servers/link.cgi

index 75c63d7..eee5535 100644 (file)
@@ -49,3 +49,5 @@ Added a button to the compressed file extraction dialog to show the contents of
 Fixed bugs that broke the file manager under the new Webmin API module.
 ---- Changes since 1.470 ----
 Fixed a bug that prevented setuid and setgid permissions from being changed.
+---- Changes since 1.510 ----
+Bug fixes to allow the File Manager module to be used via Webmin Servers Index or Cloudmin.
index 817f43a..9434d86 100644 (file)
@@ -65,6 +65,9 @@ public class FileManager extends Applet
        // Full session cookie
        String session;
 
+       // HTTP referer
+       String referer;
+
        // Archive parameter
        String archive;
 
@@ -110,6 +113,7 @@ public class FileManager extends Applet
                }
        trust = getParameter("trust");
        session = getParameter("session");
+       referer = getDocumentBase().toString();
        extra = getParameter("extra");
        if (extra == null) extra = "";
        images = getParameter("images");
@@ -443,6 +447,7 @@ public class FileManager extends Applet
        {
        if (session != null)
                conn.setRequestProperty("Cookie", session);
+       conn.setRequestProperty("Referer", referer);
        }
 
        // Fill the multicolumn list with files from some directory
index 5ef5352..dbab4dc 100755 (executable)
@@ -2,6 +2,11 @@
 # link.cgi
 # Forward the URL from path_info on to another webmin server
 
+if ($ENV{'PATH_INFO'} =~ /^\/(\d+)\/([a-zA-Z0-9\-\/]+)\.(jar|class|gif|png)$/) {
+       # Allow fetches of Java classes and images without a referer header,
+       # as Java sometimes doesn't provide these
+       $trust_unknown_referers = 1;
+       }
 require './servers-lib.pl';
 $ENV{'PATH_INFO'} =~ /^\/(\d+)(.*)$/ ||
        &error("Bad PATH_INFO : $ENV{'PATH_INFO'}");