xref: /dflybsd-src/lib/libpam/modules/pam_deny/pam_deny.c (revision 242be47e2206d44451f1e1b27f7966e08c0620c8)
1*242be47eSzrj /*-
2*242be47eSzrj  * Copyright 2001 Mark R V Murray
3*242be47eSzrj  * All rights reserved.
4*242be47eSzrj  *
5*242be47eSzrj  * Redistribution and use in source and binary forms, with or without
6*242be47eSzrj  * modification, are permitted provided that the following conditions
7*242be47eSzrj  * are met:
8*242be47eSzrj  * 1. Redistributions of source code must retain the above copyright
9*242be47eSzrj  *    notice, this list of conditions and the following disclaimer.
10*242be47eSzrj  * 2. Redistributions in binary form must reproduce the above copyright
11*242be47eSzrj  *    notice, this list of conditions and the following disclaimer in the
12*242be47eSzrj  *    documentation and/or other materials provided with the distribution.
13*242be47eSzrj  *
14*242be47eSzrj  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*242be47eSzrj  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*242be47eSzrj  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*242be47eSzrj  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*242be47eSzrj  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*242be47eSzrj  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*242be47eSzrj  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*242be47eSzrj  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*242be47eSzrj  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*242be47eSzrj  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*242be47eSzrj  * SUCH DAMAGE.
25*242be47eSzrj  *
26*242be47eSzrj  * $FreeBSD: src/lib/libpam/modules/pam_deny/pam_deny.c,v 1.10 2005/06/10 06:16:13 des Exp $
27*242be47eSzrj  * $DragonFly: src/lib/pam_module/pam_deny/pam_deny.c,v 1.1 2005/08/01 16:15:19 joerg Exp $
28*242be47eSzrj  */
29*242be47eSzrj 
30*242be47eSzrj #include <stddef.h>
31*242be47eSzrj 
32*242be47eSzrj #define PAM_SM_AUTH
33*242be47eSzrj #define PAM_SM_ACCOUNT
34*242be47eSzrj #define PAM_SM_SESSION
35*242be47eSzrj #define PAM_SM_PASSWORD
36*242be47eSzrj 
37*242be47eSzrj #include <security/pam_appl.h>
38*242be47eSzrj #include <security/pam_modules.h>
39*242be47eSzrj 
40*242be47eSzrj PAM_EXTERN int
41*242be47eSzrj pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
42*242be47eSzrj     int argc __unused, const char *argv[] __unused)
43*242be47eSzrj {
44*242be47eSzrj 	const char *user;
45*242be47eSzrj 	int r;
46*242be47eSzrj 
47*242be47eSzrj 	if ((r = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS)
48*242be47eSzrj 		return (r);
49*242be47eSzrj 
50*242be47eSzrj 	return (PAM_AUTH_ERR);
51*242be47eSzrj }
52*242be47eSzrj 
53*242be47eSzrj PAM_EXTERN int
54*242be47eSzrj pam_sm_setcred(pam_handle_t *pamh __unused, int flags __unused,
55*242be47eSzrj     int argc __unused, const char *argv[] __unused)
56*242be47eSzrj {
57*242be47eSzrj 
58*242be47eSzrj 	return (PAM_CRED_ERR);
59*242be47eSzrj }
60*242be47eSzrj 
61*242be47eSzrj PAM_EXTERN int
62*242be47eSzrj pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused,
63*242be47eSzrj     int argc __unused, const char *argv[] __unused)
64*242be47eSzrj {
65*242be47eSzrj 
66*242be47eSzrj 	return (PAM_AUTH_ERR);
67*242be47eSzrj }
68*242be47eSzrj 
69*242be47eSzrj PAM_EXTERN int
70*242be47eSzrj pam_sm_chauthtok(pam_handle_t *pamh __unused, int flags __unused,
71*242be47eSzrj     int argc __unused, const char *argv[] __unused)
72*242be47eSzrj {
73*242be47eSzrj 
74*242be47eSzrj 	return (PAM_AUTHTOK_ERR);
75*242be47eSzrj }
76*242be47eSzrj 
77*242be47eSzrj PAM_EXTERN int
78*242be47eSzrj pam_sm_open_session(pam_handle_t *pamh __unused, int flags __unused,
79*242be47eSzrj     int argc __unused, const char *argv[] __unused)
80*242be47eSzrj {
81*242be47eSzrj 
82*242be47eSzrj 	return (PAM_SESSION_ERR);
83*242be47eSzrj }
84*242be47eSzrj 
85*242be47eSzrj PAM_EXTERN int
86*242be47eSzrj pam_sm_close_session(pam_handle_t *pamh __unused, int flags __unused,
87*242be47eSzrj     int argc __unused, const char *argv[] __unused)
88*242be47eSzrj {
89*242be47eSzrj 
90*242be47eSzrj 	return (PAM_SESSION_ERR);
91*242be47eSzrj }
92*242be47eSzrj 
93*242be47eSzrj PAM_MODULE_ENTRY("pam_deny");
94