Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
07e03cf1
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
07e03cf1
编写于
3月 24, 2015
作者:
A
amurillo
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
38a136fd
b9b979b1
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
320 addition
and
79 deletion
+320
-79
src/share/classes/java/security/ProtectionDomain.java
src/share/classes/java/security/ProtectionDomain.java
+28
-14
src/share/classes/java/security/cert/X509CertSelector.java
src/share/classes/java/security/cert/X509CertSelector.java
+4
-2
src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
...re/classes/javax/imageio/stream/ImageInputStreamImpl.java
+2
-2
src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java
...security/provider/certpath/AdaptableX509CertSelector.java
+6
-3
src/share/classes/sun/security/provider/certpath/Builder.java
...share/classes/sun/security/provider/certpath/Builder.java
+7
-2
src/share/classes/sun/security/provider/certpath/ConstraintsChecker.java
...es/sun/security/provider/certpath/ConstraintsChecker.java
+7
-7
src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java
.../security/provider/certpath/DistributionPointFetcher.java
+12
-2
src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
...lasses/sun/security/provider/certpath/ForwardBuilder.java
+11
-4
src/share/classes/sun/security/provider/certpath/PKIXMasterCertPathValidator.java
...curity/provider/certpath/PKIXMasterCertPathValidator.java
+12
-6
src/share/classes/sun/security/provider/certpath/RevocationChecker.java
...ses/sun/security/provider/certpath/RevocationChecker.java
+9
-3
src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
...es/sun/security/provider/certpath/SunCertPathBuilder.java
+3
-2
src/share/classes/sun/security/ssl/ClientHandshaker.java
src/share/classes/sun/security/ssl/ClientHandshaker.java
+81
-29
src/share/classes/sun/security/ssl/HandshakeMessage.java
src/share/classes/sun/security/ssl/HandshakeMessage.java
+6
-3
test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java
test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java
+5
-0
test/javax/imageio/stream/ShortStreamTest.java
test/javax/imageio/stream/ShortStreamTest.java
+127
-0
未找到文件。
src/share/classes/java/security/ProtectionDomain.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,6 +25,7 @@
package
java.security
;
import
java.lang.ref.WeakReference
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Enumeration
;
...
...
@@ -456,24 +457,37 @@ public class ProtectionDomain {
/**
* Used for storing ProtectionDomains as keys in a Map.
*/
final
class
Key
{}
final
static
class
Key
{}
// A cache of ProtectionDomains and their Permissions
private
static
class
PDCache
implements
ProtectionDomainCache
{
// We must wrap the PermissionCollection in a WeakReference as there
// are some PermissionCollections which contain strong references
// back to a ProtectionDomain and otherwise would never be removed
// from the WeakHashMap
private
final
Map
<
Key
,
WeakReference
<
PermissionCollection
>>
map
=
new
WeakHashMap
<>();
@Override
public
synchronized
void
put
(
ProtectionDomain
pd
,
PermissionCollection
pc
)
{
map
.
put
(
pd
==
null
?
null
:
pd
.
key
,
new
WeakReference
<>(
pc
));
}
@Override
public
synchronized
PermissionCollection
get
(
ProtectionDomain
pd
)
{
WeakReference
<
PermissionCollection
>
ref
=
map
.
get
(
pd
==
null
?
null
:
pd
.
key
);
return
ref
==
null
?
null
:
ref
.
get
();
}
}
static
{
SharedSecrets
.
setJavaSecurityProtectionDomainAccess
(
new
JavaSecurityProtectionDomainAccess
()
{
@Override
public
ProtectionDomainCache
getProtectionDomainCache
()
{
return
new
ProtectionDomainCache
()
{
private
final
Map
<
Key
,
PermissionCollection
>
map
=
Collections
.
synchronizedMap
(
new
WeakHashMap
<
Key
,
PermissionCollection
>());
public
void
put
(
ProtectionDomain
pd
,
PermissionCollection
pc
)
{
map
.
put
((
pd
==
null
?
null
:
pd
.
key
),
pc
);
}
public
PermissionCollection
get
(
ProtectionDomain
pd
)
{
return
pd
==
null
?
map
.
get
(
null
)
:
map
.
get
(
pd
.
key
);
}
};
return
new
PDCache
();
}
});
}
...
...
src/share/classes/java/security/cert/X509CertSelector.java
浏览文件 @
07e03cf1
...
...
@@ -2574,8 +2574,10 @@ public class X509CertSelector implements CertSelector {
}
else
{
if
(
maxPathLen
<
basicConstraints
)
{
if
(
debug
!=
null
)
{
debug
.
println
(
"X509CertSelector.match: maxPathLen too small ("
+
maxPathLen
+
" < "
+
basicConstraints
+
")"
);
debug
.
println
(
"X509CertSelector.match: cert's maxPathLen "
+
"is less than the min maxPathLen set by "
+
"basicConstraints. "
+
"("
+
maxPathLen
+
" < "
+
basicConstraints
+
")"
);
}
return
false
;
}
...
...
src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
浏览文件 @
07e03cf1
...
...
@@ -225,7 +225,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream {
}
public
short
readShort
()
throws
IOException
{
if
(
read
(
byteBuf
,
0
,
2
)
<
0
)
{
if
(
read
(
byteBuf
,
0
,
2
)
!=
2
)
{
throw
new
EOFException
();
}
...
...
@@ -247,7 +247,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream {
}
public
int
readInt
()
throws
IOException
{
if
(
read
(
byteBuf
,
0
,
4
)
<
0
)
{
if
(
read
(
byteBuf
,
0
,
4
)
!=
4
)
{
throw
new
EOFException
();
}
...
...
src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -224,7 +224,8 @@ class AdaptableX509CertSelector extends X509CertSelector {
if
(
extVal
==
null
)
{
if
(
debug
!=
null
)
{
debug
.
println
(
"AdaptableX509CertSelector.match: "
+
"no subject key ID extension"
);
+
"no subject key ID extension. Subject: "
+
xcert
.
getSubjectX500Principal
());
}
return
true
;
}
...
...
@@ -234,7 +235,9 @@ class AdaptableX509CertSelector extends X509CertSelector {
!
Arrays
.
equals
(
ski
,
certSubjectKeyID
))
{
if
(
debug
!=
null
)
{
debug
.
println
(
"AdaptableX509CertSelector.match: "
+
"subject key IDs don't match"
);
+
"subject key IDs don't match. "
+
"Expected: "
+
Arrays
.
toString
(
ski
)
+
" "
+
"Cert's: "
+
Arrays
.
toString
(
certSubjectKeyID
));
}
return
false
;
}
...
...
src/share/classes/sun/security/provider/certpath/Builder.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2000, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -435,7 +435,12 @@ public abstract class Builder {
if
(
selector
.
match
(
targetCert
)
&&
!
X509CertImpl
.
isSelfSigned
(
targetCert
,
buildParams
.
sigProvider
()))
{
if
(
debug
!=
null
)
{
debug
.
println
(
"Builder.addMatchingCerts: adding target cert"
);
debug
.
println
(
"Builder.addMatchingCerts: "
+
"adding target cert"
+
"\n SN: "
+
Debug
.
toHexString
(
targetCert
.
getSerialNumber
())
+
"\n Subject: "
+
targetCert
.
getSubjectX500Principal
()
+
"\n Issuer: "
+
targetCert
.
getIssuerX500Principal
());
}
return
resultCerts
.
add
(
targetCert
);
}
...
...
src/share/classes/sun/security/provider/certpath/ConstraintsChecker.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2000, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -145,8 +145,8 @@ class ConstraintsChecker extends PKIXCertPathChecker {
if
(
prevNC
!=
null
&&
((
i
==
certPathLength
)
||
!
X509CertImpl
.
isSelfIssued
(
currCert
)))
{
if
(
debug
!=
null
)
{
debug
.
println
(
"prevNC = "
+
prevNC
);
debug
.
println
(
"
currDN = "
+
currCert
.
getSubjectX500Principal
());
debug
.
println
(
"prevNC = "
+
prevNC
+
",
currDN = "
+
currCert
.
getSubjectX500Principal
());
}
try
{
...
...
@@ -184,8 +184,8 @@ class ConstraintsChecker extends PKIXCertPathChecker {
currCertImpl
.
getNameConstraintsExtension
();
if
(
debug
!=
null
)
{
debug
.
println
(
"prevNC = "
+
prevNC
);
debug
.
println
(
"
newNC = "
+
String
.
valueOf
(
newConstraints
));
debug
.
println
(
"prevNC = "
+
prevNC
+
",
newNC = "
+
String
.
valueOf
(
newConstraints
));
}
// if there are no previous name constraints, we just return the
...
...
@@ -225,8 +225,8 @@ class ConstraintsChecker extends PKIXCertPathChecker {
String
msg
=
"basic constraints"
;
if
(
debug
!=
null
)
{
debug
.
println
(
"---checking "
+
msg
+
"..."
);
debug
.
println
(
"i = "
+
i
);
debug
.
println
(
"
maxPathLength = "
+
maxPathLength
);
debug
.
println
(
"i = "
+
i
+
",
maxPathLength = "
+
maxPathLength
);
}
/* check if intermediate cert */
...
...
src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2002, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -320,6 +320,14 @@ public class DistributionPointFetcher {
Set
<
TrustAnchor
>
trustAnchors
,
List
<
CertStore
>
certStores
,
Date
validity
)
throws
CRLException
,
IOException
{
if
(
debug
!=
null
)
{
debug
.
println
(
"DistributionPointFetcher.verifyCRL: "
+
"checking revocation status for"
+
"\n SN: "
+
Debug
.
toHexString
(
certImpl
.
getSerialNumber
())
+
"\n Subject: "
+
certImpl
.
getSubjectX500Principal
()
+
"\n Issuer: "
+
certImpl
.
getIssuerX500Principal
());
}
boolean
indirectCRL
=
false
;
X509CRLImpl
crlImpl
=
X509CRLImpl
.
toImpl
(
crl
);
IssuingDistributionPointExtension
idpExt
=
...
...
@@ -363,7 +371,9 @@ public class DistributionPointFetcher {
}
}
else
if
(
crlIssuer
.
equals
(
certIssuer
)
==
false
)
{
if
(
debug
!=
null
)
{
debug
.
println
(
"crl issuer does not equal cert issuer"
);
debug
.
println
(
"crl issuer does not equal cert issuer.\n"
+
"crl issuer: "
+
crlIssuer
+
"\n"
+
"cert issuer: "
+
certIssuer
);
}
return
false
;
}
else
{
...
...
src/share/classes/sun/security/provider/certpath/ForwardBuilder.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2000, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -209,7 +209,8 @@ class ForwardBuilder extends Builder {
* getMatchingEECerts
*/
if
(
debug
!=
null
)
{
debug
.
println
(
"ForwardBuilder.getMatchingCACerts(): ca is target"
);
debug
.
println
(
"ForwardBuilder.getMatchingCACerts(): "
+
"the target is a CA"
);
}
if
(
caTargetSelector
==
null
)
{
...
...
@@ -291,8 +292,14 @@ class ForwardBuilder extends Builder {
for
(
X509Certificate
trustedCert
:
trustedCerts
)
{
if
(
sel
.
match
(
trustedCert
))
{
if
(
debug
!=
null
)
{
debug
.
println
(
"ForwardBuilder.getMatchingCACerts: "
+
"found matching trust anchor"
);
debug
.
println
(
"ForwardBuilder.getMatchingCACerts: "
+
"found matching trust anchor."
+
"\n SN: "
+
Debug
.
toHexString
(
trustedCert
.
getSerialNumber
())
+
"\n Subject: "
+
trustedCert
.
getSubjectX500Principal
()
+
"\n Issuer: "
+
trustedCert
.
getIssuerX500Principal
());
}
if
(
caCerts
.
add
(
trustedCert
)
&&
!
searchAllCertStores
)
{
return
;
...
...
src/share/classes/sun/security/provider/certpath/PKIXMasterCertPathValidator.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2000, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -30,6 +30,7 @@ import sun.security.util.Debug;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.StringJoiner
;
import
java.security.cert.CertPath
;
import
java.security.cert.CertPathValidatorException
;
import
java.security.cert.PKIXCertPathChecker
;
...
...
@@ -88,20 +89,25 @@ class PKIXMasterCertPathValidator {
* current certificate of this loop to be the previous certificate
* of the next loop. The state is initialized during first loop.
*/
if
(
debug
!=
null
)
debug
.
println
(
"Checking cert"
+
(
i
+
1
)
+
" ..."
);
X509Certificate
currCert
=
reversedCertList
.
get
(
i
);
if
(
debug
!=
null
)
{
debug
.
println
(
"Checking cert"
+
(
i
+
1
)
+
" - Subject: "
+
currCert
.
getSubjectX500Principal
());
}
Set
<
String
>
unresCritExts
=
currCert
.
getCriticalExtensionOIDs
();
if
(
unresCritExts
==
null
)
{
unresCritExts
=
Collections
.<
String
>
emptySet
();
}
if
(
debug
!=
null
&&
!
unresCritExts
.
isEmpty
())
{
debug
.
println
(
"Set of critical extensions:
"
);
StringJoiner
joiner
=
new
StringJoiner
(
", "
,
"{"
,
"}
"
);
for
(
String
oid
:
unresCritExts
)
{
debug
.
println
(
oid
);
joiner
.
add
(
oid
);
}
debug
.
println
(
"Set of critical extensions: "
+
joiner
.
toString
());
}
for
(
int
j
=
0
;
j
<
certPathCheckers
.
size
();
j
++)
{
...
...
src/share/classes/sun/security/provider/certpath/RevocationChecker.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2012, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -343,11 +343,17 @@ class RevocationChecker extends PKIXRevocationChecker {
PublicKey
pubKey
,
boolean
crlSignFlag
)
throws
CertPathValidatorException
{
if
(
debug
!=
null
)
{
debug
.
println
(
"RevocationChecker.check: checking cert"
+
"\n SN: "
+
Debug
.
toHexString
(
xcert
.
getSerialNumber
())
+
"\n Subject: "
+
xcert
.
getSubjectX500Principal
()
+
"\n Issuer: "
+
xcert
.
getIssuerX500Principal
());
}
try
{
if
(
onlyEE
&&
xcert
.
getBasicConstraints
()
!=
-
1
)
{
if
(
debug
!=
null
)
{
debug
.
println
(
"Skipping revocation check
, not end
"
+
"entity cert"
);
debug
.
println
(
"Skipping revocation check
; cert is not
"
+
"
an end
entity cert"
);
}
return
;
}
...
...
src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 2000, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -136,7 +136,8 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi {
PKIXCertPathBuilderResult
result
=
buildCertPath
(
false
,
adjList
);
if
(
result
==
null
)
{
if
(
debug
!=
null
)
{
debug
.
println
(
"SunCertPathBuilder.engineBuild: 2nd pass"
);
debug
.
println
(
"SunCertPathBuilder.engineBuild: 2nd pass; "
+
"try building again searching all certstores"
);
}
// try again
adjList
.
clear
();
...
...
src/share/classes/sun/security/ssl/ClientHandshaker.java
浏览文件 @
07e03cf1
/*
* Copyright (c) 1996, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -59,6 +59,10 @@ import static sun.security.ssl.CipherSuite.KeyExchange.*;
*/
final
class
ClientHandshaker
extends
Handshaker
{
// constants for subject alt names of type DNS and IP
private
final
static
int
ALTNAME_DNS
=
2
;
private
final
static
int
ALTNAME_IP
=
7
;
// the server's public key from its certificate.
private
PublicKey
serverKey
;
...
...
@@ -818,6 +822,11 @@ final class ClientHandshaker extends Handshaker {
}
else
{
warningSE
(
Alerts
.
alert_no_certificate
);
}
if
(
debug
!=
null
&&
Debug
.
isOn
(
"handshake"
))
{
System
.
out
.
println
(
"Warning: no suitable certificate found - "
+
"continuing without client authentication"
);
}
}
//
...
...
@@ -1497,20 +1506,49 @@ final class ClientHandshaker extends Handshaker {
return
true
;
}
// check the iPAddress field in subjectAltName extension
Object
thisIPAddress
=
getSubjectAltName
(
thisCert
,
7
);
// 7: iPAddress
Object
prevIPAddress
=
getSubjectAltName
(
prevCert
,
7
);
if
(
thisIPAddress
!=
null
&&
prevIPAddress
!=
null
)
{
// only allow the exactly match
return
Objects
.
equals
(
thisIPAddress
,
prevIPAddress
);
// check subject alternative names
Collection
<
List
<?>>
thisSubjectAltNames
=
null
;
try
{
thisSubjectAltNames
=
thisCert
.
getSubjectAlternativeNames
();
}
catch
(
CertificateParsingException
cpe
)
{
if
(
debug
!=
null
&&
Debug
.
isOn
(
"handshake"
))
{
System
.
out
.
println
(
"Attempt to obtain subjectAltNames extension failed!"
);
}
}
// check the dNSName field in subjectAltName extension
Object
thisDNSName
=
getSubjectAltName
(
thisCert
,
2
);
// 2: dNSName
Object
prevDNSName
=
getSubjectAltName
(
prevCert
,
2
);
if
(
thisDNSName
!=
null
&&
prevDNSName
!=
null
)
{
// only allow the exactly match
return
Objects
.
equals
(
thisDNSName
,
prevDNSName
);
Collection
<
List
<?>>
prevSubjectAltNames
=
null
;
try
{
prevSubjectAltNames
=
prevCert
.
getSubjectAlternativeNames
();
}
catch
(
CertificateParsingException
cpe
)
{
if
(
debug
!=
null
&&
Debug
.
isOn
(
"handshake"
))
{
System
.
out
.
println
(
"Attempt to obtain subjectAltNames extension failed!"
);
}
}
if
((
thisSubjectAltNames
!=
null
)
&&
(
prevSubjectAltNames
!=
null
))
{
// check the iPAddress field in subjectAltName extension
Collection
<
String
>
thisSubAltIPAddrs
=
getSubjectAltNames
(
thisSubjectAltNames
,
ALTNAME_IP
);
Collection
<
String
>
prevSubAltIPAddrs
=
getSubjectAltNames
(
prevSubjectAltNames
,
ALTNAME_IP
);
if
((
thisSubAltIPAddrs
!=
null
)
&&
(
prevSubAltIPAddrs
!=
null
)
&&
(
isEquivalent
(
thisSubAltIPAddrs
,
prevSubAltIPAddrs
)))
{
return
true
;
}
// check the dNSName field in subjectAltName extension
Collection
<
String
>
thisSubAltDnsNames
=
getSubjectAltNames
(
thisSubjectAltNames
,
ALTNAME_DNS
);
Collection
<
String
>
prevSubAltDnsNames
=
getSubjectAltNames
(
prevSubjectAltNames
,
ALTNAME_DNS
);
if
((
thisSubAltDnsNames
!=
null
)
&&
(
prevSubAltDnsNames
!=
null
)
&&
(
isEquivalent
(
thisSubAltDnsNames
,
prevSubAltDnsNames
)))
{
return
true
;
}
}
// check the certificate subject and issuer
...
...
@@ -1531,29 +1569,43 @@ final class ClientHandshaker extends Handshaker {
/*
* Returns the subject alternative name of the specified type in the
* subjectAltNames extension of a certificate.
*
* Note that only those subjectAltName types that use String data
* should be passed into this function.
*/
private
static
Object
getSubjectAltName
(
X509Certificate
cert
,
int
type
)
{
Collection
<
List
<?>>
subjectAltNames
;
try
{
subjectAltNames
=
cert
.
getSubjectAlternativeNames
();
}
catch
(
CertificateParsingException
cpe
)
{
if
(
debug
!=
null
&&
Debug
.
isOn
(
"handshake"
))
{
System
.
out
.
println
(
"Attempt to obtain subjectAltNames extension failed!"
);
private
static
Collection
<
String
>
getSubjectAltNames
(
Collection
<
List
<?>>
subjectAltNames
,
int
type
)
{
HashSet
<
String
>
subAltDnsNames
=
null
;
for
(
List
<?>
subjectAltName
:
subjectAltNames
)
{
int
subjectAltNameType
=
(
Integer
)
subjectAltName
.
get
(
0
);
if
(
subjectAltNameType
==
type
)
{
String
subAltDnsName
=
(
String
)
subjectAltName
.
get
(
1
);
if
((
subAltDnsName
!=
null
)
&&
!
subAltDnsName
.
isEmpty
())
{
if
(
subAltDnsNames
==
null
)
{
subAltDnsNames
=
new
HashSet
<>(
subjectAltNames
.
size
());
}
subAltDnsNames
.
add
(
subAltDnsName
);
}
}
return
null
;
}
if
(
subjectAltNames
!=
null
)
{
for
(
List
<?>
subjectAltName
:
subjectAltNames
)
{
int
subjectAltNameType
=
(
Integer
)
subjectAltName
.
get
(
0
);
if
(
subjectAltNameType
==
type
)
{
return
subjectAltName
.
get
(
1
);
return
subAltDnsNames
;
}
private
static
boolean
isEquivalent
(
Collection
<
String
>
thisSubAltNames
,
Collection
<
String
>
prevSubAltNames
)
{
for
(
String
thisSubAltName
:
thisSubAltNames
)
{
for
(
String
prevSubAltName
:
prevSubAltNames
)
{
// Only allow the exactly match. Check no wildcard character.
if
(
thisSubAltName
.
equalsIgnoreCase
(
prevSubAltName
))
{
return
true
;
}
}
}
return
null
;
return
false
;
}
}
src/share/classes/sun/security/ssl/HandshakeMessage.java
浏览文件 @
07e03cf1
...
...
@@ -492,11 +492,14 @@ class CertificateMsg extends HandshakeMessage
void
print
(
PrintStream
s
)
throws
IOException
{
s
.
println
(
"*** Certificate chain"
);
if
(
debug
!=
null
&&
Debug
.
isOn
(
"verbose"
))
{
for
(
int
i
=
0
;
i
<
chain
.
length
;
i
++)
if
(
chain
.
length
==
0
)
{
s
.
println
(
"<Empty>"
);
}
else
if
(
debug
!=
null
&&
Debug
.
isOn
(
"verbose"
))
{
for
(
int
i
=
0
;
i
<
chain
.
length
;
i
++)
{
s
.
println
(
"chain ["
+
i
+
"] = "
+
chain
[
i
]);
s
.
println
(
"***"
);
}
}
s
.
println
(
"***"
);
}
X509Certificate
[]
getCertificateChain
()
{
...
...
test/com/sun/nio/sctp/SctpMultiChannel/SendFailed.java
浏览文件 @
07e03cf1
...
...
@@ -43,11 +43,16 @@ public class SendFailed {
void
test
(
String
[]
args
)
throws
IOException
{
SocketAddress
address
=
null
;
String
os
=
System
.
getProperty
(
"os.name"
).
toLowerCase
();
if
(!
Util
.
isSCTPSupported
())
{
out
.
println
(
"SCTP protocol is not supported"
);
out
.
println
(
"Test cannot be run"
);
return
;
}
else
if
(
os
.
startsWith
(
"sunos"
))
{
out
.
println
(
"Test not supported on Solaris"
);
out
.
println
(
"Test cannot be run"
);
return
;
}
System
.
out
.
println
(
"remote address: "
+
remoteAddress
);
...
...
test/javax/imageio/stream/ShortStreamTest.java
0 → 100644
浏览文件 @
07e03cf1
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8074954
* @summary Test verifies that an IOException is triggered if input stream
* does not contain enough data to read a multi-byte type.
*
* @run main ShortStreamTest
*/
import
javax.imageio.ImageIO
;
import
javax.imageio.stream.ImageInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
public
class
ShortStreamTest
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
TestCase
[]
tests
=
createTests
();
for
(
TestCase
t
:
tests
)
{
t
.
test
();
}
}
private
static
abstract
class
TestCase
{
abstract
void
testRead
(
ImageInputStream
iis
)
throws
IOException
;
public
void
test
()
{
boolean
gotException
=
false
;
ImageInputStream
iis
=
createShortStream
();
try
{
testRead
(
iis
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
System
.
out
);
gotException
=
true
;
}
if
(!
gotException
)
{
throw
new
RuntimeException
(
"Test failed."
);
}
System
.
out
.
println
(
"Test PASSED"
);
}
}
private
static
ImageInputStream
createShortStream
()
{
try
{
byte
[]
integerTestArray
=
new
byte
[]
{
80
};
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
integerTestArray
);
return
ImageIO
.
createImageInputStream
(
bais
);
}
catch
(
IOException
e
)
{
return
null
;
}
}
private
static
TestCase
[]
createTests
()
{
return
new
TestCase
[]{
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readInt
();
}
},
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readShort
();
}
},
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readDouble
();
}
},
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readFloat
();
}
},
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readLong
();
}
},
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readUnsignedInt
();
}
},
new
TestCase
()
{
@Override
void
testRead
(
ImageInputStream
iis
)
throws
IOException
{
iis
.
readUnsignedShort
();
}
}
};
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录