diff options
author | Theodore Tso <tytso@mit.edu> | 1998-05-09 03:19:46 +0000 |
---|---|---|
committer | Theodore Tso <tytso@mit.edu> | 1998-05-09 03:19:46 +0000 |
commit | 7dc329563673ca549c1d49460faf4925e2ccec47 (patch) | |
tree | 372f2e1f9a1f246e40b94da758870cc57b1914d0 /src/lib/krb5/krb/t_kerb.c | |
parent | acd6905057e98ed0e7842bbf2a98c9ea9fe7902a (diff) | |
download | krb5-7dc329563673ca549c1d49460faf4925e2ccec47.zip krb5-7dc329563673ca549c1d49460faf4925e2ccec47.tar.gz krb5-7dc329563673ca549c1d49460faf4925e2ccec47.tar.bz2 |
str_conv.c (krb5_string_to_timestamp, strptime): Fix routines to be
able to properly parse Y2K dates.
t_kerb.c: Add ability to test krb5_string_to_timestamp
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10559 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/t_kerb.c')
-rw-r--r-- | src/lib/krb5/krb/t_kerb.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/krb5/krb/t_kerb.c b/src/lib/krb5/krb/t_kerb.c index 45c5e2e..2feef39 100644 --- a/src/lib/krb5/krb/t_kerb.c +++ b/src/lib/krb5/krb/t_kerb.c @@ -7,6 +7,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <time.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> @@ -14,6 +15,22 @@ #include "com_err.h" +void test_string_to_timestamp(ctx, time) + krb5_context ctx; + char *time; +{ + krb5_timestamp timestamp; + time_t t; + krb5_error_code retval; + + retval = krb5_string_to_timestamp(time, ×tamp); + if (retval) { + com_err("krb5_string_to_timestamp", retval, 0); + return; + } + t = (time_t) timestamp; + printf("Parsed time was %s", ctime(&t)); +} void test_425_conv_principal(ctx, name, inst, realm) krb5_context ctx; @@ -116,6 +133,7 @@ void usage(progname) progname, progname); fprintf(stderr, "\t%s parse_name <name>\n", progname); fprintf(stderr, "\t%s set_realm <name> <realm>\n", progname); + fprintf(stderr, "\t%s string_to_timestamp <time>\n", progname); exit(1); } @@ -164,6 +182,10 @@ main(argc, argv) if (!argc) usage(progname); realm = *argv; test_set_realm(ctx, name, realm); + } else if (strcmp(*argv, "string_to_timestamp") == 0) { + argc--; argv++; + if (!argc) usage(progname); + test_string_to_timestamp(ctx, *argv); } else usage(progname); |