Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
406310fd
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看板
提交
406310fd
编写于
11月 29, 2012
作者:
M
michaelm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7200720: crash in net.dll during NTLM authentication
Reviewed-by: chegar, dsamersoff
上级
d5c4864e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
48 addition
and
15 deletion
+48
-15
make/java/net/Makefile
make/java/net/Makefile
+1
-0
src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
...sses/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
+21
-4
src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
...es/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
+4
-0
src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
.../native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
+22
-11
未找到文件。
make/java/net/Makefile
浏览文件 @
406310fd
...
...
@@ -77,6 +77,7 @@ ifeq ($(PLATFORM), windows)
FILES_export
+=
java/net/DualStackPlainSocketImpl.java
FILES_export
+=
java/net/TwoStacksPlainDatagramSocketImpl.java
FILES_export
+=
java/net/DualStackPlainDatagramSocketImpl.java
FILES_export
+=
sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
else
FILES_export
+=
java/net/PlainDatagramSocketImpl.java
endif
...
...
src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java
浏览文件 @
406310fd
...
...
@@ -45,15 +45,25 @@ public class NTLMAuthSequence {
private
long
ctxHandle
;
static
{
initFirst
();
initFirst
(
Status
.
class
);
}
// Used by native code to indicate when a particular protocol sequence is completed
// and must not be re-used.
class
Status
{
boolean
sequenceComplete
;
}
Status
status
;
NTLMAuthSequence
(
String
username
,
String
password
,
String
ntdomain
)
throws
IOException
{
this
.
username
=
username
;
this
.
password
=
password
;
this
.
ntdomain
=
ntdomain
;
this
.
status
=
new
Status
();
state
=
0
;
crdHandle
=
getCredentialsHandle
(
username
,
ntdomain
,
password
);
if
(
crdHandle
==
0
)
{
...
...
@@ -63,19 +73,26 @@ public class NTLMAuthSequence {
public
String
getAuthHeader
(
String
token
)
throws
IOException
{
byte
[]
input
=
null
;
assert
!
status
.
sequenceComplete
;
if
(
token
!=
null
)
input
=
(
new
BASE64Decoder
()).
decodeBuffer
(
token
);
byte
[]
b
=
getNextToken
(
crdHandle
,
input
);
byte
[]
b
=
getNextToken
(
crdHandle
,
input
,
status
);
if
(
b
==
null
)
throw
new
IOException
(
"Internal authentication error"
);
return
(
new
B64Encoder
()).
encode
(
b
);
}
private
native
static
void
initFirst
();
public
boolean
isComplete
()
{
return
status
.
sequenceComplete
;
}
private
native
static
void
initFirst
(
Class
<
NTLMAuthSequence
.
Status
>
clazz
);
private
native
long
getCredentialsHandle
(
String
user
,
String
domain
,
String
password
);
private
native
byte
[]
getNextToken
(
long
crdHandle
,
byte
[]
lastToken
);
private
native
byte
[]
getNextToken
(
long
crdHandle
,
byte
[]
lastToken
,
Status
returned
);
}
class
B64Encoder
extends
BASE64Encoder
{
...
...
src/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java
浏览文件 @
406310fd
...
...
@@ -193,8 +193,12 @@ public class NTLMAuthentication extends AuthenticationInfo {
}
String
response
=
"NTLM "
+
seq
.
getAuthHeader
(
raw
.
length
()>
6
?
raw
.
substring
(
5
):
null
);
conn
.
setAuthenticationProperty
(
getHeaderName
(),
response
);
if
(
seq
.
isComplete
())
{
conn
.
authObj
(
null
);
}
return
true
;
}
catch
(
IOException
e
)
{
conn
.
authObj
(
null
);
return
false
;
}
}
...
...
src/windows/native/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.c
浏览文件 @
406310fd
/*
* Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
1
, 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
...
...
@@ -41,18 +41,20 @@
#define SECURITY_WIN32
#include "sspi.h"
static
void
endSequence
(
PCredHandle
credHand
,
PCtxtHandle
ctxHandle
);
static
void
endSequence
(
PCredHandle
credHand
,
PCtxtHandle
ctxHandle
,
JNIEnv
*
env
,
jobject
status
);
static
jfieldID
ntlm_ctxHandleID
;
static
jfieldID
ntlm_crdHandleID
;
static
jfieldID
status_seqCompleteID
;
static
HINSTANCE
lib
=
NULL
;
JNIEXPORT
void
JNICALL
Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_initFirst
(
JNIEnv
*
env
,
jclass
clazz
)
(
JNIEnv
*
env
,
jclass
authseq_clazz
,
jclass
status_
clazz
)
{
ntlm_ctxHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
clazz
,
"ctxHandle"
,
"J"
);
ntlm_crdHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
clazz
,
"crdHandle"
,
"J"
);
ntlm_ctxHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
authseq_clazz
,
"ctxHandle"
,
"J"
);
ntlm_crdHandleID
=
(
*
env
)
->
GetFieldID
(
env
,
authseq_clazz
,
"crdHandle"
,
"J"
);
status_seqCompleteID
=
(
*
env
)
->
GetFieldID
(
env
,
status_clazz
,
"sequenceComplete"
,
"Z"
);
}
/*
...
...
@@ -145,8 +147,14 @@ JNIEXPORT jlong JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_get
}
}
/*
* Class: sun_net_www_protocol_http_ntlm_NTLMAuthSequence
* Method: getNextToken
* Signature: (J[BLsun/net/www/protocol/http/ntlm/NTLMAuthSequence/Status;)[B
*/
JNIEXPORT
jbyteArray
JNICALL
Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequence_getNextToken
(
JNIEnv
*
env
,
jobject
this
,
jlong
crdHandle
,
jbyteArray
lastToken
)
(
JNIEnv
*
env
,
jobject
this
,
jlong
crdHandle
,
jbyteArray
lastToken
,
jobject
status
)
{
VOID
*
pInput
=
0
;
...
...
@@ -217,7 +225,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
}
if
(
ss
<
0
)
{
endSequence
(
pCred
,
pCtx
);
endSequence
(
pCred
,
pCtx
,
env
,
status
);
return
0
;
}
...
...
@@ -225,7 +233,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
ss
=
CompleteAuthToken
(
pCtx
,
&
OutBuffDesc
);
if
(
ss
<
0
)
{
endSequence
(
pCred
,
pCtx
);
endSequence
(
pCred
,
pCtx
,
env
,
status
);
return
0
;
}
}
...
...
@@ -235,18 +243,18 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc
(
*
env
)
->
SetByteArrayRegion
(
env
,
ret
,
0
,
OutSecBuff
.
cbBuffer
,
OutSecBuff
.
pvBuffer
);
if
(
lastToken
!=
0
)
// 2nd stage
endSequence
(
pCred
,
pCtx
);
endSequence
(
pCred
,
pCtx
,
env
,
status
);
result
=
ret
;
}
if
((
ss
!=
SEC_I_CONTINUE_NEEDED
)
&&
(
ss
==
SEC_I_COMPLETE_AND_CONTINUE
))
{
endSequence
(
pCred
,
pCtx
);
endSequence
(
pCred
,
pCtx
,
env
,
status
);
}
return
result
;
}
static
void
endSequence
(
PCredHandle
credHand
,
PCtxtHandle
ctxHandle
)
{
static
void
endSequence
(
PCredHandle
credHand
,
PCtxtHandle
ctxHandle
,
JNIEnv
*
env
,
jobject
status
)
{
if
(
credHand
!=
0
)
{
FreeCredentialsHandle
(
credHand
);
free
(
credHand
);
...
...
@@ -256,4 +264,7 @@ static void endSequence (PCredHandle credHand, PCtxtHandle ctxHandle) {
DeleteSecurityContext
(
ctxHandle
);
free
(
ctxHandle
);
}
/* Sequence is complete so set flag */
(
*
env
)
->
SetBooleanField
(
env
,
status
,
status_seqCompleteID
,
JNI_TRUE
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录