Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
db6f8b1d
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
db6f8b1d
编写于
5月 12, 2009
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6801071: Remote sites can compromise user privacy and possibly hijack web sessions
Reviewed-by: jccollet, hawtin
上级
56726716
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
78 addition
and
13 deletion
+78
-13
jdk/make/sun/net/FILES_java.gmk
jdk/make/sun/net/FILES_java.gmk
+1
-0
jdk/src/share/classes/java/net/Socket.java
jdk/src/share/classes/java/net/Socket.java
+1
-1
jdk/src/share/classes/java/net/SocksSocketImpl.java
jdk/src/share/classes/java/net/SocksSocketImpl.java
+19
-6
jdk/src/share/classes/java/net/URL.java
jdk/src/share/classes/java/net/URL.java
+1
-1
jdk/src/share/classes/sun/net/ApplicationProxy.java
jdk/src/share/classes/sun/net/ApplicationProxy.java
+43
-0
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
.../classes/sun/net/www/protocol/http/HttpURLConnection.java
+13
-5
未找到文件。
jdk/make/sun/net/FILES_java.gmk
浏览文件 @
db6f8b1d
...
...
@@ -24,6 +24,7 @@
#
FILES_java = \
sun/net/ApplicationProxy.java \
sun/net/InetAddressCachePolicy.java \
sun/net/URLCanonicalizer.java \
sun/net/NetworkClient.java \
...
...
jdk/src/share/classes/java/net/Socket.java
浏览文件 @
db6f8b1d
...
...
@@ -118,7 +118,7 @@ class Socket implements java.io.Closeable {
if
(
proxy
==
null
)
{
throw
new
IllegalArgumentException
(
"Invalid Proxy"
);
}
Proxy
p
=
proxy
==
Proxy
.
NO_PROXY
?
Proxy
.
NO_PROXY
:
new
Proxy
(
proxy
.
type
(),
proxy
.
address
()
);
Proxy
p
=
proxy
==
Proxy
.
NO_PROXY
?
Proxy
.
NO_PROXY
:
sun
.
net
.
ApplicationProxy
.
create
(
proxy
);
if
(
p
.
type
()
==
Proxy
.
Type
.
SOCKS
)
{
SecurityManager
security
=
System
.
getSecurityManager
();
InetSocketAddress
epoint
=
(
InetSocketAddress
)
p
.
address
();
...
...
jdk/src/share/classes/java/net/SocksSocketImpl.java
浏览文件 @
db6f8b1d
...
...
@@ -47,6 +47,9 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
private
Socket
cmdsock
=
null
;
private
InputStream
cmdIn
=
null
;
private
OutputStream
cmdOut
=
null
;
/* true if the Proxy has been set programatically */
private
boolean
applicationSetProxy
;
/* false */
SocksSocketImpl
()
{
// Nothing needed
...
...
@@ -64,6 +67,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
// Use getHostString() to avoid reverse lookups
server
=
ad
.
getHostString
();
port
=
ad
.
getPort
();
applicationSetProxy
=
true
;
}
}
...
...
@@ -165,8 +169,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
throw
(
IOException
)
pae
.
getException
();
}
}
else
{
userName
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"user.name"
));
userName
=
getUserName
();
}
}
if
(
userName
==
null
)
...
...
@@ -267,8 +270,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out
.
write
((
endpoint
.
getPort
()
>>
8
)
&
0xff
);
out
.
write
((
endpoint
.
getPort
()
>>
0
)
&
0xff
);
out
.
write
(
endpoint
.
getAddress
().
getAddress
());
String
userName
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"user.name"
));
String
userName
=
getUserName
();
try
{
out
.
write
(
userName
.
getBytes
(
"ISO-8859-1"
));
}
catch
(
java
.
io
.
UnsupportedEncodingException
uee
)
{
...
...
@@ -588,8 +590,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
out
.
write
((
super
.
getLocalPort
()
>>
8
)
&
0xff
);
out
.
write
((
super
.
getLocalPort
()
>>
0
)
&
0xff
);
out
.
write
(
addr1
);
String
userName
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"user.name"
));
String
userName
=
getUserName
();
try
{
out
.
write
(
userName
.
getBytes
(
"ISO-8859-1"
));
}
catch
(
java
.
io
.
UnsupportedEncodingException
uee
)
{
...
...
@@ -1052,4 +1053,16 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
super
.
close
();
}
private
String
getUserName
()
{
String
userName
=
""
;
if
(
applicationSetProxy
)
{
try
{
userName
=
System
.
getProperty
(
"user.name"
);
}
catch
(
SecurityException
se
)
{
/* swallow Exception */
}
}
else
{
userName
=
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
"user.name"
));
}
return
userName
;
}
}
jdk/src/share/classes/java/net/URL.java
浏览文件 @
db6f8b1d
...
...
@@ -1005,7 +1005,7 @@ public final class URL implements java.io.Serializable {
}
// Create a copy of Proxy as a security measure
Proxy
p
=
proxy
==
Proxy
.
NO_PROXY
?
Proxy
.
NO_PROXY
:
new
Proxy
(
proxy
.
type
(),
proxy
.
address
()
);
Proxy
p
=
proxy
==
Proxy
.
NO_PROXY
?
Proxy
.
NO_PROXY
:
sun
.
net
.
ApplicationProxy
.
create
(
proxy
);
SecurityManager
sm
=
System
.
getSecurityManager
();
if
(
p
.
type
()
!=
Proxy
.
Type
.
DIRECT
&&
sm
!=
null
)
{
InetSocketAddress
epoint
=
(
InetSocketAddress
)
p
.
address
();
...
...
jdk/src/share/classes/sun/net/ApplicationProxy.java
0 → 100644
浏览文件 @
db6f8b1d
/*
* Copyright 2009 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.net
;
import
java.net.Proxy
;
import
java.net.SocketAddress
;
/**
* Proxy wrapper class so that we can determine application set
* proxies by type.
*/
public
final
class
ApplicationProxy
extends
Proxy
{
private
ApplicationProxy
(
Proxy
proxy
)
{
super
(
proxy
.
type
(),
proxy
.
address
());
}
public
static
ApplicationProxy
create
(
Proxy
proxy
)
{
return
new
ApplicationProxy
(
proxy
);
}
}
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
浏览文件 @
db6f8b1d
...
...
@@ -575,12 +575,20 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
responses
=
new
MessageHeader
();
this
.
handler
=
handler
;
instProxy
=
p
;
cookieHandler
=
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
CookieHandler
>()
{
if
(
instProxy
instanceof
sun
.
net
.
ApplicationProxy
)
{
/* Application set Proxies should not have access to cookies
* in a secure environment unless explicitly allowed. */
try
{
cookieHandler
=
CookieHandler
.
getDefault
();
}
catch
(
SecurityException
se
)
{
/* swallow exception */
}
}
else
{
cookieHandler
=
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
CookieHandler
>()
{
public
CookieHandler
run
()
{
return
CookieHandler
.
getDefault
();
}
});
return
CookieHandler
.
getDefault
();
}
});
}
cacheHandler
=
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
ResponseCache
>()
{
public
ResponseCache
run
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录