X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Fpages%2Faccount%2Fdomain%2FPingConfigForm.java;h=80ce8ff2e06bebac61203dcef1a9d9ea1b39a82c;hp=9e8c0b027957bf8269c8c321295f5ddcff5cc2fe;hb=cc10b8bdcbe80e515cd3b8a3de893a5146ff8790;hpb=381920896f2049769a85bad103b5a3218e13e23b diff --git a/src/org/cacert/gigi/pages/account/domain/PingConfigForm.java b/src/org/cacert/gigi/pages/account/domain/PingConfigForm.java index 9e8c0b02..80ce8ff2 100644 --- a/src/org/cacert/gigi/pages/account/domain/PingConfigForm.java +++ b/src/org/cacert/gigi/pages/account/domain/PingConfigForm.java @@ -17,6 +17,7 @@ import org.cacert.gigi.output.template.Form; import org.cacert.gigi.output.template.IterableDataset; import org.cacert.gigi.output.template.Template; import org.cacert.gigi.ping.SSLPinger; +import org.cacert.gigi.util.HTMLEncoder; import org.cacert.gigi.util.RandomToken; public class PingConfigForm extends Form { @@ -50,7 +51,7 @@ public class PingConfigForm extends Form { private SSLType[] sslTypes = new SSLType[MAX_SSL_TESTS]; - private final Template t = new Template(PingConfigForm.class.getResource("PingConfigForm.templ")); + private static final Template t = new Template(PingConfigForm.class.getResource("PingConfigForm.templ")); public PingConfigForm(HttpServletRequest hsr, Domain target) throws GigiApiException { super(hsr); @@ -87,9 +88,11 @@ public class PingConfigForm extends Form { case SSL: { doSSL = true; String[] parts = dpc.getInfo().split(":"); - ports[portpos] = Integer.parseInt(parts[0]); - if (parts.length == 2) { - sslTypes[portpos] = SSLType.valueOf(parts[1].toUpperCase()); + tokenName = parts[0]; + tokenValue = parts[1]; + ports[portpos] = Integer.parseInt(parts[2]); + if (parts.length == 4) { + sslTypes[portpos] = SSLType.valueOf(parts[3].toUpperCase()); } else { sslTypes[portpos] = SSLType.DIRECT; } @@ -106,6 +109,7 @@ public class PingConfigForm extends Form { @Override public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException { + target.clearPings(); if (req.getParameter("emailType") != null && req.getParameter("email") != null) { try { String mail = AUTHORATIVE_EMAILS[Integer.parseInt(req.getParameter("email"))]; @@ -130,9 +134,9 @@ public class PingConfigForm extends Form { } int portInt = Integer.parseInt(port); if ("direct".equals(type)) { - target.addPing(DomainPingType.SSL, port); + target.addPing(DomainPingType.SSL, tokenName + ":" + tokenValue + ":" + port); } else if (types.contains(type)) { - target.addPing(DomainPingType.SSL, portInt + ":" + type); + target.addPing(DomainPingType.SSL, tokenName + ":" + tokenValue + ":" + portInt + ":" + type); } } @@ -151,6 +155,7 @@ public class PingConfigForm extends Form { protected void outputEmbeddableContent(PrintWriter out, Language l, Map vars) { vars.put("tokenName", tokenName); vars.put("tokenValue", tokenValue); + vars.put("openSSLHelp", "" + HTMLEncoder.encodeHTML("-subj \"/CN=/OU=" + tokenValue + "\"") + ""); vars.put("authEmails", new IterableDataset() { int i = 0;