1 /* pam_permit module */
4 * $Id: pam_permit.c,v 1.5 1997/02/15 19:03:15 morgan Exp $
5 * $FreeBSD: src/contrib/libpam/modules/pam_permit/pam_permit.c,v 1.3.4.2 2001/06/11 15:28:23 markm Exp $
6 * $DragonFly: src/contrib/libpam/modules/pam_permit/Attic/pam_permit.c,v 1.2 2003/06/17 04:24:03 dillon Exp $
8 * Written by Andrew Morgan <morgan@parc.power.net> 1996/3/11
10 * $Log: pam_permit.c,v $
11 * Revision 1.5 1997/02/15 19:03:15 morgan
14 * Revision 1.4 1997/02/15 16:03:10 morgan
15 * force a name for user
17 * Revision 1.3 1996/06/02 08:10:14 morgan
18 * updated for new static protocol
22 #define DEFAULT_USER "nobody"
27 * here, we make definitions for the externally accessible functions
28 * in this file (these definitions are required for static modules
29 * but strongly encouraged generally) they are used to instruct the
30 * modules include file to define their prototypes.
34 #define PAM_SM_ACCOUNT
35 #define PAM_SM_SESSION
36 #define PAM_SM_PASSWORD
38 #include <security/pam_modules.h>
39 #include <security/_pam_macros.h>
41 /* --- authentication management functions --- */
44 int pam_sm_authenticate(pam_handle_t *pamh,int flags,int argc
48 const char *user=NULL;
51 * authentication requires we know who the user wants to be
53 retval = pam_get_user(pamh, &user, NULL);
54 if (retval != PAM_SUCCESS) {
55 D(("get user returned error: %s", pam_strerror(pamh,retval)));
58 if (user == NULL || *user == '\0') {
59 D(("username not known"));
60 pam_set_item(pamh, PAM_USER, (const void *) DEFAULT_USER);
62 user = NULL; /* clean up */
68 int pam_sm_setcred(pam_handle_t *pamh,int flags,int argc
74 /* --- account management functions --- */
77 int pam_sm_acct_mgmt(pam_handle_t *pamh,int flags,int argc
83 /* --- password management --- */
86 int pam_sm_chauthtok(pam_handle_t *pamh,int flags,int argc
92 /* --- session management --- */
95 int pam_sm_open_session(pam_handle_t *pamh,int flags,int argc
102 int pam_sm_close_session(pam_handle_t *pamh,int flags,int argc
108 /* end of module definition */
110 PAM_MODULE_ENTRY("pam_permit");