2005-12-18 jrandom

* Added a standalone runner for the I2PSnark web ui (build with the
      command "ant i2psnark", unzip i2psnark-standalone.zip somewhere, run
      with "java -jar launch-i2psnark.jar", and go to http://localhost:8002/).
    * Further I2PSnark error handling
2005-12-17  jrandom
    * Let multiuser accounts authorize themselves to access the remote
      functionality again (thanks Ch0Hag!)
    * Adjust the JVM heap size to 128MB for new installs (existing users can
      accomplish this by editing wrapper.config, adding the line
      "wrapper.java.maxmemory=128", and then doing a full shutdown and startup
      of the router).  This is relevent for heavy usage of I2PSnark in the
      router console.
This commit is contained in:
jrandom
2005-12-18 05:52:19 +00:00
committed by zzz
parent c287bace0f
commit d525c49d45
4 changed files with 30 additions and 6 deletions

View File

@ -563,11 +563,17 @@ public class BlogManager {
}
public boolean authorizeRemote(String pass) {
if (isSingleUser()) return true;
String rem = getRemotePasswordHash();
if ( (rem == null) || (rem.trim().length() <= 0) )
return false;
String hash = Base64.encode(_context.sha().calculateHash(DataHelper.getUTF8(pass.trim())).getData());
return (hash.equals(rem));
String rem = getRemotePasswordHash();
boolean ok = false;
if ( (rem != null) && (rem.trim().length() > 0) )
ok = hash.equals(rem);
if (!ok) {
rem = getAdminPasswordHash();
if ( (rem != null) && (rem.trim().length() > 0) )
ok = hash.equals(rem);
}
return ok;
}
public boolean authorizeRemote(User user) {
if (isSingleUser()) return true;

View File

@ -467,7 +467,18 @@ public abstract class BaseServlet extends HttpServlet {
if ( (pass0 != null) && (pass1 != null) && (pass0.equals(pass1)) ) {
BlogManager.instance().changePasswrd(user, oldPass, pass0, pass1);
}
if (user.getAuthenticated() && !BlogManager.instance().authorizeRemote(user)) {
String adminPass = req.getParameter("adminPass");
if (adminPass != null) {
boolean authorized = BlogManager.instance().authorizeRemote(adminPass);
if (authorized) {
user.setAllowAccessRemote(authorized);
BlogManager.instance().saveUser(user);
}
}
}
boolean updated = BlogManager.instance().updateMetadata(user, user.getBlog(), opts);
}

View File

@ -96,6 +96,10 @@ public class ProfileServlet extends BaseServlet {
out.write("<tr><td colspan=\"3\">Password: <input type=\"password\" name=\"password\" /></td></tr>\n");
out.write("<tr><td colspan=\"3\">Password again: <input type=\"password\" name=\"passwordConfirm\" /></td></tr>\n");
}
if (!BlogManager.instance().authorizeRemote(user)) {
out.write("<tr><td colspan=\"3\">To access the remote functionality, please specify the administrative password: <br />\n" +
"<input type=\"password\" name=\"adminPass\" /></td></tr>\n");
}
}
out.write("<tr><td colspan=\"3\"><input type=\"submit\" name=\"action\" value=\"Update profile\" /></td></tr>\n");

View File

@ -57,7 +57,10 @@ wrapper.java.additional.4=-Dorg.mortbay.xml.XmlParser.NotValidating=true
#wrapper.java.initmemory=4
# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=32
# The JVM's default is 64MB, and I2P can work fine in that, but to handle
# lots of I2PSnark activity in the same JVM, increasing the default max heap
# size should help. Feel free to reduce this if not using I2PSnark in the jvm
wrapper.java.maxmemory=128
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=net.i2p.router.Router