[krbdev.mit.edu #2856] Need a function to clone krb5_context structs for thread safe apps

Ezra Peisach via RT rt-comment at krbdev.mit.edu
Tue Dec 28 07:13:16 EST 2004


[jaltman at columbia.edu - Mon Dec 27 18:58:59 2004]:

> Sam Hartman via RT wrote:
> 
> > It's important to note that applications need not free an object with
> > the same context used to acquire that object.  The only case where
> > this is needed is if the application makes per-context configuration
> > changes.
> 
> I disagree.  The claim has been made in response to ticket 2855 that 
> thread safety is only ensured if no two threads make calls into the
> library using the same context at the same time.  Therefore, there
> must be one instance of the context for each thread.
> 
> If this is not the case, then the problem described in 2855 is in
> fact a thread safety issue.
> 
> 


My original intention with 2855 was to point out a potential race
condition - and the lack of locking.  I do not feel that one needs 
a separate context - unless one wants a different default realm for
each context... Note however, that krb5_parse_principal uses a static
default realm (retreived after krb5_get_default_realm) - which would
make it difficult....


More information about the krb5-bugs mailing list