Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added authentication for link deletion in search result
orbiter13fdebc50ded
diff --git a/htroot/Steering.java b/htroot/Steering.javaindex 0d11f337e..9a95f338f 100644--- a/htroot/Steering.java+++ b/htroot/Steering.java@@ -62,19 +62,9 @@ public class Steering {if (prop == null) { return prop; }// handle access rights- switch (sb.adminAuthenticated(header)) {- case 0: // wrong password given- try {Thread.sleep(3000);} catch (InterruptedException e) {} // prevent brute-force- prop.put("AUTHENTICATE", "admin log-in"); // force log-in- return prop;- case 1: // no password given- prop.put("AUTHENTICATE", "admin log-in"); // force log-in- return prop;- case 2: // no password stored- //prop.put("info", 1); // actions only with password- //return prop;- case 3: // soft-authenticated for localhost only- case 4: // hard-authenticated, all ok+ if (!sb.verifyAuthentication(header, false)) {+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;}if (post.containsKey("shutdown")) {diff --git a/htroot/index.java b/htroot/index.javaindex 93547b3c7..f6cafa7e9 100644--- a/htroot/index.java+++ b/htroot/index.java@@ -137,8 +137,13 @@ public class index {// if a minus-button was hit, remove a special reference firstif (post.containsKey("deleteref")) {- final String delHash = post.get("deleteref", "");- sb.removeReferences(delHash, query);+ if (!sb.verifyAuthentication(header, true)) {+ final serverObjects prop = new serverObjects();+ prop.put("AUTHENTICATE", "admin log-in"); // force log-in+ return prop;+ }+ final String delHash = post.get("deleteref", "");+ sb.removeReferences(delHash, query);}// prepare search orderdiff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex fff7f89c6..9e33c6638 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -1848,6 +1848,24 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serreturn 0; // wrong password}+ public boolean verifyAuthentication(httpHeader header, boolean strict) {+ // handle access rights+ switch (adminAuthenticated(header)) {+ case 0: // wrong password given+ try { Thread.sleep(3000); } catch (InterruptedException e) { } // prevent brute-force+ return false;+ case 1: // no password given+ return false;+ case 2: // no password stored+ return !strict;+ case 3: // soft-authenticated for localhost only+ return true;+ case 4: // hard-authenticated, all ok+ return true;+ }+ return false;+ }+public void terminate() {this.terminate = true;this.shutdownSync.V();