From 9636a7463339215eafa52ef11b96177759185395 Mon Sep 17 00:00:00 2001 From: reger Date: Fri, 1 Jan 2016 06:08:41 +0100 Subject: [PATCH] remove local credential on download of config files from remote systems (blacklists, language, skins) to reduce risk to expose md5-pwd. - remove NoSuchElementException in loop --- htroot/BlacklistImpExp_p.java | 4 +--- htroot/ConfigAppearance_p.java | 2 +- htroot/ConfigLanguage_p.java | 3 +-- htroot/sharedBlacklist_p.java | 5 ++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htroot/BlacklistImpExp_p.java b/htroot/BlacklistImpExp_p.java index b832f4da0..2027ec698 100644 --- a/htroot/BlacklistImpExp_p.java +++ b/htroot/BlacklistImpExp_p.java @@ -72,12 +72,10 @@ public class BlacklistImpExp_p { if (seed != null) hostList.put(seed.get(Seed.NAME, "nameless"),seed.hash); } - String peername; - while ((peername = hostList.firstKey()) != null) { + for (String peername : hostList.keySet()) { final String Hash = hostList.get(peername); prop.putHTML(DISABLED + "otherHosts_" + peerCount + "_hash", Hash); prop.putXML(DISABLED + "otherHosts_" + peerCount + "_name", peername); - hostList.remove(peername); peerCount++; } } catch (final Exception e) { diff --git a/htroot/ConfigAppearance_p.java b/htroot/ConfigAppearance_p.java index 8635e90a3..2051e2aec 100644 --- a/htroot/ConfigAppearance_p.java +++ b/htroot/ConfigAppearance_p.java @@ -102,7 +102,7 @@ public class ConfigAppearance_p { final Iterator it; try { final DigestURL u = new DigestURL(url); - it = FileUtils.strings(u.get(ClientIdentification.yacyInternetCrawlerAgent, sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin"), sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""))); + it = FileUtils.strings(u.get(ClientIdentification.yacyInternetCrawlerAgent, null, null)); } catch (final IOException e) { prop.put("status", "1");// unable to get URL prop.put("status_url", url); diff --git a/htroot/ConfigLanguage_p.java b/htroot/ConfigLanguage_p.java index 65d2b076c..2210e389b 100644 --- a/htroot/ConfigLanguage_p.java +++ b/htroot/ConfigLanguage_p.java @@ -46,7 +46,6 @@ import net.yacy.data.Translator; import net.yacy.data.WorkTables; import net.yacy.kelondro.util.FileUtils; import net.yacy.search.Switchboard; -import net.yacy.search.SwitchboardConstants; import net.yacy.server.serverObjects; import net.yacy.server.serverSwitch; @@ -102,7 +101,7 @@ public class ConfigLanguage_p { Iterator it; try { final DigestURL u = new DigestURL(url); - it = FileUtils.strings(u.get(ClientIdentification.yacyInternetCrawlerAgent, sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin"), sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""))); + it = FileUtils.strings(u.get(ClientIdentification.yacyInternetCrawlerAgent, null, null)); } catch(final IOException e) { prop.put("status", "1");//unable to get url prop.put("status_url", url); diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.java index cffeed8f2..931c8061d 100644 --- a/htroot/sharedBlacklist_p.java +++ b/htroot/sharedBlacklist_p.java @@ -51,7 +51,6 @@ import net.yacy.peers.Seed; import net.yacy.repository.Blacklist; import net.yacy.repository.Blacklist.BlacklistType; import net.yacy.search.Switchboard; -import net.yacy.search.SwitchboardConstants; import net.yacy.search.query.SearchEventCache; import net.yacy.server.serverObjects; import net.yacy.server.serverSwitch; @@ -140,7 +139,7 @@ public class sharedBlacklist_p { // get List final DigestURL u = new DigestURL(downloadURLOld); - otherBlacklist = FileUtils.strings(u.get(agent, sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin"), sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""))); + otherBlacklist = FileUtils.strings(u.get(agent, null, null)); } catch (final Exception e) { prop.put("status", STATUS_PEER_UNKNOWN); prop.putHTML("status_name", hash); @@ -157,7 +156,7 @@ public class sharedBlacklist_p { try { final DigestURL u = new DigestURL(downloadURL); - otherBlacklist = FileUtils.strings(u.get(agent, sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_USER_NAME, "admin"), sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""))); + otherBlacklist = FileUtils.strings(u.get(agent, null, null)); } catch (final Exception e) { prop.put("status", STATUS_URL_PROBLEM); prop.putHTML("status_address",downloadURL);