Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
dd8c83f2
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dd8c83f2
编写于
10月 20, 2016
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8158997: JNDI Protocols Switch
Reviewed-by: vinnie
上级
621570f4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
98 addition
and
6 deletion
+98
-6
src/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java
.../classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java
+5
-0
src/share/classes/com/sun/jndi/cosnaming/CNCtx.java
src/share/classes/com/sun/jndi/cosnaming/CNCtx.java
+23
-3
src/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java
...share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java
+6
-1
src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
...re/classes/com/sun/jndi/rmi/registry/RegistryContext.java
+35
-0
src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
+29
-2
未找到文件。
src/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java
浏览文件 @
dd8c83f2
...
@@ -33,6 +33,8 @@ import java.util.Hashtable;
...
@@ -33,6 +33,8 @@ import java.util.Hashtable;
import
org.omg.CosNaming.*
;
import
org.omg.CosNaming.*
;
import
com.sun.jndi.toolkit.corba.CorbaUtils
;
/**
/**
* Implements the JNDI NamingEnumeration interface for COS
* Implements the JNDI NamingEnumeration interface for COS
* Naming. Gets hold of a list of bindings from the COS Naming Server
* Naming. Gets hold of a list of bindings from the COS Naming Server
...
@@ -212,7 +214,10 @@ final class CNBindingEnumeration
...
@@ -212,7 +214,10 @@ final class CNBindingEnumeration
Name
cname
=
CNNameParser
.
cosNameToName
(
bndg
.
binding_name
);
Name
cname
=
CNNameParser
.
cosNameToName
(
bndg
.
binding_name
);
try
{
try
{
// Check whether object factory codebase is trusted
if
(
CorbaUtils
.
isObjectFactoryTrusted
(
obj
))
{
obj
=
NamingManager
.
getObjectInstance
(
obj
,
cname
,
_ctx
,
_env
);
obj
=
NamingManager
.
getObjectInstance
(
obj
,
cname
,
_ctx
,
_env
);
}
}
catch
(
NamingException
e
)
{
}
catch
(
NamingException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/share/classes/com/sun/jndi/cosnaming/CNCtx.java
浏览文件 @
dd8c83f2
...
@@ -36,6 +36,8 @@ import java.io.InputStream;
...
@@ -36,6 +36,8 @@ import java.io.InputStream;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
org.omg.CosNaming.*
;
import
org.omg.CosNaming.*
;
import
org.omg.CosNaming.NamingContextPackage.*
;
import
org.omg.CosNaming.NamingContextPackage.*
;
...
@@ -82,6 +84,19 @@ public class CNCtx implements javax.naming.Context {
...
@@ -82,6 +84,19 @@ public class CNCtx implements javax.naming.Context {
private
static
final
String
FED_PROP
=
"com.sun.jndi.cosnaming.federation"
;
private
static
final
String
FED_PROP
=
"com.sun.jndi.cosnaming.federation"
;
boolean
federation
=
false
;
boolean
federation
=
false
;
/**
* Determines whether classes may be loaded from an arbitrary URL code base.
*/
public
static
final
boolean
trustURLCodebase
;
static
{
// System property to control whether classes may be loaded from an
// arbitrary URL code base
PrivilegedAction
<
String
>
act
=
()
->
System
.
getProperty
(
"com.sun.jndi.cosnaming.object.trustURLCodebase"
,
"false"
);
String
trust
=
AccessController
.
doPrivileged
(
act
);
trustURLCodebase
=
"true"
.
equalsIgnoreCase
(
trust
);
}
// Reference counter for tracking _orb references
// Reference counter for tracking _orb references
OrbReuseTracker
orbTracker
=
null
;
OrbReuseTracker
orbTracker
=
null
;
int
enumCount
;
int
enumCount
;
...
@@ -534,12 +549,16 @@ public class CNCtx implements javax.naming.Context {
...
@@ -534,12 +549,16 @@ public class CNCtx implements javax.naming.Context {
if
(
name
.
size
()
==
0
)
if
(
name
.
size
()
==
0
)
return
this
;
// %%% should clone() so that env can be changed
return
this
;
// %%% should clone() so that env can be changed
NameComponent
[]
path
=
CNNameParser
.
nameToCosName
(
name
);
NameComponent
[]
path
=
CNNameParser
.
nameToCosName
(
name
);
java
.
lang
.
Object
answer
=
null
;
try
{
try
{
java
.
lang
.
Object
answer
=
callResolve
(
path
);
answer
=
callResolve
(
path
);
try
{
try
{
return
NamingManager
.
getObjectInstance
(
answer
,
name
,
this
,
_env
);
// Check whether object factory codebase is trusted
if
(
CorbaUtils
.
isObjectFactoryTrusted
(
answer
))
{
answer
=
NamingManager
.
getObjectInstance
(
answer
,
name
,
this
,
_env
);
}
}
catch
(
NamingException
e
)
{
}
catch
(
NamingException
e
)
{
throw
e
;
throw
e
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -552,6 +571,7 @@ public class CNCtx implements javax.naming.Context {
...
@@ -552,6 +571,7 @@ public class CNCtx implements javax.naming.Context {
javax
.
naming
.
Context
cctx
=
getContinuationContext
(
cpe
);
javax
.
naming
.
Context
cctx
=
getContinuationContext
(
cpe
);
return
cctx
.
lookup
(
cpe
.
getRemainingName
());
return
cctx
.
lookup
(
cpe
.
getRemainingName
());
}
}
return
answer
;
}
}
/**
/**
...
...
src/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java
浏览文件 @
dd8c83f2
...
@@ -33,6 +33,8 @@ import org.omg.CosNaming.*;
...
@@ -33,6 +33,8 @@ import org.omg.CosNaming.*;
import
org.omg.CosNaming.NamingContextPackage.*
;
import
org.omg.CosNaming.NamingContextPackage.*
;
import
org.omg.CORBA.*
;
import
org.omg.CORBA.*
;
import
com.sun.jndi.toolkit.corba.CorbaUtils
;
/**
/**
* A convenience class to map the COS Naming exceptions to the JNDI exceptions.
* A convenience class to map the COS Naming exceptions to the JNDI exceptions.
* @author Raj Krishnamurthy
* @author Raj Krishnamurthy
...
@@ -202,10 +204,13 @@ public final class ExceptionMapper {
...
@@ -202,10 +204,13 @@ public final class ExceptionMapper {
// Not a context, use object factory to transform object.
// Not a context, use object factory to transform object.
Name
cname
=
CNNameParser
.
cosNameToName
(
resolvedName
);
Name
cname
=
CNNameParser
.
cosNameToName
(
resolvedName
);
java
.
lang
.
Object
resolvedObj2
;
java
.
lang
.
Object
resolvedObj2
=
null
;
try
{
try
{
// Check whether object factory codebase is trusted
if
(
CorbaUtils
.
isObjectFactoryTrusted
(
resolvedObj
))
{
resolvedObj2
=
NamingManager
.
getObjectInstance
(
resolvedObj
,
resolvedObj2
=
NamingManager
.
getObjectInstance
(
resolvedObj
,
cname
,
ctx
,
ctx
.
_env
);
cname
,
ctx
,
ctx
.
_env
);
}
}
catch
(
NamingException
ge
)
{
}
catch
(
NamingException
ge
)
{
throw
ge
;
throw
ge
;
}
catch
(
Exception
ge
)
{
}
catch
(
Exception
ge
)
{
...
...
src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
浏览文件 @
dd8c83f2
...
@@ -32,6 +32,8 @@ import java.rmi.*;
...
@@ -32,6 +32,8 @@ import java.rmi.*;
import
java.rmi.server.*
;
import
java.rmi.server.*
;
import
java.rmi.registry.Registry
;
import
java.rmi.registry.Registry
;
import
java.rmi.registry.LocateRegistry
;
import
java.rmi.registry.LocateRegistry
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
javax.naming.*
;
import
javax.naming.*
;
import
javax.naming.spi.NamingManager
;
import
javax.naming.spi.NamingManager
;
...
@@ -52,6 +54,18 @@ public class RegistryContext implements Context, Referenceable {
...
@@ -52,6 +54,18 @@ public class RegistryContext implements Context, Referenceable {
private
int
port
;
private
int
port
;
private
static
final
NameParser
nameParser
=
new
AtomicNameParser
();
private
static
final
NameParser
nameParser
=
new
AtomicNameParser
();
private
static
final
String
SOCKET_FACTORY
=
"com.sun.jndi.rmi.factory.socket"
;
private
static
final
String
SOCKET_FACTORY
=
"com.sun.jndi.rmi.factory.socket"
;
/**
* Determines whether classes may be loaded from an arbitrary URL code base.
*/
static
final
boolean
trustURLCodebase
;
static
{
// System property to control whether classes may be loaded from an
// arbitrary URL codebase
PrivilegedAction
<
String
>
act
=
()
->
System
.
getProperty
(
"com.sun.jndi.rmi.object.trustURLCodebase"
,
"false"
);
String
trust
=
AccessController
.
doPrivileged
(
act
);
trustURLCodebase
=
"true"
.
equalsIgnoreCase
(
trust
);
}
Reference
reference
=
null
;
// ref used to create this context, if any
Reference
reference
=
null
;
// ref used to create this context, if any
...
@@ -461,6 +475,27 @@ public class RegistryContext implements Context, Referenceable {
...
@@ -461,6 +475,27 @@ public class RegistryContext implements Context, Referenceable {
Object
obj
=
(
r
instanceof
RemoteReference
)
Object
obj
=
(
r
instanceof
RemoteReference
)
?
((
RemoteReference
)
r
).
getReference
()
?
((
RemoteReference
)
r
).
getReference
()
:
(
Object
)
r
;
:
(
Object
)
r
;
/*
* Classes may only be loaded from an arbitrary URL codebase when
* the system property com.sun.jndi.rmi.object.trustURLCodebase
* has been set to "true".
*/
// Use reference if possible
Reference
ref
=
null
;
if
(
obj
instanceof
Reference
)
{
ref
=
(
Reference
)
obj
;
}
else
if
(
obj
instanceof
Referenceable
)
{
ref
=
((
Referenceable
)(
obj
)).
getReference
();
}
if
(
ref
!=
null
&&
ref
.
getFactoryClassLocation
()
!=
null
&&
!
trustURLCodebase
)
{
throw
new
ConfigurationException
(
"The object factory is untrusted. Set the system property"
+
" 'com.sun.jndi.rmi.object.trustURLCodebase' to 'true'."
);
}
return
NamingManager
.
getObjectInstance
(
obj
,
name
,
this
,
return
NamingManager
.
getObjectInstance
(
obj
,
name
,
this
,
environment
);
environment
);
}
catch
(
NamingException
e
)
{
}
catch
(
NamingException
e
)
{
...
...
src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
浏览文件 @
dd8c83f2
...
@@ -36,8 +36,9 @@ import java.util.Enumeration;
...
@@ -36,8 +36,9 @@ import java.util.Enumeration;
import
org.omg.CORBA.ORB
;
import
org.omg.CORBA.ORB
;
import
javax.naming.Context
;
import
javax.naming.*
;
import
javax.naming.ConfigurationException
;
import
com.sun.jndi.cosnaming.CNCtx
;
/**
/**
* Contains utilities for performing CORBA-related tasks:
* Contains utilities for performing CORBA-related tasks:
...
@@ -203,6 +204,32 @@ public class CorbaUtils {
...
@@ -203,6 +204,32 @@ public class CorbaUtils {
return
ORB
.
init
(
new
String
[
0
],
orbProp
);
return
ORB
.
init
(
new
String
[
0
],
orbProp
);
}
}
/**
* Check whether object factory code base is trusted.
* Classes may only be loaded from an arbitrary URL code base when
* the system property com.sun.jndi.rmi.object.trustURLCodebase
* has been set to "true".
*/
public
static
boolean
isObjectFactoryTrusted
(
Object
obj
)
throws
NamingException
{
// Extract Reference, if possible
Reference
ref
=
null
;
if
(
obj
instanceof
Reference
)
{
ref
=
(
Reference
)
obj
;
}
else
if
(
obj
instanceof
Referenceable
)
{
ref
=
((
Referenceable
)(
obj
)).
getReference
();
}
if
(
ref
!=
null
&&
ref
.
getFactoryClassLocation
()
!=
null
&&
!
CNCtx
.
trustURLCodebase
)
{
throw
new
ConfigurationException
(
"The object factory is untrusted. Set the system property"
+
" 'com.sun.jndi.cosnaming.object.trustURLCodebase' to 'true'."
);
}
return
true
;
}
/**
/**
* This method returns a new ORB instance for the given applet
* This method returns a new ORB instance for the given applet
* without creating a static dependency on java.applet.
* without creating a static dependency on java.applet.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录