Java Code Examples for sun.security.krb5.internal.Krb5#KDC_INET_DEFAULT_PORT
The following examples show how to use
sun.security.krb5.internal.Krb5#KDC_INET_DEFAULT_PORT .
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 |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 2
Source File: KdcComm.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 3
Source File: KdcComm.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 4
Source File: KdcComm.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 5
Source File: KdcComm.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 6
Source File: KdcComm.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 7
Source File: KdcComm.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 8
Source File: KdcComm.java From hottub with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 9
Source File: KdcComm.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 10
Source File: KdcComm.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 11
Source File: KdcComm.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 12
Source File: KdcComm.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }
Example 13
Source File: KdcComm.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private byte[] send(byte[] obuf, String tempKdc, boolean useTCP) throws IOException, KrbException { if (obuf == null) return null; int port = Krb5.KDC_INET_DEFAULT_PORT; int retries = getRealmSpecificValue( realm, "max_retries", defaultKdcRetryLimit); int timeout = getRealmSpecificValue( realm, "kdc_timeout", defaultKdcTimeout); if (badPolicy == BpType.TRY_LESS && KdcAccessibility.isBad(tempKdc)) { if (retries > tryLessMaxRetries) { retries = tryLessMaxRetries; // less retries } if (timeout > tryLessTimeout) { timeout = tryLessTimeout; // less time } } String kdc = null; String portStr = null; if (tempKdc.charAt(0) == '[') { // Explicit IPv6 in [] int pos = tempKdc.indexOf(']', 1); if (pos == -1) { throw new IOException("Illegal KDC: " + tempKdc); } kdc = tempKdc.substring(1, pos); if (pos != tempKdc.length() - 1) { // with port number if (tempKdc.charAt(pos+1) != ':') { throw new IOException("Illegal KDC: " + tempKdc); } portStr = tempKdc.substring(pos+2); } } else { int colon = tempKdc.indexOf(':'); if (colon == -1) { // Hostname or IPv4 host only kdc = tempKdc; } else { int nextColon = tempKdc.indexOf(':', colon+1); if (nextColon > 0) { // >=2 ":", IPv6 with no port kdc = tempKdc; } else { // 1 ":", hostname or IPv4 with port kdc = tempKdc.substring(0, colon); portStr = tempKdc.substring(colon+1); } } } if (portStr != null) { int tempPort = parsePositiveIntString(portStr); if (tempPort > 0) port = tempPort; } if (DEBUG) { System.out.println(">>> KrbKdcReq send: kdc=" + kdc + (useTCP ? " TCP:":" UDP:") + port + ", timeout=" + timeout + ", number of retries =" + retries + ", #bytes=" + obuf.length); } KdcCommunication kdcCommunication = new KdcCommunication(kdc, port, useTCP, timeout, retries, obuf); try { byte[] ibuf = AccessController.doPrivileged(kdcCommunication); if (DEBUG) { System.out.println(">>> KrbKdcReq send: #bytes read=" + (ibuf != null ? ibuf.length : 0)); } return ibuf; } catch (PrivilegedActionException e) { Exception wrappedException = e.getException(); if (wrappedException instanceof IOException) { throw (IOException) wrappedException; } else { throw (KrbException) wrappedException; } } }