diff options
author | Tom Yu <tlyu@mit.edu> | 2000-10-07 02:25:24 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2000-10-07 02:25:24 +0000 |
commit | eecc72999417642f6654222a49ddc9f3d1bbf13b (patch) | |
tree | 9354a92d8d665d7a560dc5a5508518fec37ec676 /src/krb524/conv_creds.c | |
parent | 9d4ad67452d9c6ad464ef337c5a025b3440dd93d (diff) | |
download | krb5-eecc72999417642f6654222a49ddc9f3d1bbf13b.tar.gz krb5-eecc72999417642f6654222a49ddc9f3d1bbf13b.tar.xz krb5-eecc72999417642f6654222a49ddc9f3d1bbf13b.zip |
* conv_creds.c (krb524_convert_creds_plain): Use time_to_life()
and life_to_time() to do lifetime calculations, including the
adjustment of start time, to match server-side calculations.
* cnv_tkt_skey.c (krb524_convert_tkt_skey): Use time_to_life() and
life_to_time() to do lifetime calculations. Adjust start time
backwards to deal with roundup so ticket expires at correct time.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12728 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/krb524/conv_creds.c')
-rw-r--r-- | src/krb524/conv_creds.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/krb524/conv_creds.c b/src/krb524/conv_creds.c index 68a80200f..2d031ea57 100644 --- a/src/krb524/conv_creds.c +++ b/src/krb524/conv_creds.c @@ -127,7 +127,7 @@ krb524_convert_creds_plain(context, v5creds, v4creds) krb5_ui_4 addr; #endif int ret; - krb5_timestamp lifetime; + krb5_timestamp endtime; memset((char *) v4creds, 0, sizeof(CREDENTIALS)); @@ -150,12 +150,17 @@ krb524_convert_creds_plain(context, v5creds, v4creds) sizeof(C_Block)); /* V4 has no concept of authtime or renew_till, so ignore them */ - /* V4 lifetime is 1 byte, in 5 minute increments */ - lifetime = - ((v5creds->times.endtime - v5creds->times.starttime) / 300); - v4creds->lifetime = - ((lifetime > 0xff) ? 0xff : lifetime); v4creds->issue_date = v5creds->times.starttime; + v4creds->lifetime = krb_time_to_life(v5creds->times.starttime, + v5creds->times.endtime); + endtime = krb_life_to_time(v5creds->times.starttime, + v4creds->lifetime); + /* + * Adjust start time backwards to deal with rounding up in + * krb_time_to_life(), to match code on server side. + */ + if (endtime > v5creds->times.endtime) + v4creds->issue_date -= endtime - v5creds->times.endtime; #if 0 /* XXX perhaps we should use the addr of the client host if */ |