Changeset 5 in openpam


Ignore:
Timestamp:
Feb 1, 2002, 8:15:51 PM (17 years ago)
Author:
Dag-Erling Smørgrav
Message:

Implement pam_get_user(3).

Sponsored by: DARPA, NAI Labs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/pam_get_user.c

    r1 r5  
    3535 */
    3636
     37#include <sys/param.h>
     38
    3739#include <security/pam_appl.h>
     40
     41#include "openpam.h"
    3842
    3943/*
     
    4953        const char *prompt)
    5054{
     55        int r;
     56       
     57        if (pamh == NULL || user == NULL)
     58                return (PAM_SYSTEM_ERR);
    5159
    52         return (PAM_SYSTEM_ERR);
     60        if ((r = pam_get_item(pamh, PAM_USER, (void **)user)) == PAM_SUCCESS)
     61                return (PAM_SUCCESS);
     62        if (prompt == NULL)
     63                pam_get_item(pamh, PAM_USER_PROMPT, (void **)&prompt);
     64        if (prompt == NULL)
     65                prompt = "Login: ";
     66        if ((r = pam_prompt(pamh, user, 0, "%s", prompt)) != PAM_SUCCESS)
     67                return (r);
     68        return (pam_set_item(pamh, PAM_USER, *user));
    5369}
Note: See TracChangeset for help on using the changeset viewer.