diff options
author | assar <assar@FreeBSD.org> | 2001-02-13 16:46:19 +0000 |
---|---|---|
committer | assar <assar@FreeBSD.org> | 2001-02-13 16:46:19 +0000 |
commit | ebfe6dc471c206300fd82c7c0fd145f683aa52f6 (patch) | |
tree | e66aa570ad1d12c43b32a7313b0f8e28971bf8a9 /crypto/heimdal/admin/purge.c | |
parent | e5f617598c2db0dd51906a38ecea9208123a8b70 (diff) | |
download | FreeBSD-src-ebfe6dc471c206300fd82c7c0fd145f683aa52f6.zip FreeBSD-src-ebfe6dc471c206300fd82c7c0fd145f683aa52f6.tar.gz |
import of heimdal 0.3e
Diffstat (limited to 'crypto/heimdal/admin/purge.c')
-rw-r--r-- | crypto/heimdal/admin/purge.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/crypto/heimdal/admin/purge.c b/crypto/heimdal/admin/purge.c index 3e262c5..5e22de5 100644 --- a/crypto/heimdal/admin/purge.c +++ b/crypto/heimdal/admin/purge.c @@ -33,7 +33,7 @@ #include "ktutil_locl.h" -RCSID("$Id: purge.c,v 1.1 2000/01/02 05:06:50 assar Exp $"); +RCSID("$Id: purge.c,v 1.3 2000/06/29 08:31:47 joda Exp $"); /* * keep track of the highest version for every principal. @@ -101,9 +101,10 @@ kt_purge(int argc, char **argv) krb5_kt_cursor cursor; krb5_keytab_entry entry; int help_flag = 0; - int age = 7 * 24 * 60 * 60; + char *age_str = "1 week"; + int age; struct getargs args[] = { - { "age", 0, arg_integer, NULL, "age to retire" }, + { "age", 0, arg_string, NULL, "age to retire" }, { "help", 'h', arg_flag, NULL } }; int num_args = sizeof(args) / sizeof(args[0]); @@ -112,7 +113,7 @@ kt_purge(int argc, char **argv) struct e *head = NULL; time_t judgement_day; - args[i++].value = &age; + args[i++].value = &age_str; args[i++].value = &help_flag; if(getarg(args, num_args, argc, argv, &optind)) { @@ -124,9 +125,15 @@ kt_purge(int argc, char **argv) return 0; } + age = parse_time(age_str, "s"); + if(age < 0) { + krb5_warnx(context, "unparasable time `%s'", age_str); + return 0; + } + ret = krb5_kt_start_seq_get(context, keytab, &cursor); if(ret){ - krb5_warn(context, ret, "krb5_kt_start_seq_get"); + krb5_warn(context, ret, "krb5_kt_start_seq_get %s", keytab_string); return 1; } @@ -140,7 +147,7 @@ kt_purge(int argc, char **argv) ret = krb5_kt_start_seq_get(context, keytab, &cursor); if(ret){ - krb5_warn(context, ret, "krb5_kt_start_seq_get"); + krb5_warn(context, ret, "krb5_kt_start_seq_get, %s", keytab_string); return 1; } |