src/java.security.jgss/share/classes/sun/security/krb5/KdcComm.java
changeset 51398 3c389a284345
parent 47216 71c04702a3d5
equal deleted inserted replaced
51397:c9150700bbd0 51398:3c389a284345
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    72      */
    72      */
    73     private static int defaultUdpPrefLimit;
    73     private static int defaultUdpPrefLimit;
    74 
    74 
    75     private static final boolean DEBUG = Krb5.DEBUG;
    75     private static final boolean DEBUG = Krb5.DEBUG;
    76 
    76 
    77     private static final String BAD_POLICY_KEY = "krb5.kdc.bad.policy";
       
    78 
       
    79     /**
    77     /**
    80      * What to do when a KDC is unavailable, specified in the
    78      * What to do when a KDC is unavailable, specified in the
    81      * java.security file with key krb5.kdc.bad.policy.
    79      * java.security file with key krb5.kdc.bad.policy.
    82      * Possible values can be TRY_LAST or TRY_LESS. Reloaded when refreshed.
    80      * Possible values can be TRY_LAST or TRY_LESS. Reloaded when refreshed.
    83      */
    81      */
    98      */
    96      */
    99     public static void initStatic() {
    97     public static void initStatic() {
   100         String value = AccessController.doPrivileged(
    98         String value = AccessController.doPrivileged(
   101         new PrivilegedAction<String>() {
    99         new PrivilegedAction<String>() {
   102             public String run() {
   100             public String run() {
   103                 return Security.getProperty(BAD_POLICY_KEY);
   101                 return Security.getProperty("krb5.kdc.bad.policy");
   104             }
   102             }
   105         });
   103         });
   106         if (value != null) {
   104         if (value != null) {
   107             value = value.toLowerCase(Locale.ENGLISH);
   105             value = value.toLowerCase(Locale.ENGLISH);
   108             String[] ss = value.split(":");
   106             String[] ss = value.split(":");
   118                         tryLessMaxRetries = tmp0;
   116                         tryLessMaxRetries = tmp0;
   119                     } catch (NumberFormatException nfe) {
   117                     } catch (NumberFormatException nfe) {
   120                         // Ignored. Please note that tryLess is recognized and
   118                         // Ignored. Please note that tryLess is recognized and
   121                         // used, parameters using default values
   119                         // used, parameters using default values
   122                         if (DEBUG) {
   120                         if (DEBUG) {
   123                             System.out.println("Invalid " + BAD_POLICY_KEY +
   121                             System.out.println("Invalid krb5.kdc.bad.policy" +
   124                                     " parameter for tryLess: " +
   122                                     " parameter for tryLess: " +
   125                                     value + ", use default");
   123                                     value + ", use default");
   126                         }
   124                         }
   127                     }
   125                     }
   128                 }
   126                 }