diff -r 41a5b2de5ad3 -r 45511dcfed3f test/jdk/sun/security/krb5/auto/KDC.java --- a/test/jdk/sun/security/krb5/auto/KDC.java Mon Jun 25 10:54:55 2018 +0200 +++ b/test/jdk/sun/security/krb5/auto/KDC.java Tue Mar 20 11:16:10 2018 +0530 @@ -713,10 +713,10 @@ /** * Returns a KerberosTime. * - * @param offset offset from NOW in milliseconds + * @param offset offset from NOW in seconds */ - private static KerberosTime timeFor(long offset) { - return new KerberosTime(new Date().getTime() + offset); + private static KerberosTime timeAfter(int offset) { + return new KerberosTime(new Date().getTime() + offset * 1000L); } /** @@ -832,12 +832,12 @@ KerberosTime from = body.from; KerberosTime till = body.till; if (from == null || from.isZero()) { - from = timeFor(0); + from = timeAfter(0); } if (till == null) { throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO } else if (till.isZero()) { - till = timeFor(1000 * DEFAULT_LIFETIME); + till = timeAfter(DEFAULT_LIFETIME); } boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1]; @@ -863,7 +863,7 @@ } if (body.kdcOptions.get(KDCOptions.RENEWABLE)) { bFlags[Krb5.TKT_OPTS_RENEWABLE] = true; - //renew = timeFor(1000 * 3600 * 24 * 7); + //renew = timeAfter(3600 * 24 * 7); } if (body.kdcOptions.get(KDCOptions.PROXIABLE)) { bFlags[Krb5.TKT_OPTS_PROXIABLE] = true; @@ -933,7 +933,7 @@ key, cname, new TransitedEncoding(1, new byte[0]), // TODO - timeFor(0), + timeAfter(0), from, till, renewTill, body.addresses != null ? body.addresses @@ -952,13 +952,13 @@ EncTGSRepPart enc_part = new EncTGSRepPart( key, new LastReq(new LastReqEntry[] { - new LastReqEntry(0, timeFor(-10000)) + new LastReqEntry(0, timeAfter(-10)) }), body.getNonce(), // TODO: detect replay - timeFor(1000 * 3600 * 24), + timeAfter(3600 * 24), // Next 5 and last MUST be same with ticket tFlags, - timeFor(0), + timeAfter(0), from, till, renewTill, service, @@ -986,7 +986,7 @@ + " " +ke.returnCodeMessage()); if (kerr == null) { kerr = new KRBError(null, null, null, - timeFor(0), + timeAfter(0), 0, ke.returnCode(), body.cname, @@ -1059,20 +1059,21 @@ KerberosTime till = body.till; KerberosTime rtime = body.rtime; if (from == null || from.isZero()) { - from = timeFor(0); + from = timeAfter(0); } if (till == null) { throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO } else if (till.isZero()) { - till = timeFor(1000 * DEFAULT_LIFETIME); - } else if (till.greaterThan(timeFor(24 * 3600 * 1000))) { + till = timeAfter(DEFAULT_LIFETIME); + } else if (till.greaterThan(timeAfter(24 * 3600)) + && System.getProperty("test.kdc.force.till") == null) { // If till is more than 1 day later, make it renewable - till = timeFor(1000 * DEFAULT_LIFETIME); + till = timeAfter(DEFAULT_LIFETIME); body.kdcOptions.set(KDCOptions.RENEWABLE, true); if (rtime == null) rtime = till; } if (rtime == null && body.kdcOptions.get(KDCOptions.RENEWABLE)) { - rtime = timeFor(1000 * DEFAULT_RENEWTIME); + rtime = timeAfter(DEFAULT_RENEWTIME); } //body.from boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1]; @@ -1088,7 +1089,7 @@ } if (body.kdcOptions.get(KDCOptions.RENEWABLE)) { bFlags[Krb5.TKT_OPTS_RENEWABLE] = true; - //renew = timeFor(1000 * 3600 * 24 * 7); + //renew = timeAfter(3600 * 24 * 7); } if (body.kdcOptions.get(KDCOptions.PROXIABLE)) { bFlags[Krb5.TKT_OPTS_PROXIABLE] = true; @@ -1234,7 +1235,7 @@ key, body.cname, new TransitedEncoding(1, new byte[0]), - timeFor(0), + timeAfter(0), from, till, rtime, body.addresses, @@ -1246,13 +1247,13 @@ EncASRepPart enc_part = new EncASRepPart( key, new LastReq(new LastReqEntry[]{ - new LastReqEntry(0, timeFor(-10000)) + new LastReqEntry(0, timeAfter(-10)) }), body.getNonce(), // TODO: detect replay? - timeFor(1000 * 3600 * 24), + timeAfter(3600 * 24), // Next 5 and last MUST be same with ticket tFlags, - timeFor(0), + timeAfter(0), from, till, rtime, service, @@ -1314,7 +1315,7 @@ eData = temp.toByteArray(); } kerr = new KRBError(null, null, null, - timeFor(0), + timeAfter(0), 0, ke.returnCode(), body.cname,