pam_get_data() can get data when using in SSHD

Ian jonhson jonhson.ian at gmail.com
Wed Sep 26 05:12:26 UTC 2007


Hi all,

I met a problem when using the pam_set_data()/pam_get_data() to pass
data between PAM hooks. The two functions are ok when I tested my PAM
module with a simple PAM-aware application, in which data  (string
type) can be exchanged between different PAM hooks. However, when I
plug it in SSHD as a authentication module, the pam_get_data() said it
can not get data from a given name, which is used to set data by
pam_set_data().

I don't know what is wrong with PAM module. The simple PAM-aware
application written by me is just a process and one thread, whereas
SSHD  forked several threads. So I guessed maybe the difference
between them is that PAM module is loaded by different SSHD threads.
This makes pam_get_data() in one of thread can not get data from
pam_set_data() of another thread. For example, SSHD forked a thread1
to do authentication, which call the hook in PAM module, and set data
by pam_set_data().  Then another thread, thread2, forked by SSHD wants
to get  that data by pam_get_data() before opening session. Since they
owned different thread spaces, data can be passed from thread1 to
thread2.  I don't know whether my analysis is right. Maybe some one
can share his/her brain with me.

If above analysis is correct, what I can do to deal with it? Could
anybody give me some advices?


Thanks in advances.



Best Regards,

Ian




More information about the Pam-list mailing list