[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with lifetime of krb5_ccache's...



Wynn Wilkes <wynnw@caldera.com> writes:

> I've had a problem with krb5_ccache structs becoming invalid if they
> are used after the context struct they were created with gets freed.

You should not do anything after freeing the context.

> I hit this problem when dealing with pam modules- if you store a
> memory cache between pam calls you have problems if you try to copy
> that memory cache to a file one later.

If you didn't free the cache, it should still exist, and you should be
able to resolve to it later (with new context). That is, this should
work:

krb5_init_context(&context);
krb5_cc_resolve(context, &id, "MEMORY:foo");
krb5_cc_initialize(context, id, principal);
...
krb5_cc_close(context, id);
krb5_free_context(&context);
krb5_cc_resolve(context, &id, "MEMORY:foo");

/Johan