LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   is Pam Thread Safe??? (https://www.linuxquestions.org/questions/programming-9/is-pam-thread-safe-570959/)

ptobra 07-20-2007 11:54 AM

is Pam Thread Safe???
 
Hi

As we know pam has a conversion function which is defined separately.

static int my_conv(int, struct pam_message **msg, struct pam_response **resp, void *){

// username and passwords are supplied in this segment

}

void pam_authenticate(std:;string username, std::password){

//calling pam_start(.... );
//calling pam_authenticate(... );

//rest stuff
}

If the structure as defined above is hard bound, I can say that it is not thread safe.
How can i make it thread safe. Do we need to provide external locking or pam has support for this??
I could not find much detail in this respect.

Any thoughts.

conversion function also has appdata_ptr pointer. Can we use it to some advantage. I am totally new in the field? :scratch: :study:

ptobra 07-22-2007 01:11 AM

Does any one has good link about PAM where I can get the best stuff.
Writing the Conversation function.
Making PAM thread safe.

Thanks for any help

ptobra 07-22-2007 05:00 AM

Has any one any idea
when I try
pam_set_item(pamh, PAM_AUTHTOK, password);
or
pam_get_item(pamh, PAM_AUTHTOK, &password);

it gives me error
bad item passed to pam_*_item

Any clues

thanks

ptobra 07-22-2007 05:15 AM

I think pam_set_item(...)
and pam_get_item(....)
can be called only inside a service module
not in api module.

ptobra 07-24-2007 09:19 PM

I have my PAM application
When I test it on linux, it says "auth failed" when
user:root , password:rootpasswd, service: login
it works when
user:root , password:rootpasswd, service: passwd
again when I perform the same steps with a normaluser dam it works when
user: dam , password: dampasswd, service: login
and not works when
user: root, password: rootpasswd, service: passwd ( correct coz dam cannot access root)

but in solaris only root is gives me the result and fails when any other user tries to test pam

Is the default, authentication modules define local authentication in solaris and linux this way.

Any ideas


All times are GMT -5. The time now is 04:22 PM.