]> WPIA git - gigi.git/commitdiff
Merge "chg: improve information about password strength"
authorFelix Dörre <felix@dogcraft.de>
Tue, 14 Nov 2017 18:24:12 +0000 (19:24 +0100)
committerGerrit Code Review <gigi-system@dogcraft.de>
Tue, 14 Nov 2017 18:24:12 +0000 (19:24 +0100)
src/club/wpia/gigi/database/DatabaseConnection.java
src/club/wpia/gigi/database/tableStructure.sql
src/club/wpia/gigi/database/upgrade/from_33.sql [new file with mode: 0644]
src/club/wpia/gigi/ocsp/OCSPIssuerManager.java
src/club/wpia/gigi/output/template/Template.java
src/club/wpia/gigi/pages/RootCertPage.templ
src/club/wpia/gigi/util/PublicSuffixes.java
util-testing/club/wpia/gigi/util/SimpleSigner.java

index 20125a81e0f54420e79508244eae7d05bf0fbdad..10e81e79df1f1119a05fc5e86606c7c794585c33 100644 (file)
@@ -53,7 +53,7 @@ public class DatabaseConnection {
             System.out.println("Upgrade 32: loading " + f);
             if (f.exists()) {
                 StringBuilder sb = new StringBuilder();
-                try (Reader r = new InputStreamReader(new FileInputStream(f), "UTF-8")) {
+                try (FileInputStream fis = new FileInputStream(f); Reader r = new InputStreamReader(fis, "UTF-8")) {
                     int len;
                     char[] buf = new char[4096];
                     while ((len = r.read(buf)) > 0) {
@@ -181,7 +181,7 @@ public class DatabaseConnection {
 
     }
 
-    public static final int CURRENT_SCHEMA_VERSION = 33;
+    public static final int CURRENT_SCHEMA_VERSION = 34;
 
     public static final int CONNECTION_TIMEOUT = 24 * 60 * 60;
 
index bf457af37f3ee6acbac12fa65281677bdbd6f9e1..440bdec788db8fee8de4e8c532dd4b6e439dd97f 100644 (file)
@@ -243,7 +243,7 @@ CREATE TABLE "jobs" (
   "targetId" int NOT NULL,
   "task" "jobType" NOT NULL,
   "state" "jobState" NOT NULL DEFAULT 'open',
-  "warning" smallint NOT NULL DEFAULT '0',
+  "attempt" smallint NOT NULL DEFAULT '0',
   "executeFrom" DATE,
   "executeTo" VARCHAR(11),
   PRIMARY KEY ("id")
@@ -378,7 +378,7 @@ CREATE TABLE "schemeVersion" (
   "version" smallint NOT NULL,
   PRIMARY KEY ("version")
 );
-INSERT INTO "schemeVersion" (version)  VALUES(33);
+INSERT INTO "schemeVersion" (version)  VALUES(34);
 
 DROP TABLE IF EXISTS `passwordResetTickets`;
 CREATE TABLE `passwordResetTickets` (
@@ -695,3 +695,12 @@ CREATE TABLE "certificateAttachment" (
   "content" text NOT NULL,
   PRIMARY KEY ("certid", "type")
 );
+
+DROP TABLE IF EXISTS "jobLog";
+CREATE TABLE "jobLog" (
+  "jobid" int NOT NULL,
+  "attempt" smallint NOT NULL,
+  "content" text NOT NULL,
+  PRIMARY KEY ("jobid", "attempt")
+);
+CREATE INDEX ON "jobLog" ("jobid");
diff --git a/src/club/wpia/gigi/database/upgrade/from_33.sql b/src/club/wpia/gigi/database/upgrade/from_33.sql
new file mode 100644 (file)
index 0000000..53e0d45
--- /dev/null
@@ -0,0 +1,9 @@
+CREATE TABLE "jobLog" (
+  "jobid" int NOT NULL,
+  "attempt" smallint NOT NULL,
+  "content" text NOT NULL,
+  PRIMARY KEY ("jobid", "attempt")
+);
+CREATE INDEX ON "jobLog" ("jobid");
+
+ALTER TABLE "jobs" RENAME COLUMN "warning" TO "attempt";
index c83c3311c4635fdcadda1d77e8a1c6d93cd4f412..40e6d67c5ca74c0692de6829d90bf7f7c4d51092 100644 (file)
@@ -194,7 +194,7 @@ public class OCSPIssuerManager implements Runnable {
         ocspCsr.delete();
         ocspCrt.delete();
         String csr = PEM.encode("CERTIFICATE REQUEST", p10.getEncoded());
-        try (Writer w = new OutputStreamWriter(new FileOutputStream(ocspCsr), "UTF-8")) {
+        try (FileOutputStream fos = new FileOutputStream(ocspCsr); Writer w = new OutputStreamWriter(fos, "UTF-8")) {
             w.write(csr);
         }
     }
index d3f5a011aa6448a8e2aae66e5a7055eb6942e844..ad53ac2ed4492ccbff4ec54598896d328fdc41b7 100644 (file)
@@ -237,7 +237,7 @@ public class Template implements Outputable {
     protected void tryReload() {
         if (source != null && lastLoaded < source.lastModified()) {
             System.out.println("Reloading template.... " + source);
-            try (InputStreamReader r = new InputStreamReader(new FileInputStream(source), "UTF-8")) {
+            try (FileInputStream fis = new FileInputStream(source); InputStreamReader r = new InputStreamReader(fis, "UTF-8")) {
                 data = parse(r).getBlock(null);
                 r.close();
                 lastLoaded = source.lastModified() + 1000;
index 060fdfd4ad509fec8a339242b58fe38dfb696e4c..0f6a8f05ed93670581b92db891f056dc037fe6c8 100644 (file)
@@ -1,7 +1,7 @@
-<?=_The Root certificates are available for download here. Choose your preferred format:?><br/>
+<?=_The Root certificate is available for download here. Choose your preferred format:?><br/>
 <a href="?pem">PEM</a> <a href="?cer">DER</a>
 <p>
-<?=_A full list of DER-encoded certificates is also provided below.?>
+<?=_A full list of all DER-encoded intermediate certificates is provided below:?>
 </p>
 <div>
 <?=$root?>
index 401502f72f03df0d8aaf54d4bfd31cdb8ef47a93..a86cbbb43b3a030fcef031859985157f4a2136b5 100644 (file)
@@ -26,7 +26,7 @@ public class PublicSuffixes {
             throw new Error("Public Suffix List could not be loaded.");
         }
 
-        try (BufferedReader br = new BufferedReader(new InputStreamReader(res, "UTF-8"))) {
+        try (InputStreamReader isr = new InputStreamReader(res, "UTF-8"); BufferedReader br = new BufferedReader(isr)) {
             return new PublicSuffixes(br);
         }
     }
index b1c31509e88926e38f2dd49752e4852bd92d48a4..67a546c9e7279a8bd7acf364a9d710ddc291c4d5 100644 (file)
@@ -139,7 +139,7 @@ public class SimpleSigner {
                             "WHERE `certId`=?");
 
                     updateMail = new GigiPreparedStatement("UPDATE certs SET created=NOW(), serial=?, caid=?, expire=? WHERE id=?");
-                    warnMail = new GigiPreparedStatement("UPDATE jobs SET warning=warning+1, state=CASE WHEN warning<3 THEN 'open'::`jobState` ELSE 'error'::`jobState` END WHERE id=?");
+                    warnMail = new GigiPreparedStatement("UPDATE jobs SET attempt=attempt+1, state=CASE WHEN attempt<3 THEN 'open'::`jobState` ELSE 'error'::`jobState` END WHERE id=?");
 
                     revoke = new GigiPreparedStatement("SELECT certs.id, jobs.id FROM jobs INNER JOIN certs ON jobs.`targetId`=certs.id" + " WHERE jobs.state='open' AND task='revoke'");
                     revokeCompleted = new GigiPreparedStatement("UPDATE `certs` SET revoked=NOW() WHERE id=?");