Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
83067a0f
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看板
提交
83067a0f
编写于
1月 21, 2014
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
8fdf3621
e987f0da
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
113 addition
and
32 deletion
+113
-32
src/share/classes/com/sun/jndi/dns/DnsClient.java
src/share/classes/com/sun/jndi/dns/DnsClient.java
+67
-29
src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
...are/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
+16
-1
src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
...hare/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
+16
-2
src/share/native/sun/awt/libpng/pngrtran.c
src/share/native/sun/awt/libpng/pngrtran.c
+3
-0
src/share/native/sun/awt/libpng/pngset.c
src/share/native/sun/awt/libpng/pngset.c
+11
-0
未找到文件。
src/share/classes/com/sun/jndi/dns/DnsClient.java
浏览文件 @
83067a0f
/*
* Copyright (c) 2000, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
...
...
@@ -30,13 +30,14 @@ import java.net.DatagramSocket;
import
java.net.DatagramPacket
;
import
java.net.InetAddress
;
import
java.net.Socket
;
import
java.security.SecureRandom
;
import
javax.naming.*
;
import
java.util.Collections
;
import
java.util.Map
;
import
java.util.HashMap
;
import
java.util.Set
;
import
java.util.HashSet
;
import
sun.security.jca.JCAUtil
;
// Some of this code began life as part of sun.javaos.net.DnsClient
// originally by sritchie@eng 1/96. It was first hacked up for JNDI
...
...
@@ -77,6 +78,8 @@ public class DnsClient {
};
private
static
final
int
DEFAULT_PORT
=
53
;
private
static
final
int
TRANSACTION_ID_BOUND
=
0x10000
;
private
static
final
SecureRandom
random
=
JCAUtil
.
getSecureRandom
();
private
InetAddress
[]
servers
;
private
int
[]
serverPorts
;
private
int
timeout
;
// initial timeout on UDP queries in ms
...
...
@@ -85,7 +88,7 @@ public class DnsClient {
private
DatagramSocket
udpSocket
;
// Requests sent
private
Set
<
Integer
>
reqs
;
private
Map
<
Integer
,
ResourceRecord
>
reqs
;
// Responses received
private
Map
<
Integer
,
byte
[]>
resps
;
...
...
@@ -134,7 +137,8 @@ public class DnsClient {
throw
ne
;
}
}
reqs
=
Collections
.
synchronizedSet
(
new
HashSet
<
Integer
>());
reqs
=
Collections
.
synchronizedMap
(
new
HashMap
<
Integer
,
ResourceRecord
>());
resps
=
Collections
.
synchronizedMap
(
new
HashMap
<
Integer
,
byte
[]>());
}
...
...
@@ -153,10 +157,6 @@ public class DnsClient {
}
}
private
int
ident
=
0
;
// used to set the msg ID field
private
Object
identLock
=
new
Object
();
/*
* If recursion is true, recursion is requested on the query.
* If auth is true, only authoritative responses are accepted; other
...
...
@@ -167,15 +167,19 @@ public class DnsClient {
throws
NamingException
{
int
xid
;
synchronized
(
identLock
)
{
ident
=
0xFFFF
&
(
ident
+
1
);
xid
=
ident
;
}
Packet
pkt
;
ResourceRecord
collision
;
// enqueue the outstanding request
reqs
.
add
(
xid
);
do
{
// Generate a random transaction ID
xid
=
random
.
nextInt
(
TRANSACTION_ID_BOUND
);
pkt
=
makeQueryPacket
(
fqdn
,
xid
,
qclass
,
qtype
,
recursion
);
Packet
pkt
=
makeQueryPacket
(
fqdn
,
xid
,
qclass
,
qtype
,
recursion
);
// enqueue the outstanding request
collision
=
reqs
.
putIfAbsent
(
xid
,
new
ResourceRecord
(
pkt
.
getData
(),
pkt
.
length
(),
Header
.
HEADER_SIZE
,
true
,
false
));
}
while
(
collision
!=
null
);
Exception
caughtException
=
null
;
boolean
[]
doNotRetry
=
new
boolean
[
servers
.
length
];
...
...
@@ -305,11 +309,8 @@ public class DnsClient {
ResourceRecords
queryZone
(
DnsName
zone
,
int
qclass
,
boolean
recursion
)
throws
NamingException
{
int
xid
;
synchronized
(
identLock
)
{
ident
=
0xFFFF
&
(
ident
+
1
);
xid
=
ident
;
}
int
xid
=
random
.
nextInt
(
TRANSACTION_ID_BOUND
);
Packet
pkt
=
makeQueryPacket
(
zone
,
xid
,
qclass
,
ResourceRecord
.
QTYPE_AXFR
,
recursion
);
Exception
caughtException
=
null
;
...
...
@@ -390,6 +391,7 @@ public class DnsClient {
DatagramPacket
opkt
=
new
DatagramPacket
(
pkt
.
getData
(),
pkt
.
length
(),
server
,
port
);
DatagramPacket
ipkt
=
new
DatagramPacket
(
new
byte
[
8000
],
8000
);
// Packets may only be sent to or received from this server address
udpSocket
.
connect
(
server
,
port
);
int
pktTimeout
=
(
timeout
*
(
1
<<
retry
));
try
{
...
...
@@ -543,6 +545,9 @@ public class DnsClient {
* Checks the header of an incoming DNS response.
* Returns true if it matches the given xid and throws a naming
* exception, if appropriate, based on the response code.
*
* Also checks that the domain name, type and class in the response
* match those in the original query.
*/
private
boolean
isMatchResponse
(
byte
[]
pkt
,
int
xid
)
throws
NamingException
{
...
...
@@ -552,7 +557,7 @@ public class DnsClient {
throw
new
CommunicationException
(
"DNS error: expecting response"
);
}
if
(!
reqs
.
contains
(
xid
))
{
// already received, ignore the response
if
(!
reqs
.
contains
Key
(
xid
))
{
// already received, ignore the response
return
false
;
}
...
...
@@ -561,14 +566,47 @@ public class DnsClient {
if
(
debug
)
{
dprint
(
"XID MATCH:"
+
xid
);
}
checkResponseCode
(
hdr
);
// remove the response for the xid if received by some other thread.
synchronized
(
queuesLock
)
{
resps
.
remove
(
xid
);
reqs
.
remove
(
xid
);
if
(!
hdr
.
query
&&
hdr
.
numQuestions
==
1
)
{
ResourceRecord
rr
=
new
ResourceRecord
(
pkt
,
pkt
.
length
,
Header
.
HEADER_SIZE
,
true
,
false
);
// Retrieve the original query
ResourceRecord
query
=
reqs
.
get
(
xid
);
int
qtype
=
query
.
getType
();
int
qclass
=
query
.
getRrclass
();
DnsName
qname
=
query
.
getName
();
// Check that the type/class/name in the query section of the
// response match those in the original query
if
((
qtype
==
ResourceRecord
.
QTYPE_STAR
||
qtype
==
rr
.
getType
())
&&
(
qclass
==
ResourceRecord
.
QCLASS_STAR
||
qclass
==
rr
.
getRrclass
())
&&
qname
.
equals
(
rr
.
getName
()))
{
if
(
debug
)
{
dprint
(
"MATCH NAME:"
+
qname
+
" QTYPE:"
+
qtype
+
" QCLASS:"
+
qclass
);
}
// Remove the response for the xid if received by some other
// thread.
synchronized
(
queuesLock
)
{
resps
.
remove
(
xid
);
reqs
.
remove
(
xid
);
}
return
true
;
}
else
{
if
(
debug
)
{
dprint
(
"NO-MATCH NAME:"
+
qname
+
" QTYPE:"
+
qtype
+
" QCLASS:"
+
qclass
);
}
}
}
return
tru
e
;
return
fals
e
;
}
//
...
...
@@ -577,7 +615,7 @@ public class DnsClient {
// enqueue only the first response, responses for retries are ignored.
//
synchronized
(
queuesLock
)
{
if
(
reqs
.
contains
(
hdr
.
xid
))
{
// enqueue only the first response
if
(
reqs
.
contains
Key
(
hdr
.
xid
))
{
// enqueue only the first response
resps
.
put
(
hdr
.
xid
,
pkt
);
}
}
...
...
src/share/classes/com/sun/jndi/ldap/LdapBindingEnumeration.java
浏览文件 @
83067a0f
...
...
@@ -25,6 +25,10 @@
package
com.sun.jndi.ldap
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Vector
;
import
javax.naming.*
;
import
javax.naming.directory.*
;
...
...
@@ -36,6 +40,8 @@ import com.sun.jndi.toolkit.ctx.Continuation;
final
class
LdapBindingEnumeration
extends
AbstractLdapNamingEnumeration
<
Binding
>
{
private
final
AccessControlContext
acc
=
AccessController
.
getContext
();
LdapBindingEnumeration
(
LdapCtx
homeCtx
,
LdapResult
answer
,
Name
remain
,
Continuation
cont
)
throws
NamingException
{
...
...
@@ -52,7 +58,16 @@ final class LdapBindingEnumeration
if
(
attrs
.
get
(
Obj
.
JAVA_ATTRIBUTES
[
Obj
.
CLASSNAME
])
!=
null
)
{
// serialized object or object reference
obj
=
Obj
.
decodeObject
(
attrs
);
try
{
obj
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Object
>()
{
@Override
public
Object
run
()
throws
NamingException
{
return
Obj
.
decodeObject
(
attrs
);
}
},
acc
);
}
catch
(
PrivilegedActionException
e
)
{
throw
(
NamingException
)
e
.
getException
();
}
}
if
(
obj
==
null
)
{
// DirContext object
...
...
src/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java
浏览文件 @
83067a0f
...
...
@@ -25,6 +25,10 @@
package
com.sun.jndi.ldap
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Vector
;
import
javax.naming.*
;
import
javax.naming.directory.*
;
...
...
@@ -40,6 +44,8 @@ final class LdapSearchEnumeration
private
Name
startName
;
// prefix of names of search results
private
LdapCtx
.
SearchArgs
searchArgs
=
null
;
private
final
AccessControlContext
acc
=
AccessController
.
getContext
();
LdapSearchEnumeration
(
LdapCtx
homeCtx
,
LdapResult
search_results
,
String
starter
,
LdapCtx
.
SearchArgs
args
,
Continuation
cont
)
throws
NamingException
{
...
...
@@ -112,8 +118,16 @@ final class LdapSearchEnumeration
if
(
attrs
.
get
(
Obj
.
JAVA_ATTRIBUTES
[
Obj
.
CLASSNAME
])
!=
null
)
{
// Entry contains Java-object attributes (ser/ref object)
// serialized object or object reference
obj
=
Obj
.
decodeObject
(
attrs
);
try
{
obj
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Object
>()
{
@Override
public
Object
run
()
throws
NamingException
{
return
Obj
.
decodeObject
(
attrs
);
}
},
acc
);
}
catch
(
PrivilegedActionException
e
)
{
throw
(
NamingException
)
e
.
getException
();
}
}
if
(
obj
==
null
)
{
obj
=
new
LdapCtx
(
homeCtx
,
dn
);
...
...
src/share/native/sun/awt/libpng/pngrtran.c
浏览文件 @
83067a0f
...
...
@@ -1862,6 +1862,9 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
info_ptr
->
bit_depth
=
8
;
info_ptr
->
num_trans
=
0
;
if
(
png_ptr
->
palette
==
NULL
)
png_error
(
png_ptr
,
"Palette is NULL in indexed image"
);
}
else
{
...
...
src/share/native/sun/awt/libpng/pngset.c
浏览文件 @
83067a0f
...
...
@@ -512,6 +512,17 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
}
}
if
((
num_palette
>
0
&&
palette
==
NULL
)
||
(
num_palette
==
0
# ifdef PNG_MNG_FEATURES_SUPPORTED
&&
(
png_ptr
->
mng_features_permitted
&
PNG_FLAG_MNG_EMPTY_PLTE
)
==
0
# endif
))
{
png_error
(
png_ptr
,
"Invalid palette"
);
return
;
}
/* It may not actually be necessary to set png_ptr->palette here;
* we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录