提交 d599234b 编写于 作者: W wetmore

Merge

...@@ -43,7 +43,7 @@ import sun.security.util.SecurityConstants; ...@@ -43,7 +43,7 @@ import sun.security.util.SecurityConstants;
* CookieHandler.getDefault(). * CookieHandler.getDefault().
* *
* For more information on HTTP state management, see <a * For more information on HTTP state management, see <a
* href="http://www.ietf.org/rfc/rfc2965.txt""><i>RFC&nbsp;2965: HTTP * href="http://www.ietf.org/rfc/rfc2965.txt"><i>RFC&nbsp;2965: HTTP
* State Management Mechanism</i></a> * State Management Mechanism</i></a>
* *
* @author Yingxian Wang * @author Yingxian Wang
......
...@@ -52,7 +52,7 @@ import sun.security.util.SecurityConstants; ...@@ -52,7 +52,7 @@ import sun.security.util.SecurityConstants;
* protocol is allowed to use a cached response. * protocol is allowed to use a cached response.
* *
* For more information on HTTP caching, see <a * For more information on HTTP caching, see <a
* href="http://www.ietf.org/rfc/rfc2616.txt""><i>RFC&nbsp;2616: Hypertext * href="http://www.ietf.org/rfc/rfc2616.txt"><i>RFC&nbsp;2616: Hypertext
* Transfer Protocol -- HTTP/1.1</i></a> * Transfer Protocol -- HTTP/1.1</i></a>
* *
* @author Yingxian Wang * @author Yingxian Wang
......
...@@ -49,7 +49,7 @@ import java.lang.NullPointerException; // for javadoc ...@@ -49,7 +49,7 @@ import java.lang.NullPointerException; // for javadoc
* *
* <p> Aside from some minor deviations noted below, an instance of this * <p> Aside from some minor deviations noted below, an instance of this
* class represents a URI reference as defined by * class represents a URI reference as defined by
* <a href="http://www.ietf.org/rfc/rfc2396.txt""><i>RFC&nbsp;2396: Uniform * <a href="http://www.ietf.org/rfc/rfc2396.txt"><i>RFC&nbsp;2396: Uniform
* Resource Identifiers (URI): Generic Syntax</i></a>, amended by <a * Resource Identifiers (URI): Generic Syntax</i></a>, amended by <a
* href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for * href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for
* Literal IPv6 Addresses in URLs</i></a>. The Literal IPv6 address format * Literal IPv6 Addresses in URLs</i></a>. The Literal IPv6 address format
...@@ -461,7 +461,7 @@ import java.lang.NullPointerException; // for javadoc ...@@ -461,7 +461,7 @@ import java.lang.NullPointerException; // for javadoc
* transformation format of ISO 10646</i></a>, <br><a * transformation format of ISO 10646</i></a>, <br><a
* href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC&nbsp;2373: IPv6 Addressing * href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC&nbsp;2373: IPv6 Addressing
* Architecture</i></a>, <br><a * Architecture</i></a>, <br><a
* href="http://www.ietf.org/rfc/rfc2396.txt""><i>RFC&nbsp;2396: Uniform * href="http://www.ietf.org/rfc/rfc2396.txt"><i>RFC&nbsp;2396: Uniform
* Resource Identifiers (URI): Generic Syntax</i></a>, <br><a * Resource Identifiers (URI): Generic Syntax</i></a>, <br><a
* href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for * href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for
* Literal IPv6 Addresses in URLs</i></a>, <br><a * Literal IPv6 Addresses in URLs</i></a>, <br><a
......
...@@ -66,7 +66,7 @@ import sun.security.util.SecurityConstants; ...@@ -66,7 +66,7 @@ import sun.security.util.SecurityConstants;
* </pre></blockquote> * </pre></blockquote>
* <p> * <p>
* The syntax of <code>URL</code> is defined by <a * The syntax of <code>URL</code> is defined by <a
* href="http://www.ietf.org/rfc/rfc2396.txt""><i>RFC&nbsp;2396: Uniform * href="http://www.ietf.org/rfc/rfc2396.txt"><i>RFC&nbsp;2396: Uniform
* Resource Identifiers (URI): Generic Syntax</i></a>, amended by <a * Resource Identifiers (URI): Generic Syntax</i></a>, amended by <a
* href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for * href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for
* Literal IPv6 Addresses in URLs</i></a>. The Literal IPv6 address format * Literal IPv6 Addresses in URLs</i></a>. The Literal IPv6 address format
......
...@@ -32,6 +32,7 @@ import java.security.*; ...@@ -32,6 +32,7 @@ import java.security.*;
import java.util.*; import java.util.*;
import java.security.interfaces.ECPublicKey; import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.ECParameterSpec; import java.security.spec.ECParameterSpec;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
...@@ -147,8 +148,33 @@ final class ClientHandshaker extends Handshaker { ...@@ -147,8 +148,33 @@ final class ClientHandshaker extends Handshaker {
case HandshakeMessage.ht_server_key_exchange: case HandshakeMessage.ht_server_key_exchange:
serverKeyExchangeReceived = true; serverKeyExchangeReceived = true;
switch (keyExchange) { switch (keyExchange) {
case K_RSA:
case K_RSA_EXPORT: case K_RSA_EXPORT:
/**
* The server key exchange message is sent by the server only
* when the server certificate message does not contain the
* proper amount of data to allow the client to exchange a
* premaster secret, such as when RSA_EXPORT is used and the
* public key in the server certificate is longer than 512 bits.
*/
if (serverKey == null) {
throw new SSLProtocolException
("Server did not send certificate message");
}
if (!(serverKey instanceof RSAPublicKey)) {
throw new SSLProtocolException("Protocol violation:" +
" the certificate type must be appropriate for the" +
" selected cipher suite's key exchange algorithm");
}
if (JsseJce.getRSAKeyLength(serverKey) <= 512) {
throw new SSLProtocolException("Protocol violation:" +
" server sent a server key exchange message for" +
" key exchange " + keyExchange +
" when the public key in the server certificate" +
" is less than or equal to 512 bits in length");
}
try { try {
this.serverKeyExchange(new RSA_ServerKeyExchange(input)); this.serverKeyExchange(new RSA_ServerKeyExchange(input));
} catch (GeneralSecurityException e) { } catch (GeneralSecurityException e) {
...@@ -180,6 +206,9 @@ final class ClientHandshaker extends Handshaker { ...@@ -180,6 +206,9 @@ final class ClientHandshaker extends Handshaker {
throwSSLException("Server key", e); throwSSLException("Server key", e);
} }
break; break;
case K_RSA:
case K_DH_RSA:
case K_DH_DSS:
case K_ECDH_ECDSA: case K_ECDH_ECDSA:
case K_ECDH_RSA: case K_ECDH_RSA:
throw new SSLProtocolException("Protocol violation: server sent" throw new SSLProtocolException("Protocol violation: server sent"
...@@ -580,6 +609,16 @@ final class ClientHandshaker extends Handshaker { ...@@ -580,6 +609,16 @@ final class ClientHandshaker extends Handshaker {
case K_RSA: case K_RSA:
case K_RSA_EXPORT: case K_RSA_EXPORT:
if (serverKey == null) {
throw new SSLProtocolException
("Server did not send certificate message");
}
if (!(serverKey instanceof RSAPublicKey)) {
throw new SSLProtocolException
("Server certificate does not include an RSA key");
}
/* /*
* For RSA key exchange, we randomly generate a new * For RSA key exchange, we randomly generate a new
* pre-master secret and encrypt it with the server's * pre-master secret and encrypt it with the server's
...@@ -588,8 +627,29 @@ final class ClientHandshaker extends Handshaker { ...@@ -588,8 +627,29 @@ final class ClientHandshaker extends Handshaker {
* it's a performance speedup not to do that until * it's a performance speedup not to do that until
* the client's waiting for the server response, but * the client's waiting for the server response, but
* more of a speedup for the D-H case. * more of a speedup for the D-H case.
*
* If the RSA_EXPORT scheme is active, when the public
* key in the server certificate is less than or equal
* to 512 bits in length, use the cert's public key,
* otherwise, the ephemeral one.
*/ */
PublicKey key = (keyExchange == K_RSA) ? serverKey : ephemeralServerKey; PublicKey key;
if (keyExchange == K_RSA) {
key = serverKey;
} else { // K_RSA_EXPORT
if (JsseJce.getRSAKeyLength(serverKey) <= 512) {
// extraneous ephemeralServerKey check done
// above in processMessage()
key = serverKey;
} else {
if (ephemeralServerKey == null) {
throw new SSLProtocolException("Server did not send" +
" a RSA_EXPORT Server Key Exchange message");
}
key = ephemeralServerKey;
}
}
m2 = new RSAClientKeyExchange(protocolVersion, maxProtocolVersion, m2 = new RSAClientKeyExchange(protocolVersion, maxProtocolVersion,
sslContext.getSecureRandom(), key); sslContext.getSecureRandom(), key);
break; break;
......
...@@ -4104,7 +4104,7 @@ class RuntimePerm extends Perm { ...@@ -4104,7 +4104,7 @@ class RuntimePerm extends Perm {
"getClassLoader", "getClassLoader",
"setContextClassLoader", "setContextClassLoader",
"enableContextClassLoaderOverride", "enableContextClassLoaderOverride",
"setSecurityManage", "setSecurityManager",
"createSecurityManager", "createSecurityManager",
"getenv.<" + "getenv.<" +
PolicyTool.rb.getString("environment variable name") + ">", PolicyTool.rb.getString("environment variable name") + ">",
......
...@@ -138,7 +138,6 @@ JNIEXPORT jobjectArray JNICALL ...@@ -138,7 +138,6 @@ JNIEXPORT jobjectArray JNICALL
Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
jstring host) { jstring host) {
const char *hostname; const char *hostname;
jobject name;
jobjectArray ret = 0; jobjectArray ret = 0;
struct hostent res, *hp = 0; struct hostent res, *hp = 0;
char buf[HENT_BUF_SIZE]; char buf[HENT_BUF_SIZE];
...@@ -210,12 +209,6 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -210,12 +209,6 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
addrp++; addrp++;
} }
name = (*env)->NewStringUTF(env, hostname);
if (IS_NULL(name)) {
goto cleanupAndReturn;
}
ret = (*env)->NewObjectArray(env, i, ni_iacls, NULL); ret = (*env)->NewObjectArray(env, i, ni_iacls, NULL);
if (IS_NULL(ret)) { if (IS_NULL(ret)) {
/* we may have memory to free at the end of this */ /* we may have memory to free at the end of this */
...@@ -231,7 +224,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -231,7 +224,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
} }
(*env)->SetIntField(env, iaObj, ni_iaaddressID, (*env)->SetIntField(env, iaObj, ni_iaaddressID,
ntohl((*addrp)->s_addr)); ntohl((*addrp)->s_addr));
(*env)->SetObjectField(env, iaObj, ni_iahostID, name); (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
(*env)->SetObjectArrayElement(env, ret, i, iaObj); (*env)->SetObjectArrayElement(env, ret, i, iaObj);
addrp++; addrp++;
i++; i++;
......
...@@ -142,7 +142,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -142,7 +142,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
jstring host) { jstring host) {
const char *hostname; const char *hostname;
jobjectArray ret = 0; jobjectArray ret = 0;
jobject name;
int retLen = 0; int retLen = 0;
jclass byteArrayCls; jclass byteArrayCls;
jboolean preferIPv6Address; jboolean preferIPv6Address;
...@@ -310,11 +309,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -310,11 +309,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
inet6Index = inetCount; inet6Index = inetCount;
} }
name = (*env)->NewStringUTF(env, hostname);
if (IS_NULL(name)) {
ret = NULL;
goto cleanupAndReturn;
}
while (iterator != NULL) { while (iterator != NULL) {
if (iterator->ai_family == AF_INET) { if (iterator->ai_family == AF_INET) {
jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
...@@ -324,7 +318,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -324,7 +318,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
} }
(*env)->SetIntField(env, iaObj, ni_iaaddressID, (*env)->SetIntField(env, iaObj, ni_iaaddressID,
ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
(*env)->SetObjectField(env, iaObj, ni_iahostID, name); (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
(*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
inetIndex++; inetIndex++;
} else if (iterator->ai_family == AF_INET6) { } else if (iterator->ai_family == AF_INET6) {
...@@ -355,7 +349,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -355,7 +349,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
(*env)->SetObjectField(env, iaObj, ni_iahostID, name); (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
(*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
inet6Index++; inet6Index++;
} }
......
...@@ -1117,9 +1117,33 @@ static short getFlags(JNIEnv *env, jstring name) { ...@@ -1117,9 +1117,33 @@ static short getFlags(JNIEnv *env, jstring name) {
if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) >= 0) { if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) >= 0) {
ret = if2.ifr_flags; ret = if2.ifr_flags;
} else { } else {
#if defined(__solaris__) && defined(AF_INET6)
/* Try with an IPv6 socket in case the interface has only IPv6 addresses assigned to it */
struct lifreq lifr;
close(sock);
sock = JVM_Socket(AF_INET6, SOCK_DGRAM, 0);
if (sock < 0) {
(*env)->ReleaseStringUTFChars(env, name, name_utf);
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"Socket creation failed");
return -1;
}
memset((caddr_t)&lifr, 0, sizeof(lifr));
strcpy((caddr_t)&(lifr.lifr_name), name_utf);
if (ioctl(sock, SIOCGLIFFLAGS, (char *)&lifr) >= 0) {
ret = lifr.lifr_flags;
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"IOCTL failed");
}
#else
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"IOCTL failed"); "IOCTL failed");
ret = -1; #endif
} }
close(sock); close(sock);
/* release the UTF string and interface list */ /* release the UTF string and interface list */
...@@ -1484,8 +1508,23 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas ...@@ -1484,8 +1508,23 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas
if (ioctl(sock, SIOCGLIFMTU, (caddr_t)&lifr) >= 0) { if (ioctl(sock, SIOCGLIFMTU, (caddr_t)&lifr) >= 0) {
ret = lifr.lifr_mtu; ret = lifr.lifr_mtu;
} else { } else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", /* Try wIth an IPv6 socket in case the interface has only IPv6 addresses assigned to it */
"IOCTL failed"); close(sock);
sock = JVM_Socket(AF_INET6, SOCK_DGRAM, 0);
if (sock < 0) {
(*env)->ReleaseStringUTFChars(env, name, name_utf);
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"Socket creation failed");
return -1;
}
if (ioctl(sock, SIOCGLIFMTU, (caddr_t)&lifr) >= 0) {
ret = lifr.lifr_mtu;
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"IOCTL failed");
}
} }
#endif #endif
close(sock); close(sock);
......
...@@ -95,94 +95,24 @@ static int marker_fd = -1; ...@@ -95,94 +95,24 @@ static int marker_fd = -1;
*/ */
static int getMarkerFD() static int getMarkerFD()
{ {
int server_fd, child_fd, connect_fd; int sv[2];
SOCKADDR him;
int type, len, port;
type = AF_INET; #ifdef AF_UNIX
#ifdef AF_INET6 if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == -1) {
if (ipv6_available()) {
type = AF_INET6;
}
#endif
/*
* Create listener on any port
*/
server_fd = JVM_Socket(type, SOCK_STREAM, 0);
if (server_fd < 0) {
return -1;
}
if (JVM_Listen(server_fd, 1) == -1) {
JVM_SocketClose(server_fd);
return -1;
}
len = SOCKADDR_LEN;
if (JVM_GetSockName(server_fd, (struct sockaddr *)&him, &len) == -1) {
JVM_SocketClose(server_fd);
return -1;
}
port = NET_GetPortFromSockaddr((struct sockaddr *)&him);
/*
* Establish connection from client socket.
* Server is bound to 0.0.0.0/X or ::/X
* We connect to 127.0.0.1/X or ::1/X
*/
#ifdef AF_INET6
if (ipv6_available()) {
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&him;
jbyte caddr[16];
memset((char *) caddr, 0, 16);
caddr[15] = 1;
memset((char *)him6, 0, sizeof(struct sockaddr_in6));
memcpy((void *)&(him6->sin6_addr), caddr, sizeof(struct in6_addr) );
him6->sin6_port = htons((short) port);
him6->sin6_family = AF_INET6;
len = sizeof(struct sockaddr_in6) ;
} else
#endif /* AF_INET6 */
{
struct sockaddr_in *him4 = (struct sockaddr_in*)&him;
memset((char *) him4, 0, sizeof(struct sockaddr_in));
him4->sin_port = htons((short) port);
him4->sin_addr.s_addr = (uint32_t) htonl(0x7f000001);
him4->sin_family = AF_INET;
len = sizeof(struct sockaddr_in);
}
connect_fd = JVM_Socket(type, SOCK_STREAM, 0);
if (connect_fd < 0) {
JVM_SocketClose(server_fd);
return -1;
}
if (JVM_Connect(connect_fd, (struct sockaddr *) &him, len) == -1) {
JVM_SocketClose(server_fd);
JVM_SocketClose(connect_fd);
return -1;
}
/*
* Server accepts connection - do in in non-blocking mode to avoid
* hanging if there's an error (should never happen!!!)
*/
SET_NONBLOCKING(server_fd);
len = SOCKADDR_LEN;
child_fd = JVM_Accept(server_fd, (struct sockaddr *)&him, (jint *)&len);
if (child_fd == -1) {
JVM_SocketClose(server_fd);
JVM_SocketClose(connect_fd);
return -1; return -1;
} }
#else
return -1;
#endif
/* /*
* Finally shutdown connect_fd (any reads to this fd will get * Finally shutdown sv[0] (any reads to this fd will get
* EOF; any writes will get an error). * EOF; any writes will get an error).
*/ */
JVM_SocketShutdown(connect_fd, 2); JVM_SocketShutdown(sv[0], 2);
JVM_SocketClose(child_fd); JVM_SocketClose(sv[1]);
JVM_SocketClose(server_fd);
return connect_fd; return sv[0];
} }
...@@ -1087,7 +1017,7 @@ Java_java_net_PlainSocketImpl_socketGetOption(JNIEnv *env, jobject this, ...@@ -1087,7 +1017,7 @@ Java_java_net_PlainSocketImpl_socketGetOption(JNIEnv *env, jobject this,
*/ */
if (cmd == java_net_SocketOptions_SO_BINDADDR) { if (cmd == java_net_SocketOptions_SO_BINDADDR) {
SOCKADDR him; SOCKADDR him;
int len = 0; socklen_t len = 0;
int port; int port;
jobject iaObj; jobject iaObj;
jclass iaCntrClass; jclass iaCntrClass;
......
...@@ -137,7 +137,6 @@ JNIEXPORT jobjectArray JNICALL ...@@ -137,7 +137,6 @@ JNIEXPORT jobjectArray JNICALL
Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
jstring host) { jstring host) {
const char *hostname; const char *hostname;
jobject name;
struct hostent *hp; struct hostent *hp;
unsigned int addr[4]; unsigned int addr[4];
...@@ -229,10 +228,6 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -229,10 +228,6 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
addrp++; addrp++;
} }
name = (*env)->NewStringUTF(env, hostname);
if (IS_NULL(name)) {
goto cleanupAndReturn;
}
ret = (*env)->NewObjectArray(env, i, ni_iacls, NULL); ret = (*env)->NewObjectArray(env, i, ni_iacls, NULL);
if (IS_NULL(ret)) { if (IS_NULL(ret)) {
...@@ -249,7 +244,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -249,7 +244,7 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
} }
(*env)->SetIntField(env, iaObj, ni_iaaddressID, (*env)->SetIntField(env, iaObj, ni_iaaddressID,
ntohl((*addrp)->s_addr)); ntohl((*addrp)->s_addr));
(*env)->SetObjectField(env, iaObj, ni_iahostID, name); (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
(*env)->SetObjectArrayElement(env, ret, i, iaObj); (*env)->SetObjectArrayElement(env, ret, i, iaObj);
addrp++; addrp++;
i++; i++;
......
...@@ -86,7 +86,6 @@ JNIEXPORT jobjectArray JNICALL ...@@ -86,7 +86,6 @@ JNIEXPORT jobjectArray JNICALL
Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
jstring host) { jstring host) {
const char *hostname; const char *hostname;
jobject name;
jobjectArray ret = 0; jobjectArray ret = 0;
int retLen = 0; int retLen = 0;
jboolean preferIPv6Address; jboolean preferIPv6Address;
...@@ -237,12 +236,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -237,12 +236,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
inet6Index = inetCount; inet6Index = inetCount;
} }
name = (*env)->NewStringUTF(env, hostname);
if (IS_NULL(name)) {
ret = NULL;
goto cleanupAndReturn;
}
while (iterator != NULL) { while (iterator != NULL) {
if (iterator->ai_family == AF_INET) { if (iterator->ai_family == AF_INET) {
jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID); jobject iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
...@@ -252,7 +245,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -252,7 +245,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
} }
(*env)->SetIntField(env, iaObj, ni_iaaddressID, (*env)->SetIntField(env, iaObj, ni_iaaddressID,
ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr)); ntohl(((struct sockaddr_in*)iterator->ai_addr)->sin_addr.s_addr));
(*env)->SetObjectField(env, iaObj, ni_iahostID, name); (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
(*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj); (*env)->SetObjectArrayElement(env, ret, inetIndex, iaObj);
inetIndex ++; inetIndex ++;
} else if (iterator->ai_family == AF_INET6) { } else if (iterator->ai_family == AF_INET6) {
...@@ -276,7 +269,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, ...@@ -276,7 +269,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
(*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE); (*env)->SetBooleanField(env, iaObj, ia6_scopeidsetID, JNI_TRUE);
} }
(*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress); (*env)->SetObjectField(env, iaObj, ni_ia6ipaddressID, ipaddress);
(*env)->SetObjectField(env, iaObj, ni_iahostID, name); (*env)->SetObjectField(env, iaObj, ni_iahostID, host);
(*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj); (*env)->SetObjectArrayElement(env, ret, inet6Index, iaObj);
inet6Index ++; inet6Index ++;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
# #
# @run shell/manual console.sh # @run shell/manual console.sh
if [ "$ALT_PASS" == "" ]; then if [ "$ALT_PASS" = "" ]; then
export PASS=äöäöäöäö export PASS=äöäöäöäö
else else
export PASS=$ALT_PASS export PASS=$ALT_PASS
...@@ -54,7 +54,7 @@ echo "If you see both the prompts appear, say --" ...@@ -54,7 +54,7 @@ echo "If you see both the prompts appear, say --"
echo " Enter key password for <mykey>" echo " Enter key password for <mykey>"
echo " (RETURN if same as keystore password): Enter keystore password:" echo " (RETURN if same as keystore password): Enter keystore password:"
echo "only response to the last prompt by typing $PASS and press ENTER" echo "only response to the last prompt by typing $PASS and press ENTER"
echo echo
echo "Only if all the command run correctly without showing any error " echo "Only if all the command run correctly without showing any error "
echo "or warning, this test passes." echo "or warning, this test passes."
echo echo
...@@ -87,3 +87,6 @@ echo $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala ...@@ -87,3 +87,6 @@ echo $PASS| $J5/bin/keytool -keystore kkk -genkey -dname CN=olala
$JM/bin/keytool -keystore kkk -list $JM/bin/keytool -keystore kkk -list
echo $PASS| $J5/bin/keytool -keystore kkk -list echo $PASS| $J5/bin/keytool -keystore kkk -list
echo $PASS| $JM/bin/keytool -keystore kkk -list echo $PASS| $JM/bin/keytool -keystore kkk -list
rm kkk
exit 0
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册