import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;
+// restrict the maximum number of open connections from any given source IP (probably max 4)
public class Main {
public static void main(String[] s) throws Exception {
private ServerSocket ss;
public Acceptor(ServerSocket ss) { this.ss = ss; }
public void run() {
- try {
- ss.setReuseAddress(true);
-
- while(true) {
+ while(true) {
+ try {
+ ss.setReuseAddress(true);
final Socket s = ss.accept();
- try {
- new Thread() {
- public void run() {
- try {
- accept(new Connection(s, "megacz.com"));
- } catch (Exception e) { Log.error(Main.class, e); }
- }
- }.start();
- } catch (Exception e) { Log.error(Main.class, e); }
+ new Thread() {
+ public void run() {
+ try {
+ accept(new Connection(s, "megacz.com"));
+ } catch (Throwable t) { Log.error(Main.class, t); }
+ }
+ }.start();
+ } catch (Throwable t) {
+ Log.error(Main.class, t);
+ Misc.sleep(1000);
}
- } catch (Exception e) { Log.error(Main.class, e); }
+ }
}
}
static final Auth auth = new Auth();
static class Auth implements Login {
- private KerberosAuth ka = new KerberosAuth("MEGACZ.COM", "godel.megacz.com");
+ private KerberosAuth ka = new KerberosAuth("MEGACZ.COM", "chaitin.megacz.com");
public Account anonymous() {
try {
final Mailbox root =
public Object login(String user, String pass, Class protocol) { return login(user, pass); }
public Account login(String user, String pass) {
//if (!EtcPasswd.verify(user, pass)) return null;
+ //if (!CheckPassword.verify(user, pass)) return null;
if (!ka.auth(user, pass)) return null;
final Mailbox root =
FileBasedMailbox.getFileBasedMailbox(Mailbox.STORAGE_ROOT + "/user", true);