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

Re: Documentation: pam_[gs]et_item



Sounds like a documentation bug... :(

When I can connect to sourceforge, I'll try and file a bug report for
this.. Feel free to beat me to it.

[BTW. I'd guess that you are not initializing data=NULL before making
this call, so if pam_get_item doesn't alter it, you'ld get random
behavior in the first incarnation of your code.]

Cheers

Andrew

Mike Glover wrote:
> 
>   In the process of coding pam_sql, I was trying to figure out
> how pam_get_item and pam_set_item work. From the docs (on kernel.org)
> it looks like pam_get_item should either return either a pointer
> to my data, or NULL if it couldn't be found.  So I should be able
> to do something like this:
> 
>   retval = pam_get_item (pamh, KEY, &data);
>   if ( ! data ) {
>     ...
>   }
> 
> Alas, when I did this, I wasn't detecting when the data
> wasn't found, and my program segfaulted.  I ended up doing
> this:
> 
>   retval = pam_get_item (pamh, KEY, &data);
>   if ( ( retval != PAM_SUCCESS ) || (! data ) ) {
>     ...
>   }
> 
> This *seems* to work, but the docs aren't very clear on this
> point.  So am I doing it right?
> 
> -mike
> 
> --
> 
> GnuPG key available at http://devel.duluoz.net/pubkey.asc
> Key ID = 1024D/9A256AE5 1999-11-13 Mike Glover <mpg4@duluoz.net>
> Key fingerprint = EF6E 8BCB 4810 E98C F0FD  4596 367A 32B7 9A25 6AE5
> 
> _______________________________________________
> Pam-list mailing list
> Pam-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/pam-list





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