krb5_context in a threaded process - Kerberos

This is a discussion on krb5_context in a threaded process - Kerberos ; I need to initialize multiple krb5_context's in a multi-threaded program and each context *must* be initialized from a different config file. krb5_init_context() seems to read config from /etc/krb5.conf or the file pointed to by KRB5_CONFIG. Setting the environment variable will ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: krb5_context in a threaded process

  1. krb5_context in a threaded process

    I need to initialize multiple krb5_context's in a multi-threaded
    program
    and each context *must* be initialized from a different config file.

    krb5_init_context() seems to read config from /etc/krb5.conf or the
    file
    pointed to by KRB5_CONFIG. Setting the environment variable will not
    work since
    "env"is for the process, not the thread.

    I was wondering if there is a better way to do this, other than
    creating a mutex
    to set/get the KRB5_CONFIG env variable before each krb5_init_context.

    thanks
    R.K

  2. Re: krb5_context in a threaded process

    On Tue, Jul 8, 2008 at 11:25 AM, wrote:
    > I need to initialize multiple krb5_context's in a multi-threaded
    > program
    > and each context *must* be initialized from a different config file.
    >
    > krb5_init_context() seems to read config from /etc/krb5.conf or the
    > file
    > pointed to by KRB5_CONFIG. Setting the environment variable will not
    > work since
    > "env"is for the process, not the thread.
    >
    > I was wondering if there is a better way to do this, other than
    > creating a mutex
    > to set/get the KRB5_CONFIG env variable before each krb5_init_context.


    Not really.

    What I did was add a krb5_config_set function to allow setting
    individual properties and then change the default krb5.conf location
    to an empty file.

    I believe Heimdal has such functions (although I don't know if the
    work was fully completed due to memory management issues). I don't
    know if MIT has such functions.

    Mike

    --
    Michael B Allen
    PHP Active Directory SPNEGO SSO
    http://www.ioplex.com/

  3. Re: krb5_context in a threaded process

    On Jul 8, 2008, at 11:25, aditham@yahoo.com wrote:
    > I need to initialize multiple krb5_context's in a multi-threaded
    > program
    > and each context *must* be initialized from a different config file.
    >
    > krb5_init_context() seems to read config from /etc/krb5.conf or the
    > file
    > pointed to by KRB5_CONFIG. Setting the environment variable will not
    > work since
    > "env"is for the process, not the thread.
    >
    > I was wondering if there is a better way to do this, other than
    > creating a mutex
    > to set/get the KRB5_CONFIG env variable before each krb5_init_context.


    Unfortunately, no, at the moment that's the best way. (Or use
    multiple processes.)

    I'd actually thought about implementing an interface to take the extra
    input argument, because it would clean up how some of the KDC
    initialization works right now (which uses a private variant of
    krb5_init_context that only differs in that it adds the kdc.conf file
    to the normal list of config files). Do you want to propose and
    implement something along those lines? The krbdev@mit list would be
    the place for that discussion....

    Ken

+ Reply to Thread