Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0c6092d8
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看板
提交
0c6092d8
编写于
9月 05, 2011
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7049079: NTSYSTEM CLASS IS LEAKING WINDOWS TOKENS
Reviewed-by: weijun
上级
dba16f93
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
23 deletion
+25
-23
src/share/classes/com/sun/security/auth/module/NTSystem.java
src/share/classes/com/sun/security/auth/module/NTSystem.java
+7
-2
src/windows/native/com/sun/security/auth/module/nt.c
src/windows/native/com/sun/security/auth/module/nt.c
+18
-21
未找到文件。
src/share/classes/com/sun/security/auth/module/NTSystem.java
浏览文件 @
0c6092d8
/*
* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
...
...
@@ -33,6 +33,7 @@ package com.sun.security.auth.module;
public
class
NTSystem
{
private
native
void
getCurrent
(
boolean
debug
);
private
native
long
getImpersonationToken0
();
private
String
userName
;
private
String
domain
;
...
...
@@ -132,10 +133,14 @@ public class NTSystem {
*
* @return an impersonation token for the current NT user.
*/
public
long
getImpersonationToken
()
{
public
synchronized
long
getImpersonationToken
()
{
if
(
impersonationToken
==
0
)
{
impersonationToken
=
getImpersonationToken0
();
}
return
impersonationToken
;
}
private
void
loadNative
()
{
System
.
loadLibrary
(
"jaas_nt"
);
}
...
...
src/windows/native/com/sun/security/auth/module/nt.c
浏览文件 @
0c6092d8
/*
* Copyright (c) 2000, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
11
, 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
...
...
@@ -43,6 +43,19 @@ BOOL getImpersonationToken(PHANDLE impersonationToken);
BOOL
getTextualSid
(
PSID
pSid
,
LPTSTR
TextualSid
,
LPDWORD
lpdwBufferLen
);
void
DisplayErrorText
(
DWORD
dwLastError
);
JNIEXPORT
jlong
JNICALL
Java_com_sun_security_auth_module_NTSystem_getImpersonationToken0
(
JNIEnv
*
env
,
jobject
obj
)
{
HANDLE
impersonationToken
=
0
;
// impersonation token
if
(
debug
)
{
printf
(
"getting impersonation token
\n
"
);
}
if
(
getImpersonationToken
(
&
impersonationToken
)
==
FALSE
)
{
return
0
;
}
return
(
jlong
)
impersonationToken
;
}
JNIEXPORT
void
JNICALL
Java_com_sun_security_auth_module_NTSystem_getCurrent
(
JNIEnv
*
env
,
jobject
obj
,
jboolean
debugNative
)
{
...
...
@@ -59,7 +72,6 @@ Java_com_sun_security_auth_module_NTSystem_getCurrent
DWORD
numGroups
=
0
;
// num groups
LPTSTR
*
groups
=
NULL
;
// groups array
long
pIndex
=
-
1
;
// index of primaryGroup in groups array
HANDLE
impersonationToken
=
0
;
// impersonation token
jfieldID
fid
;
jstring
jstr
;
...
...
@@ -100,13 +112,6 @@ Java_com_sun_security_auth_module_NTSystem_getCurrent
return
;
}
if
(
debug
)
{
printf
(
"getting impersonation token
\n
"
);
}
if
(
getImpersonationToken
(
&
impersonationToken
)
==
FALSE
)
{
return
;
}
// then set values into NTSystem
fid
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"userName"
,
"Ljava/lang/String;"
);
...
...
@@ -233,18 +238,6 @@ Java_com_sun_security_auth_module_NTSystem_getCurrent
(
*
env
)
->
SetObjectField
(
env
,
obj
,
fid
,
jgroups
);
}
fid
=
(
*
env
)
->
GetFieldID
(
env
,
cls
,
"impersonationToken"
,
"J"
);
if
(
fid
==
0
)
{
jclass
newExcCls
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/IllegalArgumentException"
);
if
(
newExcCls
==
0
)
{
systemError
=
TRUE
;
goto
out
;
}
(
*
env
)
->
ThrowNew
(
env
,
newExcCls
,
"invalid field: impersonationToken"
);
}
(
*
env
)
->
SetLongField
(
env
,
obj
,
fid
,
(
jlong
)
impersonationToken
);
out:
if
(
userName
!=
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
userName
);
...
...
@@ -269,6 +262,7 @@ out:
}
HeapFree
(
GetProcessHeap
(),
0
,
groups
);
}
CloseHandle
(
tokenHandle
);
if
(
systemError
&&
debug
)
{
printf
(
" [getCurrent] System Error: "
);
...
...
@@ -592,6 +586,7 @@ BOOL getImpersonationToken(PHANDLE impersonationToken) {
}
return
FALSE
;
}
CloseHandle
(
dupToken
);
if
(
debug
)
{
printf
(
" [getImpersonationToken] token = %d
\n
"
,
*
impersonationToken
);
...
...
@@ -802,6 +797,8 @@ void main(int argc, char *argv[]) {
}
HeapFree(GetProcessHeap(), 0, groups);
}
CloseHandle(impersonationToken);
CloseHandle(tokenHandle);
}
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录