test/sun/security/krb5/ccache/TimeInCCache.java

Print this page
rev 10175 : 8048073: Cannot read ccache entry with a realm-less service name


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 /*
  24  * @test
  25  * @bug 6590930
  26  * @run main/othervm TimeInCCache
  27  * @summary read/write does not match for ccache
  28  */
  29 
  30 import java.io.ByteArrayInputStream;
  31 import java.lang.reflect.Field;
  32 import java.lang.reflect.Method;
  33 import java.nio.file.Files;
  34 import java.nio.file.Paths;
  35 
  36 import sun.security.krb5.internal.ccache.CCacheInputStream;
  37 import sun.security.krb5.internal.ccache.Credentials;
  38 
  39 public class TimeInCCache {
  40     // Attention: this field is also used by CorruptedCC.java test

  41     public static byte[] ccache;
  42 
  43     static {
  44         // A trivial cache file, with startdate and renewTill being zero.
  45         // The endtime is set to sometime in year 2022, so that isValid()
  46         // will always check starttime.
  47         String var =
  48             /*0000*/ "05 04 00 0C 00 01 00 08 FF FF FF 13 FF FE 59 33 " +
  49             /*0010*/ "00 00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 " +
  50             /*0020*/ "2E 4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 " +
  51             /*0030*/ "00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 2E " +
  52             /*0040*/ "4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 00 " +
  53             /*0050*/ "00 00 00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C " +
  54             /*0060*/ "4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00 " +
  55             /*0070*/ "00 0A 4D 41 58 49 2E 4C 4F 43 41 4C 00 11 00 00 " +
  56             /*0080*/ "00 10 B2 AB A6 CE BC 73 44 08 D9 93 5B 3D EF E5 " +
  57             /*0090*/ "86 88 47 45 10 87 00 00 00 00 62 45 10 87 00 00 " +
  58             /*00A0*/ "00 00 00 40 E0 00 00 00 00 00 00 00 00 00 00 00 " +
  59             /*00B0*/ "00 01 00 61 81 FD 30 81 FA A0 03 02 01 05 A1 0C " +
  60             /*00C0*/ "1B 0A 4D 41 58 49 2E 4C 4F 43 41 4C A2 1F 30 1D " +




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 /*
  24  * @test
  25  * @bug 6590930
  26  * @run main/othervm TimeInCCache
  27  * @summary read/write does not match for ccache
  28  */
  29 
  30 import java.io.ByteArrayInputStream;

  31 import java.lang.reflect.Method;


  32 
  33 import sun.security.krb5.internal.ccache.CCacheInputStream;
  34 import sun.security.krb5.internal.ccache.Credentials;
  35 
  36 public class TimeInCCache {
  37     // Attention: this field is also used by 2 other tests:
  38     // CorruptedCC.java and EmptyRealmCC.java
  39     public static byte[] ccache;
  40 
  41     static {
  42         // A trivial cache file, with startdate and renewTill being zero.
  43         // The endtime is set to sometime in year 2022, so that isValid()
  44         // will always check starttime.
  45         String var =
  46             /*0000*/ "05 04 00 0C 00 01 00 08 FF FF FF 13 FF FE 59 33 " +
  47             /*0010*/ "00 00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 " +
  48             /*0020*/ "2E 4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 " +
  49             /*0030*/ "00 00 01 00 00 00 01 00 00 00 0A 4D 41 58 49 2E " +
  50             /*0040*/ "4C 4F 43 41 4C 00 00 00 05 64 75 6D 6D 79 00 00 " +
  51             /*0050*/ "00 00 00 00 00 02 00 00 00 0A 4D 41 58 49 2E 4C " +
  52             /*0060*/ "4F 43 41 4C 00 00 00 06 6B 72 62 74 67 74 00 00 " +
  53             /*0070*/ "00 0A 4D 41 58 49 2E 4C 4F 43 41 4C 00 11 00 00 " +
  54             /*0080*/ "00 10 B2 AB A6 CE BC 73 44 08 D9 93 5B 3D EF E5 " +
  55             /*0090*/ "86 88 47 45 10 87 00 00 00 00 62 45 10 87 00 00 " +
  56             /*00A0*/ "00 00 00 40 E0 00 00 00 00 00 00 00 00 00 00 00 " +
  57             /*00B0*/ "00 01 00 61 81 FD 30 81 FA A0 03 02 01 05 A1 0C " +
  58             /*00C0*/ "1B 0A 4D 41 58 49 2E 4C 4F 43 41 4C A2 1F 30 1D " +