Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
549df33b
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看板
提交
549df33b
编写于
4月 17, 2013
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8011124: Make KerberosTime immutable
Reviewed-by: xuelei
上级
ad59a26e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
110 addition
and
187 deletion
+110
-187
src/share/classes/sun/security/krb5/KrbApReq.java
src/share/classes/sun/security/krb5/KrbApReq.java
+6
-6
src/share/classes/sun/security/krb5/KrbAppMessage.java
src/share/classes/sun/security/krb5/KrbAppMessage.java
+10
-4
src/share/classes/sun/security/krb5/KrbCred.java
src/share/classes/sun/security/krb5/KrbCred.java
+1
-1
src/share/classes/sun/security/krb5/KrbTgsReq.java
src/share/classes/sun/security/krb5/KrbTgsReq.java
+1
-2
src/share/classes/sun/security/krb5/internal/KerberosTime.java
...hare/classes/sun/security/krb5/internal/KerberosTime.java
+69
-133
src/share/classes/sun/security/krb5/internal/KrbCredInfo.java
...share/classes/sun/security/krb5/internal/KrbCredInfo.java
+4
-8
src/share/classes/sun/security/krb5/internal/LastReqEntry.java
...hare/classes/sun/security/krb5/internal/LastReqEntry.java
+1
-1
src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
+1
-1
src/share/classes/sun/security/krb5/internal/ccache/Credentials.java
...lasses/sun/security/krb5/internal/ccache/Credentials.java
+14
-28
test/sun/security/krb5/MicroTime.java
test/sun/security/krb5/MicroTime.java
+3
-3
未找到文件。
src/share/classes/sun/security/krb5/KrbApReq.java
浏览文件 @
549df33b
...
@@ -204,7 +204,7 @@ public class KrbApReq {
...
@@ -204,7 +204,7 @@ public class KrbApReq {
int
usage
)
int
usage
)
throws
KrbException
,
IOException
{
throws
KrbException
,
IOException
{
ctime
=
new
KerberosTime
(
KerberosTime
.
NOW
);
ctime
=
KerberosTime
.
now
(
);
init
(
options
,
init
(
options
,
tgs_creds
.
ticket
,
tgs_creds
.
ticket
,
tgs_creds
.
key
,
tgs_creds
.
key
,
...
@@ -287,14 +287,14 @@ public class KrbApReq {
...
@@ -287,14 +287,14 @@ public class KrbApReq {
authenticator
=
new
Authenticator
(
temp2
);
authenticator
=
new
Authenticator
(
temp2
);
ctime
=
authenticator
.
ctime
;
ctime
=
authenticator
.
ctime
;
cusec
=
authenticator
.
cusec
;
cusec
=
authenticator
.
cusec
;
authenticator
.
ctime
.
setMicroSeconds
(
authenticator
.
cusec
);
authenticator
.
ctime
=
authenticator
.
ctime
.
withMicroSeconds
(
authenticator
.
cusec
);
if
(!
authenticator
.
cname
.
equals
(
enc_ticketPart
.
cname
))
{
if
(!
authenticator
.
cname
.
equals
(
enc_ticketPart
.
cname
))
{
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_BADMATCH
);
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_BADMATCH
);
}
}
KerberosTime
currTime
=
new
KerberosTime
(
KerberosTime
.
NOW
);
if
(!
authenticator
.
ctime
.
inClockSkew
())
if
(!
authenticator
.
ctime
.
inClockSkew
(
currTime
))
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_SKEW
);
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_SKEW
);
// start to check if it is a replay attack.
// start to check if it is a replay attack.
...
@@ -304,7 +304,7 @@ public class KrbApReq {
...
@@ -304,7 +304,7 @@ public class KrbApReq {
if
(
table
.
get
(
time
,
authenticator
.
cname
.
toString
())
!=
null
)
{
if
(
table
.
get
(
time
,
authenticator
.
cname
.
toString
())
!=
null
)
{
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_REPEAT
);
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_REPEAT
);
}
else
{
}
else
{
table
.
put
(
client
,
time
,
currTime
.
getTime
());
table
.
put
(
client
,
time
,
System
.
currentTimeMillis
());
}
}
if
(
initiator
!=
null
)
{
if
(
initiator
!=
null
)
{
...
@@ -329,7 +329,7 @@ public class KrbApReq {
...
@@ -329,7 +329,7 @@ public class KrbApReq {
// else
// else
// save authenticator to check for later
// save authenticator to check for later
KerberosTime
now
=
new
KerberosTime
(
KerberosTime
.
NOW
);
KerberosTime
now
=
KerberosTime
.
now
(
);
if
((
enc_ticketPart
.
starttime
!=
null
&&
if
((
enc_ticketPart
.
starttime
!=
null
&&
enc_ticketPart
.
starttime
.
greaterThanWRTClockSkew
(
now
))
||
enc_ticketPart
.
starttime
.
greaterThanWRTClockSkew
(
now
))
||
...
...
src/share/classes/sun/security/krb5/KrbAppMessage.java
浏览文件 @
549df33b
...
@@ -71,12 +71,18 @@ abstract class KrbAppMessage {
...
@@ -71,12 +71,18 @@ abstract class KrbAppMessage {
}
}
if
(
packetTimestamp
!=
null
)
{
if
(
packetTimestamp
!=
null
)
{
packetTimestamp
.
setMicroSeconds
(
packetUsec
);
if
(
packetUsec
!=
null
)
{
if
(!
packetTimestamp
.
inClockSkew
())
packetTimestamp
=
packetTimestamp
.
withMicroSeconds
(
packetUsec
.
intValue
());
}
if
(!
packetTimestamp
.
inClockSkew
())
{
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_SKEW
);
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_SKEW
);
}
else
}
if
(
timestampRequired
)
}
else
{
if
(
timestampRequired
)
{
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_SKEW
);
throw
new
KrbApErrException
(
Krb5
.
KRB_AP_ERR_SKEW
);
}
}
// XXX check replay cache
// XXX check replay cache
// if (rcache.repeated(packetTimestamp, packetUsec, packetSAddress))
// if (rcache.repeated(packetTimestamp, packetUsec, packetSAddress))
...
...
src/share/classes/sun/security/krb5/KrbCred.java
浏览文件 @
549df33b
...
@@ -103,7 +103,7 @@ public class KrbCred {
...
@@ -103,7 +103,7 @@ public class KrbCred {
delegatedCreds
.
renewTill
,
tgService
,
delegatedCreds
.
renewTill
,
tgService
,
delegatedCreds
.
cAddr
);
delegatedCreds
.
cAddr
);
timeStamp
=
new
KerberosTime
(
KerberosTime
.
NOW
);
timeStamp
=
KerberosTime
.
now
(
);
KrbCredInfo
[]
credInfos
=
{
credInfo
};
KrbCredInfo
[]
credInfos
=
{
credInfo
};
EncKrbCredPart
encPart
=
EncKrbCredPart
encPart
=
new
EncKrbCredPart
(
credInfos
,
new
EncKrbCredPart
(
credInfos
,
...
...
src/share/classes/sun/security/krb5/KrbTgsReq.java
浏览文件 @
549df33b
...
@@ -147,8 +147,7 @@ public class KrbTgsReq {
...
@@ -147,8 +147,7 @@ public class KrbTgsReq {
princName
=
cname
;
princName
=
cname
;
servName
=
sname
;
servName
=
sname
;
ctime
=
new
KerberosTime
(
KerberosTime
.
NOW
);
ctime
=
KerberosTime
.
now
();
// check if they are valid arguments. The optional fields
// check if they are valid arguments. The optional fields
// should be consistent with settings in KDCOptions.
// should be consistent with settings in KDCOptions.
...
...
src/share/classes/sun/security/krb5/internal/KerberosTime.java
浏览文件 @
549df33b
...
@@ -30,18 +30,20 @@
...
@@ -30,18 +30,20 @@
package
sun.security.krb5.internal
;
package
sun.security.krb5.internal
;
import
java.util.TimeZone
;
import
sun.security.krb5.Asn1Exception
;
import
sun.security.util.*
;
import
sun.security.krb5.Config
;
import
sun.security.krb5.Config
;
import
sun.security.krb5.KrbException
;
import
sun.security.krb5.KrbException
;
import
sun.security.
krb5.Asn1Exception
;
import
sun.security.
util.DerInputStream
;
import
java.util.Date
;
import
sun.security.util.DerOutputStream
;
import
java.util.GregorianCalendar
;
import
sun.security.util.DerValue
;
import
java.util.Calendar
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.TimeZone
;
/**
/**
* Implements the ASN.1 KerberosTime type.
* Implements the ASN.1 KerberosTime type.
This is an immutable class.
*
*
* <xmp>
* <xmp>
* KerberosTime ::= GeneralizedTime -- with no fractional seconds
* KerberosTime ::= GeneralizedTime -- with no fractional seconds
...
@@ -62,55 +64,38 @@ import java.io.IOException;
...
@@ -62,55 +64,38 @@ import java.io.IOException;
* same class can be used as a precise timestamp in Authenticator etc.
* same class can be used as a precise timestamp in Authenticator etc.
*/
*/
public
class
KerberosTime
implements
Cloneable
{
public
class
KerberosTime
{
private
long
kerberosTime
;
// milliseconds since epoch, a Date.getTime() value
private
final
long
kerberosTime
;
// milliseconds since epoch, Date.getTime()
private
int
microSeconds
;
// the last three digits of the microsecond value
private
final
int
microSeconds
;
// last 3 digits of the real microsecond
// The time when this class is loaded. Used in setNow()
// The time when this class is loaded. Used in setNow()
private
static
long
initMilli
=
System
.
currentTimeMillis
();
private
static
long
initMilli
=
System
.
currentTimeMillis
();
private
static
long
initMicro
=
System
.
nanoTime
()
/
1000
;
private
static
long
initMicro
=
System
.
nanoTime
()
/
1000
;
private
static
long
syncTime
;
private
static
boolean
DEBUG
=
Krb5
.
DEBUG
;
private
static
boolean
DEBUG
=
Krb5
.
DEBUG
;
public
static
final
boolean
NOW
=
true
;
// Do not make this public. It's a little confusing that micro
public
static
final
boolean
UNADJUSTED_NOW
=
false
;
// is only the last 3 digits of microsecond.
public
KerberosTime
(
long
time
)
{
kerberosTime
=
time
;
}
private
KerberosTime
(
long
time
,
int
micro
)
{
private
KerberosTime
(
long
time
,
int
micro
)
{
kerberosTime
=
time
;
kerberosTime
=
time
;
microSeconds
=
micro
;
microSeconds
=
micro
;
}
}
public
Object
clone
()
{
/**
return
new
KerberosTime
(
kerberosTime
,
microSeconds
);
* Creates a KerberosTime object from milliseconds since epoch.
*/
public
KerberosTime
(
long
time
)
{
this
(
time
,
0
);
}
}
// This constructor is used in the native code
// This constructor is used in the native code
// src/windows/native/sun/security/krb5/NativeCreds.c
// src/windows/native/sun/security/krb5/NativeCreds.c
public
KerberosTime
(
String
time
)
throws
Asn1Exception
{
public
KerberosTime
(
String
time
)
throws
Asn1Exception
{
kerberosTime
=
toKerberosTime
(
time
);
this
(
toKerberosTime
(
time
),
0
);
}
/**
* Constructs a KerberosTime object.
* @param encoding a DER-encoded data.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
*/
public
KerberosTime
(
DerValue
encoding
)
throws
Asn1Exception
,
IOException
{
GregorianCalendar
calendar
=
new
GregorianCalendar
();
Date
temp
=
encoding
.
getGeneralizedTime
();
kerberosTime
=
temp
.
getTime
();
}
}
private
static
long
toKerberosTime
(
String
time
)
throws
Asn1Exception
{
private
static
long
toKerberosTime
(
String
time
)
throws
Asn1Exception
{
// this method only used by KerberosTime class.
// ASN.1 GeneralizedTime format:
// ASN.1 GeneralizedTime format:
// "19700101000000Z"
// "19700101000000Z"
...
@@ -133,30 +118,34 @@ public class KerberosTime implements Cloneable {
...
@@ -133,30 +118,34 @@ public class KerberosTime implements Cloneable {
Integer
.
parseInt
(
time
.
substring
(
8
,
10
)),
Integer
.
parseInt
(
time
.
substring
(
8
,
10
)),
Integer
.
parseInt
(
time
.
substring
(
10
,
12
)),
Integer
.
parseInt
(
time
.
substring
(
10
,
12
)),
Integer
.
parseInt
(
time
.
substring
(
12
,
14
)));
Integer
.
parseInt
(
time
.
substring
(
12
,
14
)));
return
calendar
.
getTimeInMillis
();
//The Date constructor assumes the setting are local relative
//and converts the time to UTC before storing it. Since we
//want the internal representation to correspond to local
//and not UTC time we subtract the UTC time offset.
return
(
calendar
.
getTime
().
getTime
());
}
// should be moved to sun.security.krb5.util class
public
static
String
zeroPad
(
String
s
,
int
length
)
{
StringBuffer
temp
=
new
StringBuffer
(
s
);
while
(
temp
.
length
()
<
length
)
temp
.
insert
(
0
,
'0'
);
return
temp
.
toString
();
}
}
/**
* Creates a KerberosTime object from a Date object.
*/
public
KerberosTime
(
Date
time
)
{
public
KerberosTime
(
Date
time
)
{
kerberosTime
=
time
.
getTime
();
// (time.getTimezoneOffset() * 60000L
);
this
(
time
.
getTime
(),
0
);
}
}
public
KerberosTime
(
boolean
initToNow
)
{
/**
if
(
initToNow
)
{
* Creates a KerberosTime object for now. It uses System.nanoTime()
setNow
();
* to get a more precise time than "new Date()".
*/
public
static
KerberosTime
now
()
{
long
newMilli
=
System
.
currentTimeMillis
();
long
newMicro
=
System
.
nanoTime
()
/
1000
;
long
microElapsed
=
newMicro
-
initMicro
;
long
calcMilli
=
initMilli
+
microElapsed
/
1000
;
if
(
calcMilli
-
newMilli
>
100
||
newMilli
-
calcMilli
>
100
)
{
if
(
DEBUG
)
{
System
.
out
.
println
(
"System time adjusted"
);
}
initMilli
=
newMilli
;
initMicro
=
newMicro
;
return
new
KerberosTime
(
newMilli
,
0
);
}
else
{
return
new
KerberosTime
(
calcMilli
,
(
int
)(
microElapsed
%
1000
));
}
}
}
}
...
@@ -169,13 +158,13 @@ public class KerberosTime implements Cloneable {
...
@@ -169,13 +158,13 @@ public class KerberosTime implements Cloneable {
calendar
.
clear
();
calendar
.
clear
();
calendar
.
setTimeInMillis
(
kerberosTime
);
calendar
.
setTimeInMillis
(
kerberosTime
);
return
zeroPad
(
Integer
.
toString
(
calendar
.
get
(
Calendar
.
YEAR
)),
4
)
+
return
String
.
format
(
"%04d%02d%02d%02d%02d%02dZ"
,
zeroPad
(
Integer
.
toString
(
calendar
.
get
(
Calendar
.
MONTH
)
+
1
),
2
)
+
calendar
.
get
(
Calendar
.
YEAR
),
zeroPad
(
Integer
.
toString
(
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
)),
2
)
+
calendar
.
get
(
Calendar
.
MONTH
)
+
1
,
zeroPad
(
Integer
.
toString
(
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)),
2
)
+
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
),
zeroPad
(
Integer
.
toString
(
calendar
.
get
(
Calendar
.
MINUTE
)),
2
)
+
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
),
zeroPad
(
Integer
.
toString
(
calendar
.
get
(
Calendar
.
SECOND
)),
2
)
+
'Z'
;
calendar
.
get
(
Calendar
.
MINUTE
),
calendar
.
get
(
Calendar
.
SECOND
));
}
}
/**
/**
...
@@ -194,40 +183,8 @@ public class KerberosTime implements Cloneable {
...
@@ -194,40 +183,8 @@ public class KerberosTime implements Cloneable {
return
kerberosTime
;
return
kerberosTime
;
}
}
public
void
setTime
(
Date
time
)
{
kerberosTime
=
time
.
getTime
();
// (time.getTimezoneOffset() * 60000L);
microSeconds
=
0
;
}
public
void
setTime
(
long
time
)
{
kerberosTime
=
time
;
microSeconds
=
0
;
}
public
Date
toDate
()
{
public
Date
toDate
()
{
Date
temp
=
new
Date
(
kerberosTime
);
return
new
Date
(
kerberosTime
);
temp
.
setTime
(
temp
.
getTime
());
return
temp
;
}
public
void
setNow
()
{
long
newMilli
=
System
.
currentTimeMillis
();
long
newMicro
=
System
.
nanoTime
()
/
1000
;
long
microElapsed
=
newMicro
-
initMicro
;
long
calcMilli
=
initMilli
+
microElapsed
/
1000
;
if
(
calcMilli
-
newMilli
>
100
||
newMilli
-
calcMilli
>
100
)
{
if
(
DEBUG
)
{
System
.
out
.
println
(
"System time adjusted"
);
}
initMilli
=
newMilli
;
initMicro
=
newMicro
;
setTime
(
newMilli
);
microSeconds
=
0
;
}
else
{
setTime
(
calcMilli
);
microSeconds
=
(
int
)(
microElapsed
%
1000
);
}
}
}
public
int
getMicroSeconds
()
{
public
int
getMicroSeconds
()
{
...
@@ -235,45 +192,25 @@ public class KerberosTime implements Cloneable {
...
@@ -235,45 +192,25 @@ public class KerberosTime implements Cloneable {
return
temp_long
.
intValue
()
+
microSeconds
;
return
temp_long
.
intValue
()
+
microSeconds
;
}
}
public
void
setMicroSeconds
(
int
usec
)
{
/**
microSeconds
=
usec
%
1000
;
* Returns a new KerberosTime object with the original seconds
Integer
temp_int
=
new
Integer
(
usec
);
* and the given microseconds.
long
temp_long
=
temp_int
.
longValue
()
/
1000L
;
*/
kerberosTime
=
kerberosTime
-
(
kerberosTime
%
1000L
)
+
temp_long
;
public
KerberosTime
withMicroSeconds
(
int
usec
)
{
return
new
KerberosTime
(
kerberosTime
-
kerberosTime
%
1000L
+
usec
/
1000L
,
usec
%
1000
);
}
}
public
void
setMicroSeconds
(
Integer
usec
)
{
private
boolean
inClockSkew
(
int
clockSkew
)
{
if
(
usec
!=
null
)
{
return
java
.
lang
.
Math
.
abs
(
kerberosTime
-
System
.
currentTimeMillis
())
microSeconds
=
usec
.
intValue
()
%
1000
;
<=
clockSkew
*
1000L
;
long
temp_long
=
usec
.
longValue
()
/
1000L
;
kerberosTime
=
kerberosTime
-
(
kerberosTime
%
1000L
)
+
temp_long
;
}
}
public
boolean
inClockSkew
(
int
clockSkew
)
{
KerberosTime
now
=
new
KerberosTime
(
KerberosTime
.
NOW
);
if
(
java
.
lang
.
Math
.
abs
(
kerberosTime
-
now
.
kerberosTime
)
>
clockSkew
*
1000L
)
return
false
;
return
true
;
}
}
public
boolean
inClockSkew
()
{
public
boolean
inClockSkew
()
{
return
inClockSkew
(
getDefaultSkew
());
return
inClockSkew
(
getDefaultSkew
());
}
}
public
boolean
inClockSkew
(
int
clockSkew
,
KerberosTime
now
)
{
if
(
java
.
lang
.
Math
.
abs
(
kerberosTime
-
now
.
kerberosTime
)
>
clockSkew
*
1000L
)
return
false
;
return
true
;
}
public
boolean
inClockSkew
(
KerberosTime
time
)
{
return
inClockSkew
(
getDefaultSkew
(),
time
);
}
public
boolean
greaterThanWRTClockSkew
(
KerberosTime
time
,
int
clockSkew
)
{
public
boolean
greaterThanWRTClockSkew
(
KerberosTime
time
,
int
clockSkew
)
{
if
((
kerberosTime
-
time
.
kerberosTime
)
>
clockSkew
*
1000L
)
if
((
kerberosTime
-
time
.
kerberosTime
)
>
clockSkew
*
1000L
)
return
true
;
return
true
;
...
@@ -317,24 +254,22 @@ public class KerberosTime implements Cloneable {
...
@@ -317,24 +254,22 @@ public class KerberosTime implements Cloneable {
return
temp_long
.
intValue
();
return
temp_long
.
intValue
();
}
}
public
void
setSeconds
(
int
sec
)
{
Integer
temp_int
=
new
Integer
(
sec
);
kerberosTime
=
temp_int
.
longValue
()
*
1000L
;
}
/**
/**
* Parse (unmarshal) a kerberostime from a DER input stream. This form
* Parse (unmarshal) a kerberostime from a DER input stream. This form
* parsing might be used when expanding a value which is part of
* parsing might be used when expanding a value which is part of
* a constructed sequence and uses explicitly tagged type.
* a constructed sequence and uses explicitly tagged type.
*
*
* @exception Asn1Exception on error.
* @exception Asn1Exception on error.
* @param data the Der input stream value, which contains one or more marshaled value.
* @param data the Der input stream value, which contains
* one or more marshaled value.
* @param explicitTag tag number.
* @param explicitTag tag number.
* @param optional indicates if this data field is optional
* @param optional indicates if this data field is optional
* @return an instance of KerberosTime.
* @return an instance of KerberosTime.
*
*
*/
*/
public
static
KerberosTime
parse
(
DerInputStream
data
,
byte
explicitTag
,
boolean
optional
)
throws
Asn1Exception
,
IOException
{
public
static
KerberosTime
parse
(
DerInputStream
data
,
byte
explicitTag
,
boolean
optional
)
throws
Asn1Exception
,
IOException
{
if
((
optional
)
&&
(((
byte
)
data
.
peekByte
()
&
(
byte
)
0x1F
)!=
explicitTag
))
if
((
optional
)
&&
(((
byte
)
data
.
peekByte
()
&
(
byte
)
0x1F
)!=
explicitTag
))
return
null
;
return
null
;
DerValue
der
=
data
.
getDerValue
();
DerValue
der
=
data
.
getDerValue
();
...
@@ -343,7 +278,8 @@ public class KerberosTime implements Cloneable {
...
@@ -343,7 +278,8 @@ public class KerberosTime implements Cloneable {
}
}
else
{
else
{
DerValue
subDer
=
der
.
getData
().
getDerValue
();
DerValue
subDer
=
der
.
getData
().
getDerValue
();
return
new
KerberosTime
(
subDer
);
Date
temp
=
subDer
.
getGeneralizedTime
();
return
new
KerberosTime
(
temp
.
getTime
(),
0
);
}
}
}
}
...
...
src/share/classes/sun/security/krb5/internal/KrbCredInfo.java
浏览文件 @
549df33b
...
@@ -187,14 +187,10 @@ public class KrbCredInfo {
...
@@ -187,14 +187,10 @@ public class KrbCredInfo {
kcred
.
pname
=
(
PrincipalName
)
pname
.
clone
();
kcred
.
pname
=
(
PrincipalName
)
pname
.
clone
();
if
(
flags
!=
null
)
if
(
flags
!=
null
)
kcred
.
flags
=
(
TicketFlags
)
flags
.
clone
();
kcred
.
flags
=
(
TicketFlags
)
flags
.
clone
();
if
(
authtime
!=
null
)
kcred
.
authtime
=
authtime
;
kcred
.
authtime
=
(
KerberosTime
)
authtime
.
clone
();
kcred
.
starttime
=
starttime
;
if
(
starttime
!=
null
)
kcred
.
endtime
=
endtime
;
kcred
.
starttime
=
(
KerberosTime
)
starttime
.
clone
();
kcred
.
renewTill
=
renewTill
;
if
(
endtime
!=
null
)
kcred
.
endtime
=
(
KerberosTime
)
endtime
.
clone
();
if
(
renewTill
!=
null
)
kcred
.
renewTill
=
(
KerberosTime
)
renewTill
.
clone
();
if
(
sname
!=
null
)
if
(
sname
!=
null
)
kcred
.
sname
=
(
PrincipalName
)
sname
.
clone
();
kcred
.
sname
=
(
PrincipalName
)
sname
.
clone
();
if
(
caddr
!=
null
)
if
(
caddr
!=
null
)
...
...
src/share/classes/sun/security/krb5/internal/LastReqEntry.java
浏览文件 @
549df33b
...
@@ -90,7 +90,7 @@ public class LastReqEntry {
...
@@ -90,7 +90,7 @@ public class LastReqEntry {
public
Object
clone
()
{
public
Object
clone
()
{
LastReqEntry
newEntry
=
new
LastReqEntry
();
LastReqEntry
newEntry
=
new
LastReqEntry
();
newEntry
.
lrType
=
lrType
;
newEntry
.
lrType
=
lrType
;
newEntry
.
lrValue
=
(
KerberosTime
)
lrValue
.
clone
()
;
newEntry
.
lrValue
=
lrValue
;
return
newEntry
;
return
newEntry
;
}
}
}
}
src/share/classes/sun/security/krb5/internal/PAEncTSEnc.java
浏览文件 @
549df33b
...
@@ -65,7 +65,7 @@ public class PAEncTSEnc {
...
@@ -65,7 +65,7 @@ public class PAEncTSEnc {
}
}
public
PAEncTSEnc
()
{
public
PAEncTSEnc
()
{
KerberosTime
now
=
new
KerberosTime
(
KerberosTime
.
NOW
);
KerberosTime
now
=
KerberosTime
.
now
(
);
pATimeStamp
=
now
;
pATimeStamp
=
now
;
pAUSec
=
new
Integer
(
now
.
getMicroSeconds
());
pAUSec
=
new
Integer
(
now
.
getMicroSeconds
());
}
}
...
...
src/share/classes/sun/security/krb5/internal/ccache/Credentials.java
浏览文件 @
549df33b
...
@@ -68,14 +68,11 @@ public class Credentials {
...
@@ -68,14 +68,11 @@ public class Credentials {
sname
=
(
PrincipalName
)
new_sname
.
clone
();
sname
=
(
PrincipalName
)
new_sname
.
clone
();
key
=
(
EncryptionKey
)
new_key
.
clone
();
key
=
(
EncryptionKey
)
new_key
.
clone
();
authtime
=
(
KerberosTime
)
new_authtime
.
clone
();
authtime
=
new_authtime
;
if
(
new_starttime
!=
null
)
{
starttime
=
new_starttime
;
starttime
=
(
KerberosTime
)
new_starttime
.
clone
();
endtime
=
new_endtime
;
}
renewTill
=
new_renewTill
;
endtime
=
(
KerberosTime
)
new_endtime
.
clone
();
if
(
new_renewTill
!=
null
)
{
renewTill
=
(
KerberosTime
)
new_renewTill
.
clone
();
}
if
(
new_caddr
!=
null
)
{
if
(
new_caddr
!=
null
)
{
caddr
=
(
HostAddresses
)
new_caddr
.
clone
();
caddr
=
(
HostAddresses
)
new_caddr
.
clone
();
}
}
...
@@ -104,14 +101,11 @@ public class Credentials {
...
@@ -104,14 +101,11 @@ public class Credentials {
ticket
=
(
Ticket
)
kdcRep
.
ticket
.
clone
();
ticket
=
(
Ticket
)
kdcRep
.
ticket
.
clone
();
key
=
(
EncryptionKey
)
kdcRep
.
encKDCRepPart
.
key
.
clone
();
key
=
(
EncryptionKey
)
kdcRep
.
encKDCRepPart
.
key
.
clone
();
flags
=
(
TicketFlags
)
kdcRep
.
encKDCRepPart
.
flags
.
clone
();
flags
=
(
TicketFlags
)
kdcRep
.
encKDCRepPart
.
flags
.
clone
();
authtime
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
authtime
.
clone
();
authtime
=
kdcRep
.
encKDCRepPart
.
authtime
;
if
(
kdcRep
.
encKDCRepPart
.
starttime
!=
null
)
{
starttime
=
kdcRep
.
encKDCRepPart
.
starttime
;
starttime
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
starttime
.
clone
();
endtime
=
kdcRep
.
encKDCRepPart
.
endtime
;
}
renewTill
=
kdcRep
.
encKDCRepPart
.
renewTill
;
endtime
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
endtime
.
clone
();
if
(
kdcRep
.
encKDCRepPart
.
renewTill
!=
null
)
{
renewTill
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
renewTill
.
clone
();
}
sname
=
(
PrincipalName
)
kdcRep
.
encKDCRepPart
.
sname
.
clone
();
sname
=
(
PrincipalName
)
kdcRep
.
encKDCRepPart
.
sname
.
clone
();
caddr
=
(
HostAddresses
)
kdcRep
.
encKDCRepPart
.
caddr
.
clone
();
caddr
=
(
HostAddresses
)
kdcRep
.
encKDCRepPart
.
caddr
.
clone
();
secondTicket
=
(
Ticket
)
new_secondTicket
.
clone
();
secondTicket
=
(
Ticket
)
new_secondTicket
.
clone
();
...
@@ -128,18 +122,10 @@ public class Credentials {
...
@@ -128,18 +122,10 @@ public class Credentials {
sname
=
(
PrincipalName
)
kdcRep
.
encKDCRepPart
.
sname
.
clone
();
sname
=
(
PrincipalName
)
kdcRep
.
encKDCRepPart
.
sname
.
clone
();
cname
=
(
PrincipalName
)
kdcRep
.
cname
.
clone
();
cname
=
(
PrincipalName
)
kdcRep
.
cname
.
clone
();
key
=
(
EncryptionKey
)
kdcRep
.
encKDCRepPart
.
key
.
clone
();
key
=
(
EncryptionKey
)
kdcRep
.
encKDCRepPart
.
key
.
clone
();
authtime
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
authtime
.
clone
();
authtime
=
kdcRep
.
encKDCRepPart
.
authtime
;
if
(
kdcRep
.
encKDCRepPart
.
starttime
!=
null
)
{
starttime
=
kdcRep
.
encKDCRepPart
.
starttime
;
starttime
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
starttime
.
clone
();
endtime
=
kdcRep
.
encKDCRepPart
.
endtime
;
}
else
{
renewTill
=
kdcRep
.
encKDCRepPart
.
renewTill
;
starttime
=
null
;
}
endtime
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
endtime
.
clone
();
if
(
kdcRep
.
encKDCRepPart
.
renewTill
!=
null
)
{
renewTill
=
(
KerberosTime
)
kdcRep
.
encKDCRepPart
.
renewTill
.
clone
();
}
else
{
renewTill
=
null
;
}
// if (kdcRep.msgType == Krb5.KRB_AS_REP) {
// if (kdcRep.msgType == Krb5.KRB_AS_REP) {
// isEncInSKey = false;
// isEncInSKey = false;
// secondTicket = null;
// secondTicket = null;
...
...
test/sun/security/krb5/MicroTime.java
浏览文件 @
549df33b
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
*/
*/
/*
/*
* @test
* @test
* @bug 6882687
* @bug 6882687
8011124
* @summary KerberosTime too imprecise
* @summary KerberosTime too imprecise
*/
*/
...
@@ -32,11 +32,11 @@ public class MicroTime {
...
@@ -32,11 +32,11 @@ public class MicroTime {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// We count how many different KerberosTime values
// We count how many different KerberosTime values
// can be acquired within one second.
// can be acquired within one second.
KerberosTime
t1
=
new
KerberosTime
(
true
);
KerberosTime
t1
=
KerberosTime
.
now
(
);
KerberosTime
last
=
t1
;
KerberosTime
last
=
t1
;
int
count
=
0
;
int
count
=
0
;
while
(
true
)
{
while
(
true
)
{
KerberosTime
t2
=
new
KerberosTime
(
true
);
KerberosTime
t2
=
KerberosTime
.
now
(
);
if
(
t2
.
getTime
()
-
t1
.
getTime
()
>
1000
)
break
;
if
(
t2
.
getTime
()
-
t1
.
getTime
()
>
1000
)
break
;
if
(!
last
.
equals
(
t2
))
{
if
(!
last
.
equals
(
t2
))
{
last
=
t2
;
last
=
t2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录