Author: saces
Date: 2007-11-17 21:18:45 +0000 (Sat, 17 Nov 2007)
New Revision: 15801
Modified:
trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
trunk/freenet/src/freenet/node/fcp/FCPMessage.java
Log:
limit fcp commands from plugins to fcp.AllowedFullAccess only
Modified: trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
2007-11-17 21:06:14 UTC (rev 15800)
+++ trunk/freenet/src/freenet/node/fcp/FCPConnectionInputHandler.java
2007-11-17 21:18:45 UTC (rev 15801)
@@ -82,7 +82,11 @@
try {
if(Logger.shouldLog(Logger.DEBUG, this))
Logger.debug(this, "Incoming FCP
message:\n"+messageType+'\n'+fs.toString());
- msg = FCPMessage.create(messageType, fs,
handler.bf, handler.server.core.persistentTempBucketFactory,
handler.server.node.pluginManager);
+ // fcp commands from plugins are only visible
if full access
+ if (handler.hasFullAccess())
+ msg = FCPMessage.create(messageType,
fs, handler.bf, handler.server.core.persistentTempBucketFactory,
handler.server.node.pluginManager);
+ else
+ msg = FCPMessage.create(messageType,
fs, handler.bf, handler.server.core.persistentTempBucketFactory, null);
if(msg == null) continue;
} catch (MessageInvalidException e) {
if(firstMessage) {
Modified: trunk/freenet/src/freenet/node/fcp/FCPMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPMessage.java 2007-11-17 21:06:14 UTC
(rev 15800)
+++ trunk/freenet/src/freenet/node/fcp/FCPMessage.java 2007-11-17 21:18:45 UTC
(rev 15801)
@@ -91,25 +91,29 @@
return new WatchGlobal(fs);
if(name.equals("Void"))
return null;
+
// We reached here? Must be a plugin. find it
+ // if pluginmanager == null it is *not* full access or a bug ;)
+ // plugins.HelloFCP.HelloFCP.Ping
- // plugins.HelloFCP.HelloFCP.Ping
- // split at last point
- int lp = name.lastIndexOf('.');
- if (lp > 2) {
- String plugname = name.substring(0, lp);
- String plugcmd = name.substring(lp+1);
+ if (pluginmanager != null) {
+ // split at last point
+ int lp = name.lastIndexOf('.');
+ if (lp > 2) {
+ String plugname = name.substring(0, lp);
+ String plugcmd = name.substring(lp+1);
- System.err.println("plugname: " + plugname);
- System.err.println("plugcmd: " + plugcmd);
+ System.err.println("plugname: " + plugname);
+ System.err.println("plugcmd: " + plugcmd);
- FredPluginFCP plug =
pluginmanager.getFCPPlugin(plugname);
- if (plug != null) {
- System.err.println("plug found: " + plugname);
- FCPMessage msg = plug.create(plugcmd, fs);
- if (msg != null) {
- System.err.println("plug cmd seems
valid: " + plugcmd);
- return msg;
+ FredPluginFCP plug =
pluginmanager.getFCPPlugin(plugname);
+ if (plug != null) {
+ System.err.println("plug found: " +
plugname);
+ FCPMessage msg = plug.create(plugcmd,
fs);
+ if (msg != null) {
+ System.err.println("plug cmd
seems valid: " + plugcmd);
+ return msg;
+ }
}
}
}