Re: Is it OK to close pam_handle and re-open it?

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

 



On Tue, Jan 06, 2004 at 02:32:28PM -0700, Brent McClure wrote:
> Is it necessary to preserve the same pam_handle across
> multiple calls to the various pam_* functions, or is it
> OK to fetch a new pam_handle by calling pam_start() whenever
> one is needed? Is there some state that is lost by doing
> this? 

> So, for example is the following code actually OK, or would
> the same 'pamh' instance need to be preserved across all of the 
> calls to pam_authenticate, pam_acct_mgmt, etc?

There is definitely state that's lost by doing what you suggest.

-- 
Steve Langasek
postmodern programmer

> func1()
> {
>   pam_handle_t *pamh = 0;
>   pam_start("myapp", 0, &conv, &pamh);
>   pam_authenticate(pamh, 0);
>   pam_end(pamh);
> }
> 
> func2()
> {
>   pam_handle_t *pamh = 0;
>   pam_start("myapp", 0, &conv, &pamh);
>   pam_acct_mgmt(pamh, 0);
>   pam_end(pamh);
> }
> 
> func3()
> {
>   pam_handle_t *pamh = 0;
>   pam_start("myapp", 0, &conv, &pamh);
>   pam_open_session(pamh)
>   pam_end(pamh);
> }

Attachment: pgp00130.pgp
Description: PGP signature


[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux