summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2006-10-06 21:43:02 +0000
committerTom Yu <tlyu@mit.edu>2006-10-06 21:43:02 +0000
commit5e3fcaae24e89348376a7a68593933e7f8b32715 (patch)
tree64c9ee92f52177936d7260bb77be7d0dc5ccae3e /src/lib
parent5ec5db124d20b9b7305bccaf5d2a75b775cce558 (diff)
downloadkrb5-5e3fcaae24e89348376a7a68593933e7f8b32715.tar.gz
krb5-5e3fcaae24e89348376a7a68593933e7f8b32715.tar.xz
krb5-5e3fcaae24e89348376a7a68593933e7f8b32715.zip
* src/lib/krb5/ccache/t_cccursor.c: Bugfixes from Ezra to clean up
memory leaks. ticket: 4389 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18654 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/ccache/t_cccursor.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/lib/krb5/ccache/t_cccursor.c b/src/lib/krb5/ccache/t_cccursor.c
index 8939c6a60..68e615329 100644
--- a/src/lib/krb5/ccache/t_cccursor.c
+++ b/src/lib/krb5/ccache/t_cccursor.c
@@ -84,6 +84,9 @@ krb5_error_code
cr_cache(krb5_context, const char *, const char *);
krb5_error_code
+dest_cache(krb5_context, const char *, const char *);
+
+krb5_error_code
do_chk(krb5_context, struct chklist *, int nmax, int *);
int
@@ -108,7 +111,7 @@ cr_cache(krb5_context context, const char *ccname, const char *pname)
goto errout;
printf("created cache %s with principal %s\n", ccname, pname);
} else
- printf("created cache %s (uninitialized)\n");
+ printf("created cache %s (uninitialized)\n", ccname);
errout:
if (princ != NULL)
krb5_free_principal(context, princ);
@@ -117,6 +120,28 @@ errout:
return ret;
}
+krb5_error_code
+dest_cache(krb5_context context, const char *ccname, const char *pname)
+{
+ krb5_error_code ret;
+ krb5_ccache ccache = NULL;
+
+ ret = krb5_cc_resolve(context, ccname, &ccache);
+ if (ret)
+ goto errout;
+ if (pname != NULL) {
+ ret = krb5_cc_destroy(context, ccache);
+ if (ret)
+ return ret;
+ printf("Destroyed cache %s\n", ccname);
+ } else {
+ printf("Closed cache %s (uninitialized)\n", ccname);
+ ret = krb5_cc_close(context, ccache);
+ }
+errout:
+ return ret;
+}
+
int
do_chk_one(const char *prefix, const char *name, struct chklist *chk)
{
@@ -224,7 +249,13 @@ main(int argc, char *argv[])
if (ret)
goto errout;
+ for (i = 0; i < NCRLIST; i++) {
+ ret = dest_cache(context, crlist[i].ccname, crlist[i].pname);
+ if (ret) goto errout;
+ }
+
errout:
+ krb5_free_context(context);
if (ret) {
com_err("main", ret, "");
exit(1);