From b9337ce46724c7d1bbc2f214f4d829ed758e08f3 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 21 Jun 2002 19:31:55 +0000 Subject: [PATCH] * ccache.c (printtime): Do not assume that krb5_timestamp and time_t are the same size as an argument to localtime. * heuristic.c (get_authorized_princ_names): If .k5login file exists but is not owned by the user, do not attempt to fclose an uninitialized FILE *. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14556 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/ksu/ChangeLog | 9 +++++++++ src/clients/ksu/ccache.c | 8 +++++--- src/clients/ksu/heuristic.c | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/clients/ksu/ChangeLog b/src/clients/ksu/ChangeLog index 57fc7fd26..d905da262 100644 --- a/src/clients/ksu/ChangeLog +++ b/src/clients/ksu/ChangeLog @@ -1,3 +1,12 @@ +2002-06-21 Ezra Peisach + + * ccache.c (printtime): Do not assume that krb5_timestamp and + time_t are the same size as an argument to localtime. + + * heuristic.c (get_authorized_princ_names): If .k5login file + exists but is not owned by the user, do not attempt to fclose an + uninitialized FILE *. + 2001-10-30 Ezra Peisach * main.c (main): Do not pass LOG_AUTH facility into openlog() as a diff --git a/src/clients/ksu/ccache.c b/src/clients/ksu/ccache.c index 62d76aa87..5e9c5ec51 100644 --- a/src/clients/ksu/ccache.c +++ b/src/clients/ksu/ccache.c @@ -346,13 +346,15 @@ char *flags_string(cred) void printtime(tv) time_t tv; { - struct tm *kstime; char fmtbuf[18]; char fill; + krb5_timestamp tstamp; - kstime = localtime((time_t *)&tv); + /* XXXX ASSUMES sizeof(krb5_timestamp) >= sizeof(time_t) */ + (void) localtime((time_t *)&tv); + tstamp = tv; fill = ' '; - if (!krb5_timestamp_to_sfstring((krb5_timestamp) tv, + if (!krb5_timestamp_to_sfstring(tstamp, fmtbuf, sizeof(fmtbuf), &fill)) diff --git a/src/clients/ksu/heuristic.c b/src/clients/ksu/heuristic.c index c17496bf4..a17ef2845 100644 --- a/src/clients/ksu/heuristic.c +++ b/src/clients/ksu/heuristic.c @@ -224,7 +224,8 @@ get_authorized_princ_names(luser, cmd, princ_list) if ((login_fp = fopen(k5login_path, "r")) == NULL) return 0; if ( fowner(login_fp, pwd->pw_uid) == FALSE){ - close_time(k5users_flag,users_fp, k5login_flag,login_fp); + close_time(1 /*k5users_flag*/, (FILE *) 0 /*users_fp*/, + k5login_flag,login_fp); return 0; } } -- 2.26.2