LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 07-20-2007, 11:54 AM   #1
ptobra
LQ Newbie
 
Registered: Jun 2007
Posts: 11

Rep: Reputation: 0
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: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, 01:11 AM   #2
ptobra
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, 05:00 AM   #3
ptobra
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);
or
pam_get_item(pamh, PAM_AUTHTOK, &password);

it gives me error
bad item passed to pam_*_item

Any clues

thanks
 
Old 07-22-2007, 05:15 AM   #4
ptobra
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, 09:19 PM   #5
ptobra
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
 
  


Reply


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 12:33 AM
Reentrant and thread-safe code elyk Programming 2 01-04-2007 11:52 PM
LXer: Creating A Safe Directory With PAM And EncFS LXer Syndicated Linux News 0 06-25-2006 03:54 PM
What is thread safe....??? rajsun Programming 5 04-26-2005 11:33 PM
vsftpd + pam + virtual users - Pam cannot load database file. mdkelly069 Linux - Networking 3 09-22-2004 11:07 PM


All times are GMT -5. The time now is 11:11 AM.

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