svn rev #23138: trunk/src/tests/threads/

raeburn@MIT.EDU raeburn at MIT.EDU
Fri Nov 6 15:16:57 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=23138
Commit By: raeburn
Log Message:
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.


Changed Files:
U   trunk/src/tests/threads/t_rcache.c
Modified: trunk/src/tests/threads/t_rcache.c
===================================================================
--- trunk/src/tests/threads/t_rcache.c	2009-11-06 20:16:53 UTC (rev 23137)
+++ trunk/src/tests/threads/t_rcache.c	2009-11-06 20:16:57 UTC (rev 23138)
@@ -79,7 +79,7 @@
     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 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 @@
 	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




More information about the cvs-krb5 mailing list