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

Documentation: pam_[gs]et_item



  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






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