LinuxQuestions.org
Help answer threads with 0 replies.
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 04-02-2005, 07:52 PM   #1
bob66
LQ Newbie
 
Registered: Jan 2005
Posts: 14

Rep: Reputation: 0
PAM obtain user id


I am writing a file transfer server app that uses PAM modules to authenticates users on our network (NIS). What I need to do is somehow obtain the newly authenicated user's userid. The code is to run on a SunOS.

uname -a
Code:
SunOS gandalf 5.9 Generic_118558-04 sun4u sparc SUNW,Sun-Fire-88

The only thing that I do with PAM, is to make sure that the user has a valid account on the network. Here is some of the relevant code (no need to show the login_conv() function, it just gets the username/pass over a socket)...
Code:
  pam_handle_t *pamh = NULL;
  int retval;
  char *service = "other";

  /* start / authenticate */
  retval = pam_start(service, user, &conv, &pamh);
  if (retval == PAM_SUCCESS) {
    retval = pam_authenticate(pamh, 0);
  } else {
     // failure code
  }

  /* begin processing */
  if (retval == PAM_SUCCESS) {
    processUser();
  } else {
     // failure code
  }

  /* end */
  if (pam_end(pamh, retval) != PAM_SUCCESS) {
    // failure code
  }
I have two questions:
1) Is it possible to obtain a user's id given their username with C?
2) Is it possible for PAM to obtain a user's id once they are authenticated?

I have checked the man pages, and have checked google, but to no avail. Thanks for any help.
 
  


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
HowTo allow a user to call PAM APIs EddyHahn Linux - Security 1 12-07-2004 02:51 AM
Using PAM with FreeBSD? New Linux user please help!! urBan_dK *BSD 7 07-22-2004 02:09 PM
VSFTPD virtual user login using pam.d problem exalik Linux - Networking 3 11-07-2003 05:29 PM
PAM set a no user login policy varoquau Linux - Security 2 10-28-2003 07:37 AM
PAM User Login Authentication Failure robeb Linux - Security 5 11-16-2002 09:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration