Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
94082ec6
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看板
提交
94082ec6
编写于
1月 19, 2013
作者:
M
msheppar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8006568: HTTP protocol handler NLTM Authentication should use Base64 API
Reviewed-by: chegar, alanb
上级
cea188a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
22 deletion
+10
-22
src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
...es/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
+4
-9
src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
...sses/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
+3
-9
test/sun/net/www/protocol/http/ProxyTunnelServer.java
test/sun/net/www/protocol/http/ProxyTunnelServer.java
+3
-4
未找到文件。
src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
浏览文件 @
94082ec6
...
@@ -33,6 +33,7 @@ import java.net.PasswordAuthentication;
...
@@ -33,6 +33,7 @@ import java.net.PasswordAuthentication;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.security.GeneralSecurityException
;
import
java.security.GeneralSecurityException
;
import
java.util.Base64
;
import
sun.net.www.HeaderParser
;
import
sun.net.www.HeaderParser
;
import
sun.net.www.protocol.http.AuthenticationInfo
;
import
sun.net.www.protocol.http.AuthenticationInfo
;
...
@@ -230,7 +231,7 @@ public class NTLMAuthentication extends AuthenticationInfo {
...
@@ -230,7 +231,7 @@ public class NTLMAuthentication extends AuthenticationInfo {
private
String
buildType1Msg
()
{
private
String
buildType1Msg
()
{
byte
[]
msg
=
client
.
type1
();
byte
[]
msg
=
client
.
type1
();
String
result
=
"NTLM "
+
(
new
B64Encoder
()).
encode
(
msg
);
String
result
=
"NTLM "
+
Base64
.
getEncoder
().
encodeToString
(
msg
);
return
result
;
return
result
;
}
}
...
@@ -239,18 +240,12 @@ public class NTLMAuthentication extends AuthenticationInfo {
...
@@ -239,18 +240,12 @@ public class NTLMAuthentication extends AuthenticationInfo {
/* First decode the type2 message to get the server nonce */
/* First decode the type2 message to get the server nonce */
/* nonce is located at type2[24] for 8 bytes */
/* nonce is located at type2[24] for 8 bytes */
byte
[]
type2
=
(
new
sun
.
misc
.
BASE64Decoder
()).
decodeBuffer
(
challenge
);
byte
[]
type2
=
Base64
.
getDecoder
().
decode
(
challenge
);
byte
[]
nonce
=
new
byte
[
8
];
byte
[]
nonce
=
new
byte
[
8
];
new
java
.
util
.
Random
().
nextBytes
(
nonce
);
new
java
.
util
.
Random
().
nextBytes
(
nonce
);
byte
[]
msg
=
client
.
type3
(
type2
,
nonce
);
byte
[]
msg
=
client
.
type3
(
type2
,
nonce
);
String
result
=
"NTLM "
+
(
new
B64Encoder
()).
encode
(
msg
);
String
result
=
"NTLM "
+
Base64
.
getEncoder
().
encodeToString
(
msg
);
return
result
;
return
result
;
}
}
}
}
class
B64Encoder
extends
sun
.
misc
.
BASE64Encoder
{
/* to force it to to the entire encoding in one line */
protected
int
bytesPerLine
()
{
return
1024
;
}
}
src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
浏览文件 @
94082ec6
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
package
sun.net.www.protocol.http.ntlm
;
package
sun.net.www.protocol.http.ntlm
;
import
java.io.IOException
;
import
java.io.IOException
;
import
sun.misc.BASE64Encoder
;
import
java.util.Base64
;
import
sun.misc.BASE64Decoder
;
/*
/*
* Hooks into Windows implementation of NTLM.
* Hooks into Windows implementation of NTLM.
...
@@ -77,11 +76,11 @@ public class NTLMAuthSequence {
...
@@ -77,11 +76,11 @@ public class NTLMAuthSequence {
assert
!
status
.
sequenceComplete
;
assert
!
status
.
sequenceComplete
;
if
(
token
!=
null
)
if
(
token
!=
null
)
input
=
(
new
BASE64Decoder
()).
decodeBuffer
(
token
);
input
=
Base64
.
getDecoder
().
decode
(
token
);
byte
[]
b
=
getNextToken
(
crdHandle
,
input
,
status
);
byte
[]
b
=
getNextToken
(
crdHandle
,
input
,
status
);
if
(
b
==
null
)
if
(
b
==
null
)
throw
new
IOException
(
"Internal authentication error"
);
throw
new
IOException
(
"Internal authentication error"
);
return
(
new
B64Encoder
()).
encode
(
b
);
return
Base64
.
getEncoder
().
encodeToString
(
b
);
}
}
public
boolean
isComplete
()
{
public
boolean
isComplete
()
{
...
@@ -95,8 +94,3 @@ public class NTLMAuthSequence {
...
@@ -95,8 +94,3 @@ public class NTLMAuthSequence {
private
native
byte
[]
getNextToken
(
long
crdHandle
,
byte
[]
lastToken
,
Status
returned
);
private
native
byte
[]
getNextToken
(
long
crdHandle
,
byte
[]
lastToken
,
Status
returned
);
}
}
class
B64Encoder
extends
BASE64Encoder
{
protected
int
bytesPerLine
()
{
return
1024
;
}
}
test/sun/net/www/protocol/http/ProxyTunnelServer.java
浏览文件 @
94082ec6
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
import
java.io.*
;
import
java.io.*
;
import
java.net.*
;
import
java.net.*
;
import
java.util.Base64
;
import
javax.net.ssl.*
;
import
javax.net.ssl.*
;
import
javax.net.ServerSocketFactory
;
import
javax.net.ServerSocketFactory
;
import
sun.net.www.*
;
import
sun.net.www.*
;
...
@@ -295,10 +296,8 @@ public class ProxyTunnelServer extends Thread {
...
@@ -295,10 +296,8 @@ public class ProxyTunnelServer extends Thread {
String
recvdUserPlusPass
=
authInfo
.
substring
(
ind
+
1
).
trim
();
String
recvdUserPlusPass
=
authInfo
.
substring
(
ind
+
1
).
trim
();
// extract encoded (username:passwd
// extract encoded (username:passwd
if
(
userPlusPass
.
equals
(
if
(
userPlusPass
.
equals
(
new
String
(
new
String
(
Base64
.
getDecoder
().
decode
(
recvdUserPlusPass
))
(
new
sun
.
misc
.
BASE64Decoder
()).
))
{
decodeBuffer
(
recvdUserPlusPass
)
)))
{
matched
=
true
;
matched
=
true
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录