Author: toad
Date: 2007-03-19 23:44:49 +0000 (Mon, 19 Mar 2007)
New Revision: 12228

Modified:
   trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java
   trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
   trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
   trunk/freenet/src/freenet/clients/http/NinjaSpider.java
   trunk/freenet/src/freenet/clients/http/PageMaker.java
   trunk/freenet/src/freenet/clients/http/PluginToadlet.java
   trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
   trunk/freenet/src/freenet/clients/http/QueueToadlet.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/Spider.java
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
   trunk/freenet/src/freenet/clients/http/Toadlet.java
   trunk/freenet/src/freenet/clients/http/ToadletContainer.java
   trunk/freenet/src/freenet/clients/http/ToadletContext.java
   trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
   trunk/freenet/src/freenet/io/AllowedHosts.java
   trunk/plugins/MDNSDiscovery/MDNSDiscovery.java
Log:
fproxy.allowedHostsFullAccess. Defaults to 127.0.0.1. Controls access to the 
darknet page, the n2ntm page, the config page etc. NOT the queue page, there 
will later be a separate mechanism for that.

Modified: trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java      
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java      
2007-03-19 23:44:49 UTC (rev 12228)
@@ -183,7 +183,7 @@
                }


-               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet 
browser testing tool");
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet 
browser testing tool", ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                contentNode.addChild(core.alerts.createSummary());

Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2007-03-19 
23:44:49 UTC (rev 12228)
@@ -46,6 +46,11 @@
                        return;
                }

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);

                for(int i=0; i<sc.length ; i++){
@@ -74,7 +79,7 @@
                }
                core.storeConfig();

-               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Configuration Applied");
+               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Configuration Applied", ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                if (errbuf.length() == 0) {
@@ -99,11 +104,17 @@
        }

        public void handleGet(URI uri, HTTPRequest req, ToadletContext ctx) 
throws ToadletContextClosedException, IOException {
+               
+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                SubConfig[] sc = config.getConfigs();
                Arrays.sort(sc);
                boolean advancedModeEnabled = core.isAdvancedModeEnabled();

-               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet 
Node Configuration of " + node.getMyName());
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet 
Node Configuration of " + node.getMyName(), ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                contentNode.addChild(core.alerts.createSummary());

Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2007-03-19 23:44:49 UTC (rev 12228)
@@ -63,6 +63,11 @@
                        return;
                }

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                final boolean advancedModeEnabled = 
node.isAdvancedModeEnabled();
                final boolean fProxyJavascriptEnabled = 
node.isFProxyJavascriptEnabled();

@@ -133,7 +138,7 @@
                        titleCountString = (numberOfNotConnected + 
numberOfSimpleConnected)>0 ? String.valueOf(numberOfSimpleConnected) : "";
                }

-               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(titleCountString + " Darknet Peers of " + 
node.getMyName());
+               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(titleCountString + " Darknet Peers of " + 
node.getMyName(), ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                // FIXME! We need some nice images
@@ -617,6 +622,11 @@
        public void handlePost(URI uri, final HTTPRequest request, 
ToadletContext ctx) throws ToadletContextClosedException, IOException, 
RedirectException {
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                String pass = request.getPartAsString("formPassword", 32);
                if((pass == null) || !pass.equals(core.formPassword)) {
                        MultiValueTable headers = new MultiValueTable();
@@ -717,7 +727,7 @@
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                        return;
                } else if (request.isPartSet("doAction") && 
request.getPartAsString("action",25).equals("send_n2ntm")) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Send Node to Node Text Message");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Send Node to Node Text Message", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        PeerNode[] peerNodes = node.getDarknetConnections();
                        HashMap peers = new HashMap();
@@ -894,7 +904,7 @@
                                                if(logMINOR) Logger.minor(this, 
"Removed node: node_"+peerNodes[i].hashCode());
                                        }else{
                                                if(logMINOR) Logger.minor(this, 
"Refusing to remove : node_"+peerNodes[i].hashCode()+" (trying to prevent 
network churn) : let's display the warning message.");
-                                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Please confirm");
+                                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Please confirm", ctx);
                                                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                                                HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-warning", "Node 
removal"));
                                                HTMLNode content = 
ctx.getPageMaker().getContentNode(infobox);

Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2007-03-19 
23:44:49 UTC (rev 12228)
@@ -106,7 +106,7 @@
                                mimeType = fo.type;

                                if(horribleEvilHack(data) && 
!(mimeType.startsWith("application/rss+xml"))) {
-                                       HTMLNode pageNode = 
context.getPageMaker().getPageNode("Potentially Dangerous Content (RSS)");
+                                       HTMLNode pageNode = 
context.getPageMaker().getPageNode("Potentially Dangerous Content (RSS)", 
context);
                                        HTMLNode contentNode = 
context.getPageMaker().getContentNode(pageNode);

                                        HTMLNode infobox = 
contentNode.addChild("div", "class", "infobox infobox-alert");
@@ -166,7 +166,7 @@
                        use1.printStackTrace();
                        Logger.error(FProxyToadlet.class, "could not create 
URI", use1);
                } catch (UnsafeContentTypeException e) {
-                       HTMLNode pageNode = 
context.getPageMaker().getPageNode("Potentially Dangerous Content");
+                       HTMLNode pageNode = 
context.getPageMaker().getPageNode("Potentially Dangerous Content", context);
                        HTMLNode contentNode = 
context.getPageMaker().getContentNode(pageNode);

                        HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-alert");
@@ -312,7 +312,7 @@
                try {
                        key = new FreenetURI(ks);
                } catch (MalformedURLException e) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Invalid key");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Invalid key", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                        HTMLNode errorInfobox = contentNode.addChild("div", 
"class", "infobox infobox-error");
@@ -353,7 +353,7 @@
                        } else if(e.newURI != null) {
                                this.writePermanentRedirect(ctx, msg, '/' 
+e.newURI.toString() + override);
                        } else if(e.mode == FetchException.TOO_BIG) {
-                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("File information");
+                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("File information", ctx);
                                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                                HTMLNode infobox = contentNode.addChild("div", 
"class", "infobox infobox-information");
@@ -407,7 +407,7 @@

                                writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
                        } else {
-                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(FetchException.getShortMessage(e.mode));
+                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(FetchException.getShortMessage(e.mode), ctx);
                                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                                HTMLNode infobox = contentNode.addChild("div", 
"class", "infobox infobox-error");
@@ -570,43 +570,43 @@
                        core.random.nextBytes(random);
                        FProxyToadlet fproxy = new FProxyToadlet(client, core);
                        core.setFProxy(fproxy);
-                       server.register(fproxy, "/", false, "Home", "homepage");
+                       server.register(fproxy, "/", false, "Home", "homepage", 
false);

                        PproxyToadlet pproxy = new PproxyToadlet(client, 
node.pluginManager, core);
-                       server.register(pproxy, "/plugins/", true, "Plugins", 
"configure and manage plugins");
+                       server.register(pproxy, "/plugins/", true, "Plugins", 
"configure and manage plugins", false);

                        WelcomeToadlet welcometoadlet = new 
WelcomeToadlet(client, node);
-                       server.register(welcometoadlet, "/welcome/", true);
+                       server.register(welcometoadlet, "/welcome/", true, 
false);

                        PluginToadlet pluginToadlet = new PluginToadlet(client, 
node.pluginManager2, core);
-                       server.register(pluginToadlet, "/plugin/", true);
+                       server.register(pluginToadlet, "/plugin/", true, true);

                        ConfigToadlet configtoadlet = new ConfigToadlet(client, 
config, node, core);
-                       server.register(configtoadlet, "/config/", true, 
"Configuration", "configure your node");
+                       server.register(configtoadlet, "/config/", true, 
"Configuration", "configure your node", true);

                        StaticToadlet statictoadlet = new StaticToadlet(client);
-                       server.register(statictoadlet, "/static/", true);
+                       server.register(statictoadlet, "/static/", true, false);

                        SymlinkerToadlet symlinkToadlet = new 
SymlinkerToadlet(client, node);
-                       server.register(symlinkToadlet, "/sl/", true);
+                       server.register(symlinkToadlet, "/sl/", true, false);

                        DarknetConnectionsToadlet darknetToadlet = new 
DarknetConnectionsToadlet(node, core, client);
-                       server.register(darknetToadlet, "/darknet/", true, 
"Darknet", "manage darknet connections");
+                       server.register(darknetToadlet, "/darknet/", true, 
"Darknet", "manage darknet connections", true);

                        N2NTMToadlet n2ntmToadlet = new N2NTMToadlet(node, 
core, client);
-                       server.register(n2ntmToadlet, "/send_n2ntm/", true);
+                       server.register(n2ntmToadlet, "/send_n2ntm/", true, 
true);

                        QueueToadlet queueToadlet = new QueueToadlet(core, 
core.getFCPServer(), client);
-                       server.register(queueToadlet, "/queue/", true, "Queue", 
"manage queued requests");
+                       server.register(queueToadlet, "/queue/", true, "Queue", 
"manage queued requests", false);

                        StatisticsToadlet statisticsToadlet = new 
StatisticsToadlet(node, core, client);
-                       server.register(statisticsToadlet, "/stats/", true, 
"Statistics", "view statistics");
+                       server.register(statisticsToadlet, "/stats/", true, 
"Statistics", "view statistics", true);

                        LocalFileInsertToadlet localFileInsertToadlet = new 
LocalFileInsertToadlet(core, client);
-                       server.register(localFileInsertToadlet, "/files/", 
true);
+                       server.register(localFileInsertToadlet, "/files/", 
true, true);

                        BrowserTestToadlet browsertTestToadlet = new 
BrowserTestToadlet(client, core);
-                       server.register(browsertTestToadlet, "/test/", true);
+                       server.register(browsertTestToadlet, "/test/", true, 
false);

                        // Now start the server.
                        server.start();

Modified: trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java  
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java  
2007-03-19 23:44:49 UTC (rev 12228)
@@ -50,7 +50,7 @@
                currentPath = new File(path).getCanonicalFile();
                PageMaker pageMaker = toadletContext.getPageMaker();

-               HTMLNode pageNode = pageMaker.getPageNode("Listing of " + 
currentPath.getAbsolutePath());
+               HTMLNode pageNode = pageMaker.getPageNode("Listing of " + 
currentPath.getAbsolutePath(), toadletContext);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);
                contentNode.addChild(core.alerts.createSummary());


Modified: trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java    2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java    2007-03-19 
23:44:49 UTC (rev 12228)
@@ -41,8 +41,14 @@
   }

   public void handleGet(URI uri, HTTPRequest request, ToadletContext ctx) 
throws ToadletContextClosedException, IOException, RedirectException {
+         
+         if(!ctx.isAllowedFullAccess()) {
+                 super.sendErrorPage(ctx, 403, "Unauthorized", "You are not 
permitted access to this page");
+                 return;
+         }
+               
          if (request.isParameterSet("peernode_hashcode")) {
-                 HTMLNode pageNode = ctx.getPageMaker().getPageNode("Send Node 
to Node Text Message");
+                 HTMLNode pageNode = ctx.getPageMaker().getPageNode("Send Node 
to Node Text Message", ctx);
                  HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                  String peernode_name = null;
@@ -103,6 +109,11 @@
                  return;
          }

+         if(!ctx.isAllowedFullAccess()) {
+                 super.sendErrorPage(ctx, 403, "Unauthorized", "You are not 
permitted access to this page");
+                 return;
+         }
+               
          if (request.isPartSet("send")) {
                  String message = request.getPartAsString("message", 5*1024);
                  message = message.trim();
@@ -110,7 +121,7 @@
                                this.writeReply(ctx, 400, "text/plain", "Too 
long", "N2NTMs are limited to 1024 characters");
                                return;
                        }
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Send Node to Node Text Message Processing");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Send Node to Node Text Message Processing", 
ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode peerTableInfobox = contentNode.addChild("div", 
"class", "infobox infobox-normal");
                        HTMLNode peerTable = peerTableInfobox.addChild("table", 
"class", "n2ntm-send-statuses");

Modified: trunk/freenet/src/freenet/clients/http/NinjaSpider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/NinjaSpider.java     2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/NinjaSpider.java     2007-03-19 
23:44:49 UTC (rev 12228)
@@ -545,7 +545,7 @@
                } else if ("list".equals(action)) {
                        String listName = request.getParam("listName", null);

-                       HTMLNode pageNode = pageMaker.getPageNode(pluginName);
+                       HTMLNode pageNode = pageMaker.getPageNode(pluginName, 
context);
                        HTMLNode contentNode = 
pageMaker.getContentNode(pageNode);

                        /* create copies for multi-threaded use */
@@ -609,7 +609,7 @@

        private void sendSimpleResponse(ToadletContext context, String title, 
String message) throws ToadletContextClosedException, IOException {
                PageMaker pageMaker = context.getPageMaker();
-               HTMLNode pageNode = pageMaker.getPageNode(title);
+               HTMLNode pageNode = pageMaker.getPageNode(title, context);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);
                HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-alert");
                infobox.addChild("div", "class", "infobox-header", title);

Modified: trunk/freenet/src/freenet/clients/http/PageMaker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PageMaker.java       2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/PageMaker.java       2007-03-19 
23:44:49 UTC (rev 12228)
@@ -25,6 +25,7 @@
        private static final String DEFAULT_THEME = "clean";
        private String theme;
        private final List navigationLinkTexts = new ArrayList();
+       private final List navigationLinkTextsNonFull = new ArrayList();
        private final Map navigationLinkTitles = new HashMap();
        private final Map navigationLinks = new HashMap();
        private final Map contentNodes = new HashMap();
@@ -48,14 +49,17 @@
                }
        }

-       public void addNavigationLink(String path, String name, String title) {
+       public void addNavigationLink(String path, String name, String title, 
boolean fullOnly) {
                navigationLinkTexts.add(name);
+               if(!fullOnly)
+                       navigationLinkTextsNonFull.add(name);
                navigationLinkTitles.put(name, title);
                navigationLinks.put(name, path);
        }

        public void removeNavigationLink(String name) {
                navigationLinkTexts.remove(name);
+               navigationLinkTextsNonFull.remove(name);
                navigationLinkTitles.remove(name);
                navigationLinks.remove(name);
        }
@@ -68,11 +72,12 @@
                return new HTMLNode("a", new String[] { "href", "title" }, new 
String[] { "javascript:back()", name }, name);
        }

-       public HTMLNode getPageNode(String title) {
-               return getPageNode(title, true);
+       public HTMLNode getPageNode(String title, ToadletContext ctx) {
+               return getPageNode(title, true, ctx);
        }

-       public HTMLNode getPageNode(String title, boolean 
renderNavigationLinks) {
+       public HTMLNode getPageNode(String title, boolean 
renderNavigationLinks, ToadletContext ctx) {
+               boolean fullAccess = ctx == null ? false : 
ctx.isAllowedFullAccess();
                HTMLNode pageNode = new HTMLNode.HTMLDoctype("html", 
"-//W3C//DTD XHTML 1.1//EN");
                HTMLNode htmlNode = pageNode.addChild("html", "xml:lang", "en");
                HTMLNode headNode = htmlNode.addChild("head");
@@ -91,7 +96,7 @@
                if (renderNavigationLinks) {
                        HTMLNode navbarDiv = pageDiv.addChild("div", "id", 
"navbar");
                        HTMLNode navbarUl = navbarDiv.addChild("ul", "id", 
"navlist");
-                       for (Iterator navigationLinkIterator = 
navigationLinkTexts.iterator(); navigationLinkIterator.hasNext();) {
+                       for (Iterator navigationLinkIterator = fullAccess ? 
navigationLinkTexts.iterator() : navigationLinkTextsNonFull.iterator(); 
navigationLinkIterator.hasNext();) {
                                String navigationLink = (String) 
navigationLinkIterator.next();
                                String navigationTitle = (String) 
navigationLinkTitles.get(navigationLink);
                                String navigationPath = (String) 
navigationLinks.get(navigationLink);

Modified: trunk/freenet/src/freenet/clients/http/PluginToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PluginToadlet.java   2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/PluginToadlet.java   2007-03-19 
23:44:49 UTC (rev 12228)
@@ -80,6 +80,11 @@
                        return;
                }

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                String action = httpRequest.getParam("action");
                if (action.length() == 0) {
                        writePermanentRedirect(ctx, "Plugin list", 
"?action=list");
@@ -117,6 +122,11 @@
                        return;
                }

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                String pass = httpRequest.getPartAsString("formPassword", 32);
                if((pass == null) || !pass.equals(core.formPassword)) {
                        MultiValueTable headers = new MultiValueTable();
@@ -195,7 +205,7 @@
        private String listPlugins(ToadletContext context) {
                Plugin[] plugins = pluginManager.getPlugins();
                PageMaker pageMaker = context.getPageMaker();
-               HTMLNode pageNode = pageMaker.getPageNode("List of Plugins");
+               HTMLNode pageNode = pageMaker.getPageNode("List of Plugins", 
context);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);

                HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox");
@@ -245,7 +255,7 @@
         */
        private StringBuffer createBox(ToadletContext context, String title, 
String message) {
                PageMaker pageMaker = context.getPageMaker();
-               HTMLNode pageNode = pageMaker.getPageNode(title);
+               HTMLNode pageNode = pageMaker.getPageNode(title, context);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);
                HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-alert");
                infobox.addChild("div", "class", "infobox-header", title);

Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java   2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java   2007-03-19 
23:44:49 UTC (rev 12228)
@@ -91,6 +91,11 @@
                else
                {

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+                       
                if (request.isPartSet("load")) {
                        if(Logger.shouldLog(Logger.MINOR, this)) 
Logger.minor(this, "Loading "+request.getPartAsString("load", 
MAX_PLUGIN_NAME_LENGTH));
                        pm.startPlugin(request.getPartAsString("load", 
MAX_PLUGIN_NAME_LENGTH), true);
@@ -105,7 +110,7 @@
                        return;
                }if (request.getPartAsString("unloadconfirm", 
MAX_PLUGIN_NAME_LENGTH).length() > 0) {
                        pm.killPlugin(request.getPartAsString("unloadconfirm", 
MAX_PLUGIN_NAME_LENGTH));
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Plugins");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Plugins", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-success");
                        infobox.addChild("div", "class", "infobox-header", 
"Plugin unloaded");
@@ -116,7 +121,7 @@
                        writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
                        return;
                }if (request.getPartAsString("unload", 
MAX_PLUGIN_NAME_LENGTH).length() > 0) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Plugins");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Plugins", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-query");
                        infobox.addChild("div", "class", "infobox-header", 
"Unload plugin?");
@@ -174,6 +179,10 @@
                Logger.minor(this, "Pproxy fetching "+path);
                try {
                        if (path.equals("")) {
+                               if(!ctx.isAllowedFullAccess()) {
+                                       super.sendErrorPage(ctx, 403, 
"Unauthorized", "You are not permitted access to this page");
+                                       return;
+                               }
                                this.showPluginList(ctx, request);
                        } else {
                                // split path into plugin class name and 'data' 
path for plugin
@@ -212,7 +221,7 @@

        private void showPluginList(ToadletContext ctx, HTTPRequest request) 
throws ToadletContextClosedException, IOException {
                if (!request.hasParameters()) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Plugins of " + core.getMyName());
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Plugins of " + core.getMyName(), ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                        HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-normal");

Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java    2007-03-19 
23:44:49 UTC (rev 12228)
@@ -256,7 +256,7 @@
                                                                                
writeReply(ctx, 200, "application/x-msdownload", "OK", responseHeaders, 
dataBucket);
                                                                                
return;
                                                                        }
-                                                                       
HTMLNode pageNode = ctx.getPageMaker().getPageNode("Potentially Unsafe 
Content");
+                                                                       
HTMLNode pageNode = ctx.getPageMaker().getPageNode("Potentially Unsafe 
Content", ctx);
                                                                        
HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
                                                                        
HTMLNode alertNode = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-alert", 
"Potentially Unsafe Content"));
                                                                        
HTMLNode alertContent = ctx.getPageMaker().getContentNode(alertNode);
@@ -287,7 +287,7 @@

        private void writeError(String header, String message, ToadletContext 
context) throws ToadletContextClosedException, IOException {
                PageMaker pageMaker = context.getPageMaker();
-               HTMLNode pageNode = pageMaker.getPageNode(header);
+               HTMLNode pageNode = pageMaker.getPageNode(header, context);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);
                contentNode.addChild(core.alerts.createSummary());
                HTMLNode infobox = 
contentNode.addChild(pageMaker.getInfobox("infobox-error", header));
@@ -355,7 +355,7 @@
                        Logger.minor(this, "Request count: "+reqs.length);

                if(reqs.length < 1){
-                       HTMLNode pageNode = pageMaker.getPageNode("Global queue 
of " + core.getMyName());
+                       HTMLNode pageNode = pageMaker.getPageNode("Global queue 
of " + core.getMyName(), ctx);
                        HTMLNode contentNode = 
pageMaker.getContentNode(pageNode);
                        /* add alert summary box */
                        contentNode.addChild(core.alerts.createSummary());
@@ -461,7 +461,7 @@
                HTMLNode pageNode = pageMaker.getPageNode("(" + 
(uncompletedDirUpload.size() + uncompletedDownload.size()
                                + uncompletedUpload.size()) + '/' + 
(failedDirUpload.size() + failedDownload.size() + failedUpload.size()) + '/'
                 + (completedDirUpload.size() + completedDownloadToDisk.size() 
+ completedDownloadToTemp.size()
-                               + completedUpload.size()) + ") Queued Requests 
of " + core.getMyName());
+                               + completedUpload.size()) + ") Queued Requests 
of " + core.getMyName(), ctx);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);

                /* add alert summary box */

Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-03-19 23:44:49 UTC (rev 12228)
@@ -5,6 +5,7 @@

 import java.io.File;
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.JarURLConnection;
 import java.net.Socket;
 import java.net.SocketException;
@@ -24,6 +25,7 @@
 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
 import freenet.crypt.DummyRandomSource;
+import freenet.io.AllowedHosts;
 import freenet.io.NetworkInterface;
 import freenet.node.NodeClientCore;
 import freenet.support.FileLoggerHook;
@@ -51,6 +53,7 @@
        final int port;
        String bindTo;
        String allowedHosts;
+       final AllowedHosts allowedFullAccess;
        final BucketFactory bf;
        final NetworkInterface networkInterface;
        private final LinkedList toadlets;
@@ -265,6 +268,19 @@
                                        else    
SimpleToadletServer.isPanicButtonToBeShown = value;
                                }
                });
+               fproxyConfig.register("allowedHostsFullAccess", 
"127.0.0.1,0:0:0:0:0:0:0:1", configItemOrder++, true, true, "Hosts allowed full 
access to Fproxy", "Hosts allowed full access (i.e. change config settings, 
restart, etc) to the node",
+                               new StringCallback() {
+
+                                       public String get() {
+                                               return 
allowedFullAccess.getAllowedHosts();
+                                       }
+
+                                       public void set(String val) throws 
InvalidConfigValueException {
+                                               
allowedFullAccess.setAllowedHosts(val);
+                                       }
+                       
+               });
+               allowedFullAccess = new 
AllowedHosts(fproxyConfig.getString("allowedHostsFullAccess"));

                SimpleToadletServer.isPanicButtonToBeShown = 
fproxyConfig.getBoolean("showPanicButton");
                this.bf = core.tempBucketFactory;
@@ -294,6 +310,7 @@
                this.port = i;
                this.bindTo = newbindTo;
                this.allowedHosts = allowedHosts;
+               allowedFullAccess = new AllowedHosts(allowedHosts);
                this.bf = bf;
                this.networkInterface = new NetworkInterface(port, this.bindTo, 
this.allowedHosts);
                toadlets = new LinkedList();
@@ -310,17 +327,17 @@
                }
        }

-       public void register(Toadlet t, String urlPrefix, boolean atFront) {
-               register(t, urlPrefix, atFront, null, null);
+       public void register(Toadlet t, String urlPrefix, boolean atFront, 
boolean fullOnly) {
+               register(t, urlPrefix, atFront, null, null, fullOnly);
        }

-       public void register(Toadlet t, String urlPrefix, boolean atFront, 
String name, String title) {
+       public void register(Toadlet t, String urlPrefix, boolean atFront, 
String name, String title, boolean fullOnly) {
                ToadletElement te = new ToadletElement(t, urlPrefix);
                if(atFront) toadlets.addFirst(te);
                else toadlets.addLast(te);
                t.container = this;
                if (name != null) {
-                       pageMaker.addNavigationLink(urlPrefix, name, title);
+                       pageMaker.addNavigationLink(urlPrefix, name, title, 
fullOnly);
                }
        }

@@ -347,7 +364,7 @@
         Logger.globalAddHook(logger);
         logger.start();
                SimpleToadletServer server = new SimpleToadletServer(1111, 
"127.0.0.1", "127.0.0.1", new TempBucketFactory(new FilenameGenerator(new 
DummyRandomSource(), true, new File("temp-test"), "test-temp-")), "aqua", null);
-               server.register(new TrivialToadlet(null), "", true);
+               server.register(new TrivialToadlet(null), "", true, false);
                server.start();
                System.out.println("Bound to port 1111.");
                while(true) {
@@ -440,4 +457,8 @@
        public String getFormPassword() {
                return core.formPassword;
        }
+
+       public boolean isAllowedFullAccess(InetAddress remoteAddr) {
+               return this.allowedFullAccess.allowed(remoteAddr);
+       }
 }

Modified: trunk/freenet/src/freenet/clients/http/Spider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Spider.java  2007-03-19 23:11:30 UTC 
(rev 12227)
+++ trunk/freenet/src/freenet/clients/http/Spider.java  2007-03-19 23:44:49 UTC 
(rev 12228)
@@ -288,7 +288,7 @@
                        return;
                } else if ("list".equals(action)) {
                        String listName = request.getParam("listName", null);
-                       HTMLNode pageNode = pageMaker.getPageNode("The 
Definitive Spider");
+                       HTMLNode pageNode = pageMaker.getPageNode("The 
Definitive Spider", context);
                        HTMLNode contentNode = 
pageMaker.getContentNode(pageNode);
                        /* create copies for multi-threaded use */
                        if (listName == null) {
@@ -351,7 +351,7 @@

        private void sendSimpleResponse(ToadletContext context, String title, 
String message) throws ToadletContextClosedException, IOException {
                PageMaker pageMaker = context.getPageMaker();
-               HTMLNode pageNode = pageMaker.getPageNode(title);
+               HTMLNode pageNode = pageMaker.getPageNode(title, context);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);
                HTMLNode infobox = 
contentNode.addChild(pageMaker.getInfobox("infobox-alter", title));
                HTMLNode infoboxContent = pageMaker.getContentNode(infobox);

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2007-03-19 23:44:49 UTC (rev 12228)
@@ -88,6 +88,11 @@

        public void handleGet(URI uri, HTTPRequest request, ToadletContext ctx) 
throws ToadletContextClosedException, IOException, RedirectException {

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                final boolean advancedModeEnabled = 
node.isAdvancedModeEnabled();
                final SubConfig nodeConfig = node.config.get("node");

@@ -116,7 +121,7 @@
                int numberOfListening = getPeerStatusCount(peerNodeStatuses, 
Node.PEER_NODE_STATUS_LISTENING);
                int numberOfListenOnly = getPeerStatusCount(peerNodeStatuses, 
Node.PEER_NODE_STATUS_LISTEN_ONLY);

-               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Statistics 
for " + node.getMyName());
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Statistics 
for " + node.getMyName(), ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                // FIXME! We need some nice images

Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2007-03-19 23:11:30 UTC 
(rev 12227)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2007-03-19 23:44:49 UTC 
(rev 12228)
@@ -70,7 +70,7 @@
        }

        private void handleUnhandledRequest(URI uri, Bucket data, 
ToadletContext toadletContext) throws ToadletContextClosedException, 
IOException, RedirectException {
-               HTMLNode pageNode = 
toadletContext.getPageMaker().getPageNode("Not supported");
+               HTMLNode pageNode = 
toadletContext.getPageMaker().getPageNode("Not supported", toadletContext);
                HTMLNode contentNode = 
toadletContext.getPageMaker().getContentNode(pageNode);

                HTMLNode infobox = contentNode.addChild("div", "class", 
"infobox infobox-error");
@@ -170,7 +170,7 @@
         * Send a simple error page.
         */
        protected void sendErrorPage(ToadletContext ctx, int code, String desc, 
String message) throws ToadletContextClosedException, IOException {
-               HTMLNode pageNode = ctx.getPageMaker().getPageNode(desc);
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode(desc, ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-error", desc));
@@ -187,7 +187,7 @@
         * Send a slightly more complex error page.
         */
        protected void sendErrorPage(ToadletContext ctx, int code, String desc, 
HTMLNode message) throws ToadletContextClosedException, IOException {
-               HTMLNode pageNode = ctx.getPageMaker().getPageNode(desc);
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode(desc, ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-error", desc));
@@ -210,7 +210,7 @@
         * @throws ToadletContextClosedException If the context has already 
been closed.
         */
        protected void sendErrorPage(ToadletContext ctx, String desc, String 
message, Throwable t) throws ToadletContextClosedException, IOException {
-               HTMLNode pageNode = ctx.getPageMaker().getPageNode(desc);
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode(desc, ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-error", desc));

Modified: trunk/freenet/src/freenet/clients/http/ToadletContainer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContainer.java        
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/ToadletContainer.java        
2007-03-19 23:44:49 UTC (rev 12228)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.clients.http;

+import java.net.InetAddress;
 import java.net.URI;

 /** Interface for toadlet containers. Toadlets should register here. */
@@ -13,7 +14,7 @@
         * @param atFront If true, add to front of list (where is checked 
first),
         * else add to back of list (where is checked last).
         */
-       public void register(Toadlet t, String urlPrefix, boolean atFront);
+       public void register(Toadlet t, String urlPrefix, boolean atFront, 
boolean fullAccessOnly);

        /**
         * Find a Toadlet by URI.
@@ -29,4 +30,7 @@
         * Get the form password
         */
        public String getFormPassword();
+
+       /** Is the given IP address allowed full access to the node? */
+       public boolean isAllowedFullAccess(InetAddress remoteAddr);
 }

Modified: trunk/freenet/src/freenet/clients/http/ToadletContext.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContext.java  2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/ToadletContext.java  2007-03-19 
23:44:49 UTC (rev 12228)
@@ -63,5 +63,9 @@
         * @return The form HTMLNode.
         */
        HTMLNode addFormChild(HTMLNode parentNode, String target, String id);
+
+       /** Is this Toadlet allowed full access to the node, including the 
ability to reconfigure it,
+        * restart it etc? */
+       boolean isAllowedFullAccess();
 }


Modified: trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java      
2007-03-19 23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java      
2007-03-19 23:44:49 UTC (rev 12228)
@@ -5,6 +5,7 @@
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.net.InetAddress;
 import java.net.Socket;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -39,6 +40,7 @@
        private final PageMaker pagemaker;
        private final BucketFactory bf;
        private final ToadletContainer container;
+       private final InetAddress remoteAddr;

        /** Is the context closed? If so, don't allow any more writes. This is 
because there
         * may be later requests.
@@ -50,6 +52,7 @@
                this.headers = headers;
                this.closed = false;
                sockOutputStream = sock.getOutputStream();
+               remoteAddr = sock.getInetAddress();
                this.bf = bf;
                this.pagemaker = pageMaker;
                this.container = container;
@@ -396,4 +399,8 @@

                return formNode;
        }
+
+       public boolean isAllowedFullAccess() {
+               return container.isAllowedFullAccess(remoteAddr);
+       }
 }

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-03-19 
23:11:30 UTC (rev 12227)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2007-03-19 
23:44:49 UTC (rev 12228)
@@ -68,6 +68,11 @@

        public void handlePost(URI uri, HTTPRequest request, ToadletContext 
ctx) throws ToadletContextClosedException, IOException {

+               if(!ctx.isAllowedFullAccess()) {
+                       super.sendErrorPage(ctx, 403, "Unauthorized", "You are 
not permitted access to this page");
+                       return;
+               }
+               
                String passwd = request.getPartAsString("formPassword", 32);
                boolean noPassword = (passwd == null) || 
!passwd.equals(core.formPassword);
                if(noPassword) {
@@ -80,7 +85,7 @@
                                return;
                        }
                        // false for no navigation bars, because that would be 
very silly
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node updating");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node updating", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "Node 
updating"));
                        HTMLNode content = 
ctx.getPageMaker().getContentNode(infobox);
@@ -101,7 +106,7 @@
                        headers.put("Location", url==null ? "/" : url);
                        ctx.sendReplyHeaders(302, "Found", headers, null, 0);
                }else if (request.getPartAsString("update", 32).length() > 0) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Update");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Update", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", "Node 
Update"));
                        HTMLNode content = 
ctx.getPageMaker().getContentNode(infobox);
@@ -115,7 +120,7 @@
                                redirectToRoot(ctx);
                                return;
                        }
-                       HTMLNode pageNode = ctx.getPageMaker().getPageNode("Get 
a Thread Dump");
+                       HTMLNode pageNode = ctx.getPageMaker().getPageNode("Get 
a Thread Dump", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        if(node.isUsingWrapper()){
                                HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("Thread Dump generation"));
@@ -132,7 +137,7 @@
                                redirectToRoot(ctx);
                                return;
                        }
-                       HTMLNode pageNode = ctx.getPageMaker().getPageNode("Get 
JE Statistics");
+                       HTMLNode pageNode = ctx.getPageMaker().getPageNode("Get 
JE Statistics", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("Database Statistics"));

@@ -250,7 +255,7 @@
                        }

                        if(noPassword) {
-                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Frost Instant Note insert");
+                               HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Frost Instant Note insert", ctx);
                                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                                HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", "Frost 
Instant Note insert"));
                                HTMLNode content = 
ctx.getPageMaker().getContentNode(infobox);
@@ -287,7 +292,7 @@
                        }
                        FrostMessage fin = new FrostMessage("news", board, 
sender, subject, message);

-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Insertion");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Insertion", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode content;
                        try {
@@ -328,7 +333,7 @@

                        Bucket bucket = request.getPart("filename");

-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Insertion");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Insertion", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode content;
                        String filenameHint = null;
@@ -374,7 +379,7 @@
                                return;
                        }
                        // Tell the user that the node is shutting down
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Shutdown", false);
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Shutdown", false, ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "The 
Freenet node has been successfully shut down."));
                        HTMLNode infoboxContent = 
ctx.getPageMaker().getContentNode(infobox);
@@ -387,7 +392,7 @@
                                return;
                        }
                        // Tell the user that the node is restarting
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Restart", false);
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Restart", false, ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-information", "The 
Freenet is being restarted."));
                        HTMLNode infoboxContent = 
ctx.getPageMaker().getContentNode(infobox);
@@ -429,6 +434,8 @@
        public void handleGet(URI uri, HTTPRequest request, ToadletContext ctx) 
throws ToadletContextClosedException, IOException {
                boolean advancedModeOutputEnabled = 
core.getToadletContainer().isAdvancedModeEnabled();

+               if(ctx.isAllowedFullAccess()) {
+               
                if(request.isParameterSet("latestlog")) {

                        FileReader reader = new 
FileReader(node.config.get("logger").getString("dirname") + File.separator + 
"freenet-latest.log");
@@ -442,7 +449,7 @@
                        this.writeReply(ctx, 200, "text/plain", "OK", 
sw.toString());
                        return;
                }else if (request.getParam("newbookmark").length() > 0) {
-                       HTMLNode pageNode = ctx.getPageMaker().getPageNode("Add 
a Bookmark");
+                       HTMLNode pageNode = ctx.getPageMaker().getPageNode("Add 
a Bookmark", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("Confirm Bookmark 
Addition"));
                        HTMLNode addForm = 
ctx.addFormChild(ctx.getPageMaker().getContentNode(infobox), "/", 
"bookmarkAddForm");
@@ -454,7 +461,7 @@
                        this.writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
                        return;
                } else if 
(request.getParam(GenericReadFilterCallback.magicHTTPEscapeString).length() > 
0) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Link to external resources");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Link to external resources", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode warnbox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-warning", "External 
link"));
                        HTMLNode externalLinkForm = 
ctx.addFormChild(ctx.getPageMaker().getContentNode(warnbox), "/", 
"confirmExternalLinkForm");
@@ -468,7 +475,7 @@
                        this.writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
                        return;
                } else if (request.isParameterSet("managebookmarks")) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Bookmark Manager");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Bookmark Manager", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal", "My 
Bookmarks"));
                        HTMLNode infoboxContent = 
ctx.getPageMaker().getContentNode(infobox);
@@ -499,7 +506,7 @@
                        this.writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
                        return;
                }else if (request.isParameterSet("exit")) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Shutdown");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Shutdown", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", "Node 
Shutdown"));
                        HTMLNode content = 
ctx.getPageMaker().getContentNode(infobox);
@@ -510,7 +517,7 @@
                        writeReply(ctx, 200, "text/html", "OK", 
pageNode.generate());
                        return;
                }else if (request.isParameterSet("restart")) {
-                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Restart");
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Node Restart", ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
                        HTMLNode infobox = 
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-query", "Node 
Restart"));
                        HTMLNode content = 
ctx.getPageMaker().getContentNode(infobox);
@@ -522,7 +529,9 @@
                        return;
                }

-               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet 
FProxy Homepage of " + node.getMyName());
+               }
+               
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode("Freenet 
FProxy Homepage of " + node.getMyName(), ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                if(node.isTestnetEnabled()) {
@@ -614,7 +623,7 @@
        }

        private void sendBookmarkEditPage(ToadletContext ctx, int mode, 
Bookmark b, String origKey, String origDesc, String message) throws 
ToadletContextClosedException, IOException {
-               HTMLNode pageNode = ctx.getPageMaker().getPageNode((mode == 
MODE_ADD) ? "Add a Bookmark" : "Edit a Bookmark");
+               HTMLNode pageNode = ctx.getPageMaker().getPageNode((mode == 
MODE_ADD) ? "Add a Bookmark" : "Edit a Bookmark", ctx);
                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

                if (message != null) {  // only used for error messages so 
far...

Modified: trunk/freenet/src/freenet/io/AllowedHosts.java
===================================================================
--- trunk/freenet/src/freenet/io/AllowedHosts.java      2007-03-19 23:11:30 UTC 
(rev 12227)
+++ trunk/freenet/src/freenet/io/AllowedHosts.java      2007-03-19 23:44:49 UTC 
(rev 12228)
@@ -17,7 +17,6 @@

 import java.net.InetAddress;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.StringTokenizer;

@@ -67,6 +66,11 @@
                }
        }

+       public boolean allowed(InetAddress clientAddress) {
+               AddressType clientAddressType = 
AddressIdentifier.getAddressType(clientAddress.getHostAddress());
+               return allowed(clientAddressType, clientAddress);
+       }
+
        public synchronized boolean allowed(AddressType clientAddressType, 
InetAddress clientAddress) {
                for(int i=0;i<addressMatchers.size();i++) {
                        AddressMatcher matcher = (AddressMatcher) 
addressMatchers.get(i);

Modified: trunk/plugins/MDNSDiscovery/MDNSDiscovery.java
===================================================================
--- trunk/plugins/MDNSDiscovery/MDNSDiscovery.java      2007-03-19 23:11:30 UTC 
(rev 12227)
+++ trunk/plugins/MDNSDiscovery/MDNSDiscovery.java      2007-03-19 23:44:49 UTC 
(rev 12228)
@@ -186,7 +186,7 @@
        }

        public String handleHTTPGet(HTTPRequest request) throws 
PluginHTTPException {
-               HTMLNode pageNode = pageMaker.getPageNode("MDNSDiscovery plugin 
configuration page", false);
+               HTMLNode pageNode = pageMaker.getPageNode("MDNSDiscovery plugin 
configuration page", false, null /* FIXME */);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);

                ServiceInfo[] foundNodes = 
jmdns.list(MDNSDiscovery.freenetServiceType);


Reply via email to