Java Code Examples for sun.security.krb5.internal.Krb5#KDC_RETRY_LIMIT

The following examples show how to use sun.security.krb5.internal.Krb5#KDC_RETRY_LIMIT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KdcComm.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 2
Source File: KdcComm.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 3
Source File: KdcComm.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 4
Source File: KdcComm.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 5
Source File: KdcComm.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 6
Source File: KdcComm.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 7
Source File: KdcComm.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 8
Source File: KdcComm.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 9
Source File: KdcComm.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 10
Source File: KdcComm.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 11
Source File: KdcComm.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 12
Source File: KdcComm.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}
 
Example 13
Source File: KdcComm.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read global settings
 */
public static void initStatic() {
    String value = AccessController.doPrivileged(
    new PrivilegedAction<String>() {
        public String run() {
            return Security.getProperty(BAD_POLICY_KEY);
        }
    });
    if (value != null) {
        value = value.toLowerCase(Locale.ENGLISH);
        String[] ss = value.split(":");
        if ("tryless".equals(ss[0])) {
            if (ss.length > 1) {
                String[] params = ss[1].split(",");
                try {
                    int tmp0 = Integer.parseInt(params[0]);
                    if (params.length > 1) {
                        tryLessTimeout = Integer.parseInt(params[1]);
                    }
                    // Assign here in case of exception at params[1]
                    tryLessMaxRetries = tmp0;
                } catch (NumberFormatException nfe) {
                    // Ignored. Please note that tryLess is recognized and
                    // used, parameters using default values
                    if (DEBUG) {
                        System.out.println("Invalid " + BAD_POLICY_KEY +
                                " parameter for tryLess: " +
                                value + ", use default");
                    }
                }
            }
            badPolicy = BpType.TRY_LESS;
        } else if ("trylast".equals(ss[0])) {
            badPolicy = BpType.TRY_LAST;
        } else {
            badPolicy = BpType.NONE;
        }
    } else {
        badPolicy = BpType.NONE;
    }


    int timeout = -1;
    int max_retries = -1;
    int udp_pref_limit = -1;

    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "kdc_timeout");
        timeout = parseTimeString(temp);

        temp = cfg.get("libdefaults", "max_retries");
        max_retries = parsePositiveIntString(temp);
        temp = cfg.get("libdefaults", "udp_preference_limit");
        udp_pref_limit = parsePositiveIntString(temp);
    } catch (Exception exc) {
       // ignore any exceptions; use default values
       if (DEBUG) {
            System.out.println ("Exception in getting KDC communication " +
                                "settings, using default value " +
                                exc.getMessage());
       }
    }
    defaultKdcTimeout = timeout > 0 ? timeout : 30*1000; // 30 seconds
    defaultKdcRetryLimit =
            max_retries > 0 ? max_retries : Krb5.KDC_RETRY_LIMIT;

    if (udp_pref_limit < 0) {
        defaultUdpPrefLimit = Krb5.KDC_DEFAULT_UDP_PREF_LIMIT;
    } else if (udp_pref_limit > Krb5.KDC_HARD_UDP_LIMIT) {
        defaultUdpPrefLimit = Krb5.KDC_HARD_UDP_LIMIT;
    } else {
        defaultUdpPrefLimit = udp_pref_limit;
    }

    KdcAccessibility.reset();
}