Author: nextgens
Date: 2008-08-12 12:43:56 +0000 (Tue, 12 Aug 2008)
New Revision: 21755

Modified:
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/NodeClientCore.java
Log:
Add a new config option: node.encryptTempBuckets

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-08-12 
12:14:20 UTC (rev 21754)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-08-12 
12:43:56 UTC (rev 21755)
@@ -720,6 +720,8 @@
 NodeClientCore.downloadAllowedDirsLong=Semicolon separated list of directories 
to which downloads are allowed. "downloads" means downloadsDir, empty means no 
downloads to disk allowed, "all" means downloads allowed from anywhere. 
WARNING! If this is set to "all" any user can download any file to anywhere on 
your computer!
 NodeClientCore.downloadDir=Default download directory
 NodeClientCore.downloadDirLong=The directory to save downloaded files into by 
default
+NodeClientCore.encryptTempBuckets=Encrypt the temporary buckets? LEAVE THIS 
ALONE!
+NodeClientCore.encryptTempBucketsLong=Encrypt the temporary buckets? In some 
cases (if you use hard-drive and swap encryption) it might not make sense to 
encrypt temporary buckets. LEAVE THIS ALONE IF YOU DON'T KNOW WHAT YOU ARE 
DOING!
 NodeClientCore.fileForClientStats=File to store client statistics in
 NodeClientCore.fileForClientStatsLong=File to store client throttling 
statistics in (used to decide how often to send requests)
 NodeClientCore.lazyResume=Complete loading of persistent requests after 
startup? (Uses more memory)

Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java  2008-08-12 12:14:20 UTC 
(rev 21754)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java  2008-08-12 12:43:56 UTC 
(rev 21755)
@@ -83,6 +83,7 @@
        private File[] uploadAllowedDirs;
        private boolean uploadAllowedEverywhere;
        final FilenameGenerator tempFilenameGenerator;
+       private boolean encryptTempBucketFactory;
        public final BucketFactory tempBucketFactory;
        public final Node node;
        final NodeStats nodeStats;
@@ -195,8 +196,20 @@
                        throw new 
NodeInitException(NodeInitException.EXIT_BAD_TEMP_DIR, msg);
                }

-               tempBucketFactory = new 
PaddedEphemerallyEncryptedBucketFactory(new 
TempBucketFactory(tempFilenameGenerator), random, node.fastWeakRandom, 1024);
+               nodeConfig.register("encryptTempBuckets", true, sortOrder++, 
true, false, "NodeClientCore.encryptTempBuckets", 
"NodeClientCore.encryptTempBucketsLong", new BooleanCallback() {

+                       public boolean get() {
+                               return encryptTempBucketFactory;
+                       }
+
+                       public void set(boolean val) throws 
InvalidConfigValueException {
+                               throw new UnsupportedOperationException("Can't 
be changed on the fly!");
+                       }
+               });
+               BucketFactory _tempBucketFactory = new 
TempBucketFactory(tempFilenameGenerator);
+               encryptTempBucketFactory = 
nodeConfig.getBoolean("encryptTempBuckets");
+               tempBucketFactory = (encryptTempBucketFactory ? new 
PaddedEphemerallyEncryptedBucketFactory(_tempBucketFactory, random, 
node.fastWeakRandom, 1024) : _tempBucketFactory);
+
                // Downloads directory

                nodeConfig.register("downloadsDir", "downloads", sortOrder++, 
true, true, "NodeClientCore.downloadDir", "NodeClientCore.downloadDirLong", new 
StringCallback() {


Reply via email to