Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-20-2007, 12:54 PM   #1
LQ Newbie
Registered: Jun 2007
Posts: 11

Rep: Reputation: 0
is Pam Thread Safe???


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:assword){

//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?
Old 07-22-2007, 02:11 AM   #2
LQ Newbie
Registered: Jun 2007
Posts: 11

Original Poster
Rep: Reputation: 0
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
Old 07-22-2007, 06:00 AM   #3
LQ Newbie
Registered: Jun 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Has any one any idea
when I try
pam_set_item(pamh, PAM_AUTHTOK, password);
pam_get_item(pamh, PAM_AUTHTOK, &password);

it gives me error
bad item passed to pam_*_item

Any clues

Old 07-22-2007, 06:15 AM   #4
LQ Newbie
Registered: Jun 2007
Posts: 11

Original Poster
Rep: Reputation: 0
I think pam_set_item(...)
and pam_get_item(....)
can be called only inside a service module
not in api module.
Old 07-24-2007, 10:19 PM   #5
LQ Newbie
Registered: Jun 2007
Posts: 11

Original Poster
Rep: Reputation: 0
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multithreaded RPC Servers for Linux.Thread-safe code writing dba477 Red Hat 1 08-25-2010 01:33 AM
Reentrant and thread-safe code elyk Programming 2 01-05-2007 12:52 AM
LXer: Creating A Safe Directory With PAM And EncFS LXer Syndicated Linux News 0 06-25-2006 04:54 PM
What is thread safe....??? rajsun Programming 5 04-27-2005 12:33 AM
vsftpd + pam + virtual users - Pam cannot load database file. mdkelly069 Linux - Networking 3 09-23-2004 12:07 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration