diff --git a/htroot/ConfigAccounts_p.html b/htroot/ConfigAccounts_p.html index 52c4feef0..65365f1e1 100644 --- a/htroot/ConfigAccounts_p.html +++ b/htroot/ConfigAccounts_p.html @@ -24,7 +24,9 @@ ::

Username too short. Username must be >= 4 Characters.

#(/error)# - + #(commitIntranetWarning)#::
With an intranet indexing configuration it is not allowed to authentify automatically from localhost!
#(/commitIntranetWarning)# + #(passwordNotSetWarning)#::
No password is set for the administration account. Please define a password for the admin account.
#(/passwordNotSetWarning)# +
Admin Account
diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.java index 7a2ff7201..cc6855c0e 100644 --- a/htroot/ConfigAccounts_p.java +++ b/htroot/ConfigAccounts_p.java @@ -73,21 +73,43 @@ public class ConfigAccounts_p { String user = (post == null) ? "" : (String) post.get("adminuser", ""); String pw1 = (post == null) ? "" : (String) post.get("adminpw1", ""); String pw2 = (post == null) ? "" : (String) post.get("adminpw2", ""); - sb.setConfig("adminAccountForLocalhost", localhostAccess); - // if an localhost access is configured, check if a local password is given - // if not, set a random password - if (post != null && localhostAccess && env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) { - // make a 'random' password - env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "0000" + serverCodings.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis())); - env.setConfig("adminAccount", ""); - } + // may be overwritten if new password is given if ((user.length() > 0) && (pw1.length() > 3) && (pw1.equals(pw2))) { // check passed. set account: env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, serverCodings.encodeMD5Hex(kelondroBase64Order.standardCoder.encodeString(user + ":" + pw1))); env.setConfig("adminAccount", ""); } + + if (localhostAccess) { + if (sb.acceptLocalURLs) { + // in this case it is not allowed to use a localhostAccess option + prop.put("commitIntranetWarning", 1); + localhostAccess = false; + sb.setConfig("adminAccountForLocalhost", false); + } else { + sb.setConfig("adminAccountForLocalhost", true); + // if an localhost access is configured, check if a local password is given + // if not, set a random password + if (post != null && env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) { + // make a 'random' password + env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, "0000" + serverCodings.encodeMD5Hex(System.getProperties().toString() + System.currentTimeMillis())); + env.setConfig("adminAccount", ""); + } + } + } else { + sb.setConfig("adminAccountForLocalhost", false); + if (env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").startsWith("0000")) { + // make shure that the user can still use the interface after a random password was set + env.setConfig(httpd.ADMIN_ACCOUNT_B64MD5, ""); + } + } } + + if (env.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0 && !env.getConfigBool("adminAccountForLocalhost", false)) { + prop.put("passwordNotSetWarning", 1); + } + prop.put("localhost.checked", (localhostAccess) ? 1 : 0); prop.put("account.checked", (localhostAccess) ? 0 : 1); prop.put("statusPassword", localhostAccess ? "0" : "1"); diff --git a/htroot/ConfigNetwork_p.html b/htroot/ConfigNetwork_p.html index 9f2ec9624..35f112d68 100644 --- a/htroot/ConfigNetwork_p.html +++ b/htroot/ConfigNetwork_p.html @@ -50,6 +50,7 @@ #(commitRobinson)#::
For Robinson Mode, index distribution and receive is switched off.
#(/commitRobinson)# #(commitRobinsonWithRemoteIndexing)#::
This Robinson Mode switches remote indexing on, but limits targets to peers within the same cluster. Remote indexing requests from peers within the same cluster are accepted.
#(/commitRobinsonWithRemoteIndexing)# #(commitRobinsonWithoutRemoteIndexing)#::
This Robinson Mode does not allow any remote indexing (neither requests remote indexing, nor accepts it).
#(/commitRobinsonWithoutRemoteIndexing)# + #(commitPasswordWarning)#::
With this configuration it is not allowed to authentify automatically from localhost! Please open the Account Configuration and set a new password.
#(/commitPasswordWarning)#
diff --git a/htroot/ConfigNetwork_p.java b/htroot/ConfigNetwork_p.java index ed467b660..f3049be7e 100644 --- a/htroot/ConfigNetwork_p.java +++ b/htroot/ConfigNetwork_p.java @@ -29,8 +29,8 @@ import java.io.File; import java.util.HashSet; import de.anomic.http.httpHeader; +import de.anomic.http.httpd; import de.anomic.plasma.plasmaSwitchboard; -import de.anomic.plasma.plasmaWordIndex; import de.anomic.server.serverBusyThread; import de.anomic.server.serverCodings; import de.anomic.server.serverFileUtils; @@ -60,25 +60,11 @@ public class ConfigNetwork_p { } else { // shut down old network and index, start up new network and index commit = 1; - // pause crawls - boolean lcp = sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); - if (!lcp) sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); - boolean rcp = sb.crawlJobIsPaused(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); - if (!rcp) sb.pauseCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); - // trigger online caution - sb.proxyLastAccess = System.currentTimeMillis() + 60000; // at least 1 minute online caution to prevent unnecessary action on database meanwhile - // switch the networks - synchronized (sb.webIndex) { - sb.webIndex.close(); - sb.setConfig("network.unit.definition", networkDefinition); - plasmaSwitchboard.overwriteNetworkDefinition(sb); - File indexPrimaryPath = sb.getConfigPath(plasmaSwitchboard.INDEX_PRIMARY_PATH, plasmaSwitchboard.INDEX_PATH_DEFAULT); - File indexSecondaryPath = (sb.getConfig(plasmaSwitchboard.INDEX_SECONDARY_PATH, "").length() == 0) ? indexPrimaryPath : new File(sb.getConfig(plasmaSwitchboard.INDEX_SECONDARY_PATH, "")); - sb.webIndex = new plasmaWordIndex(sb.getConfig("network.unit.name", ""), sb.getLog(), indexPrimaryPath, indexSecondaryPath); + sb.switchNetwork(networkDefinition); + // check if the password is given + if (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() == 0) { + prop.put("commitPasswordWarning", "1"); } - // start up crawl jobs again - if (lcp) sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL); - if (rcp) sb.continueCrawlJob(plasmaSwitchboard.CRAWLJOB_REMOTE_TRIGGERED_CRAWL); } } diff --git a/source/de/anomic/index/indexRAMRI.java b/source/de/anomic/index/indexRAMRI.java index ca1dc2644..4b63170ff 100644 --- a/source/de/anomic/index/indexRAMRI.java +++ b/source/de/anomic/index/indexRAMRI.java @@ -42,22 +42,22 @@ public final class indexRAMRI implements indexRI, indexRIReader { private final kelondroMScoreCluster hashScore; private final kelondroMScoreCluster hashDate; private long initTime; - private int cacheMaxCount; - public int cacheReferenceCountLimit; - public long cacheReferenceAgeLimit; + private int cacheEntityMaxCount; // the maximum number of cache slots for RWI entries + public int cacheReferenceCountLimit; // the maximum number of references to a single RWI entity + public long cacheReferenceAgeLimit; // the maximum age (= time not changed) of a RWI entity private final serverLog log; private File indexHeapFile; private indexContainerHeap heap; @SuppressWarnings("unchecked") - public indexRAMRI(File databaseRoot, kelondroRow payloadrow, int wCacheReferenceCountLimitInit, long wCacheReferenceAgeLimitInit, String oldArrayName, String newHeapName, serverLog log) { + public indexRAMRI(File databaseRoot, kelondroRow payloadrow, int entityCacheMaxSize, int wCacheReferenceCountLimitInit, long wCacheReferenceAgeLimitInit, String oldArrayName, String newHeapName, serverLog log) { // creates a new index cache // the cache has a back-end where indexes that do not fit in the cache are flushed this.hashScore = new kelondroMScoreCluster(); this.hashDate = new kelondroMScoreCluster(); this.initTime = System.currentTimeMillis(); - this.cacheMaxCount = 10000; + this.cacheEntityMaxCount = entityCacheMaxSize; this.cacheReferenceCountLimit = wCacheReferenceCountLimitInit; this.cacheReferenceAgeLimit = wCacheReferenceAgeLimitInit; this.log = log; @@ -109,11 +109,11 @@ public final class indexRAMRI implements indexRI, indexRIReader { } public void setMaxWordCount(int maxWords) { - this.cacheMaxCount = maxWords; + this.cacheEntityMaxCount = maxWords; } public int getMaxWordCount() { - return this.cacheMaxCount; + return this.cacheEntityMaxCount; } public int size() { diff --git a/source/de/anomic/language/identification/Identificator.java b/source/de/anomic/language/identification/Identificator.java index 6ff530085..6a9d7e9ec 100644 --- a/source/de/anomic/language/identification/Identificator.java +++ b/source/de/anomic/language/identification/Identificator.java @@ -118,8 +118,8 @@ public final class Identificator { } } - //calculate percentage - Iterator iter = testStat.keySet().iterator(); + // calculate percentage + Iterator iter = testStat.keySet().iterator(); Character character; Character maxChar = null; float value = 0; diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 0504a3105..313f9f899 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -853,10 +853,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serverSwitch { if (accessPath == null) accessPath="NULL"; TreeMap access = accessTracker.get(host); if (access == null) access = new TreeMap(); - access.put(new Long(System.currentTimeMillis()), accessPath); - - // write back to tracker - accessTracker.put(host, clearTooOldAccess(access)); + + synchronized (access) { + access.put(new Long(System.currentTimeMillis()), accessPath); + // write back to tracker + accessTracker.put(host, clearTooOldAccess(access)); + } } public TreeMap accessTrack(String host) { @@ -189,15 +191,16 @@ public abstract class serverAbstractSwitch implements serverSwitch { TreeMap access = accessTracker.get(host); if (access == null) return null; // clear too old entries - if ((access = clearTooOldAccess(access)).size() != access.size()) { - // write back to tracker - if (access.size() == 0) { - accessTracker.remove(host); - } else { - accessTracker.put(host, access); + synchronized (access) { + if ((access = clearTooOldAccess(access)).size() != access.size()) { + // write back to tracker + if (access.size() == 0) { + accessTracker.remove(host); + } else { + accessTracker.put(host, access); + } } } - return access; } diff --git a/source/yacy.java b/source/yacy.java index 1bf627c39..8f48c5cbf 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -643,7 +643,7 @@ public final class yacy { int cacheMem = (int)(serverMemory.max() - serverMemory.total()); if (cacheMem < 2048000) throw new OutOfMemoryError("Not enough memory available to start clean up."); - plasmaWordIndex wordIndex = new plasmaWordIndex(networkName, log, indexPrimaryRoot, indexSecondaryRoot); + plasmaWordIndex wordIndex = new plasmaWordIndex(networkName, log, indexPrimaryRoot, indexSecondaryRoot, 10000); Iterator indexContainerIterator = wordIndex.wordContainers("AAAAAAAAAAAA", false, false); long urlCounter = 0, wordCounter = 0; @@ -834,7 +834,7 @@ public final class yacy { try { Iterator indexContainerIterator = null; if (resource.equals("all")) { - WordIndex = new plasmaWordIndex("freeworld", log, indexPrimaryRoot, indexSecondaryRoot); + WordIndex = new plasmaWordIndex("freeworld", log, indexPrimaryRoot, indexSecondaryRoot, 10000); indexContainerIterator = WordIndex.wordContainers(wordChunkStartHash, false, false); } int counter = 0;