From: Ken Raeburn Date: Fri, 6 Nov 2009 20:16:57 +0000 (+0000) Subject: Don't start by attempting to unlink replay caches by guessing X-Git-Tag: krb5-1.8-alpha1~203 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f5660f6db098921809e70a0fe1adc3d568bb195f;p=krb5.git Don't start by attempting to unlink replay caches by guessing pathnames specific to my uid on MIT Athena systems. Instead, create a replay cache object and then destroy it through the library. Tweak the rcache-init-error messages to be specific to the instance that failed. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23138 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/threads/t_rcache.c b/src/tests/threads/t_rcache.c index e3416f23c..f98e43001 100644 --- a/src/tests/threads/t_rcache.c +++ b/src/tests/threads/t_rcache.c @@ -79,7 +79,7 @@ static void try_one (struct tinfo *t) err = krb5_get_server_rcache(ctx, &piece, &my_rcache); if (err) { const char *msg = krb5_get_error_message(ctx, err); - fprintf(stderr, "%s while initializing replay cache\n", msg); + fprintf(stderr, "%s: %s while initializing replay cache\n", prog, msg); krb5_free_error_message(ctx, msg); exit(1); } @@ -125,15 +125,19 @@ int main (int argc, char *argv[]) int interval = 20 /* 5 * 60 */; prog = argv[0]; - unlink("/var/tmp/rc_hello_7882"); - unlink("/var/tmp/hello_7882"); n = 2; err = krb5_init_context(&ctx); if (err) { com_err(prog, err, "initializing context"); return 1; } -#ifdef INIT_ONCE + + /* + * For consistency, run the tests without an existing replay + * cache. Since there isn't a way to ask the library for the + * pathname that would be used for the rcache, we create an rcache + * object and then destroy it. + */ err = krb5_get_server_rcache(ctx, &piece, &rcache); if (err) { const char *msg = krb5_get_error_message(ctx, err); @@ -141,6 +145,25 @@ int main (int argc, char *argv[]) krb5_free_error_message(ctx, msg); return 1; } + err = krb5_rc_destroy(ctx, rcache); + if (err) { + const char *msg = krb5_get_error_message(ctx, err); + fprintf(stderr, "%s: %s while destroying old replay cache\n", + prog, msg); + krb5_free_error_message(ctx, msg); + return 1; + } + rcache = NULL; + +#ifdef INIT_ONCE + err = krb5_get_server_rcache(ctx, &piece, &rcache); + if (err) { + const char *msg = krb5_get_error_message(ctx, err); + fprintf(stderr, "%s: %s while initializing new replay cache\n", + prog, msg); + krb5_free_error_message(ctx, msg); + return 1; + } #endif end_time = time(0) + interval; #undef DIRECT