< prev index next >

test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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  */


  72  */
  73 public class ReplayCacheTestProc {
  74 
  75     private static Proc[] pa;   // all acceptors
  76     private static Proc pi;     // the single initiator
  77     private static List<Req> reqs = new ArrayList<>();
  78     private static String HOST = "localhost";
  79 
  80     private static final String SERVICE;
  81     private static long uid;
  82     private static String cwd;
  83 
  84     static {
  85         String tmp = System.getProperty("test.service");
  86         SERVICE = (tmp == null) ? "service" : tmp;
  87         uid = jdk.internal.misc.VM.geteuid();
  88         // Where should the rcache be saved. KRB5RCACHEDIR is not
  89         // recognized on Solaris (might be supported on Solaris 12),
  90         // and directory name is different when launched by root.
  91         // See manpage krb5envvar(5) on KRB5RCNAME.
  92         if (System.getProperty("os.name").startsWith("SunOS")) {
  93             if (uid == 0) {
  94                 cwd = "/var/krb5/rcache/root/";
  95             } else {
  96                 cwd = "/var/krb5/rcache/";
  97             }
  98         } else {
  99             cwd = System.getProperty("user.dir");
 100         }
 101     }
 102 
 103     private static MessageDigest md5, sha256;
 104 
 105     static {
 106         try {
 107             md5 = MessageDigest.getInstance("MD5");
 108             sha256 = MessageDigest.getInstance("SHA-256");
 109         } catch (NoSuchAlgorithmException nsae) {
 110             throw new AssertionError("Impossible", nsae);
 111         }
 112     }
 113 
 114 
 115     public static void main0(String[] args) throws Exception {
 116         System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
 117         if (args.length == 0) { // The controller
 118             int nc = 5;     // number of clients
 119             int ns = 5;     // number of services
 120             String[] libs;  // available acceptor types:


   1 /*
   2  * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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  */


  72  */
  73 public class ReplayCacheTestProc {
  74 
  75     private static Proc[] pa;   // all acceptors
  76     private static Proc pi;     // the single initiator
  77     private static List<Req> reqs = new ArrayList<>();
  78     private static String HOST = "localhost";
  79 
  80     private static final String SERVICE;
  81     private static long uid;
  82     private static String cwd;
  83 
  84     static {
  85         String tmp = System.getProperty("test.service");
  86         SERVICE = (tmp == null) ? "service" : tmp;
  87         uid = jdk.internal.misc.VM.geteuid();
  88         // Where should the rcache be saved. KRB5RCACHEDIR is not
  89         // recognized on Solaris (might be supported on Solaris 12),
  90         // and directory name is different when launched by root.
  91         // See manpage krb5envvar(5) on KRB5RCNAME.







  92         cwd = System.getProperty("user.dir");

  93     }
  94 
  95     private static MessageDigest md5, sha256;
  96 
  97     static {
  98         try {
  99             md5 = MessageDigest.getInstance("MD5");
 100             sha256 = MessageDigest.getInstance("SHA-256");
 101         } catch (NoSuchAlgorithmException nsae) {
 102             throw new AssertionError("Impossible", nsae);
 103         }
 104     }
 105 
 106 
 107     public static void main0(String[] args) throws Exception {
 108         System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
 109         if (args.length == 0) { // The controller
 110             int nc = 5;     // number of clients
 111             int ns = 5;     // number of services
 112             String[] libs;  // available acceptor types:


< prev index next >