From: Benny Baumann Date: Sat, 11 Nov 2017 12:48:14 +0000 (+0100) Subject: Merge "chg: wording on root cert page" X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=fc3fd0bf7a3210adc98f4a0b1848f1b8a678115f;hp=2f867946a6b1bed2dc0fc198ab878d31c3876544 Merge "chg: wording on root cert page" --- diff --git a/src/club/wpia/gigi/database/DatabaseConnection.java b/src/club/wpia/gigi/database/DatabaseConnection.java index 20125a81..10e81e79 100644 --- a/src/club/wpia/gigi/database/DatabaseConnection.java +++ b/src/club/wpia/gigi/database/DatabaseConnection.java @@ -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; diff --git a/src/club/wpia/gigi/database/tableStructure.sql b/src/club/wpia/gigi/database/tableStructure.sql index bf457af3..440bdec7 100644 --- a/src/club/wpia/gigi/database/tableStructure.sql +++ b/src/club/wpia/gigi/database/tableStructure.sql @@ -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 index 00000000..53e0d458 --- /dev/null +++ b/src/club/wpia/gigi/database/upgrade/from_33.sql @@ -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"; diff --git a/src/club/wpia/gigi/ocsp/OCSPIssuerManager.java b/src/club/wpia/gigi/ocsp/OCSPIssuerManager.java index c83c3311..40e6d67c 100644 --- a/src/club/wpia/gigi/ocsp/OCSPIssuerManager.java +++ b/src/club/wpia/gigi/ocsp/OCSPIssuerManager.java @@ -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); } } diff --git a/src/club/wpia/gigi/output/template/Template.java b/src/club/wpia/gigi/output/template/Template.java index d3f5a011..ad53ac2e 100644 --- a/src/club/wpia/gigi/output/template/Template.java +++ b/src/club/wpia/gigi/output/template/Template.java @@ -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; diff --git a/src/club/wpia/gigi/util/PublicSuffixes.java b/src/club/wpia/gigi/util/PublicSuffixes.java index 401502f7..a86cbbb4 100644 --- a/src/club/wpia/gigi/util/PublicSuffixes.java +++ b/src/club/wpia/gigi/util/PublicSuffixes.java @@ -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); } } diff --git a/util-testing/club/wpia/gigi/util/SimpleSigner.java b/util-testing/club/wpia/gigi/util/SimpleSigner.java index b1c31509..67a546c9 100644 --- a/util-testing/club/wpia/gigi/util/SimpleSigner.java +++ b/util-testing/club/wpia/gigi/util/SimpleSigner.java @@ -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=?");