< prev index next >

test/sun/security/krb5/tools/KtabZero.java

Print this page




  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 import sun.security.krb5.internal.ktab.KeyTab;
  25 import sun.security.krb5.internal.ktab.KeyTabConstants;
  26 
  27 import java.io.File;
  28 import java.lang.reflect.Field;
  29 import java.nio.file.Files;
  30 import java.nio.file.Paths;
  31 
  32 /*
  33  * @test
  34  * @bug 8014196
  35  * @summary ktab creates a file with zero kt_vno

  36  */
  37 public class KtabZero {
  38 
  39     static final String NAME = "k.tab";
  40 
  41     public static void main(String[] args) throws Exception {
  42 
  43         // 0. Non-existing keytab
  44         Files.deleteIfExists(Paths.get(NAME));
  45         check(true);
  46 
  47         // 1. Create with KeyTab
  48         Files.deleteIfExists(Paths.get(NAME));
  49         KeyTab.getInstance(NAME).save();
  50         check(false);
  51 
  52         // 2. Create with the tool
  53         Files.deleteIfExists(Paths.get(NAME));
  54         try {
  55             Class ktab = Class.forName("sun.security.krb5.internal.tools.Ktab");




  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 import sun.security.krb5.internal.ktab.KeyTab;
  25 import sun.security.krb5.internal.ktab.KeyTabConstants;
  26 
  27 import java.io.File;
  28 import java.lang.reflect.Field;
  29 import java.nio.file.Files;
  30 import java.nio.file.Paths;
  31 
  32 /*
  33  * @test
  34  * @bug 8014196
  35  * @summary ktab creates a file with zero kt_vno
  36  * @modules java.security.jgss/sun.security.krb5.internal.ktab
  37  */
  38 public class KtabZero {
  39 
  40     static final String NAME = "k.tab";
  41 
  42     public static void main(String[] args) throws Exception {
  43 
  44         // 0. Non-existing keytab
  45         Files.deleteIfExists(Paths.get(NAME));
  46         check(true);
  47 
  48         // 1. Create with KeyTab
  49         Files.deleteIfExists(Paths.get(NAME));
  50         KeyTab.getInstance(NAME).save();
  51         check(false);
  52 
  53         // 2. Create with the tool
  54         Files.deleteIfExists(Paths.get(NAME));
  55         try {
  56             Class ktab = Class.forName("sun.security.krb5.internal.tools.Ktab");


< prev index next >