pam_deny.c revision 90237
1/*-
2 * Copyright 2001 Mark R V Murray
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libpam/modules/pam_deny/pam_deny.c 90237 2002-02-05 08:01:32Z des $");
29
30#include <stddef.h>
31
32#define PAM_SM_AUTH
33#define PAM_SM_ACCOUNT
34#define PAM_SM_SESSION
35#define PAM_SM_PASSWORD
36
37#include <security/pam_appl.h>
38#include <security/pam_modules.h>
39#include <security/pam_mod_misc.h>
40
41PAM_EXTERN int
42pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, int argc, const char **argv)
43{
44	struct options options;
45
46	pam_std_option(&options, NULL, argc, argv);
47
48	PAM_LOG("Options processed");
49
50	PAM_VERBOSE_ERROR("Unconditional deny");
51
52	PAM_RETURN(PAM_AUTH_ERR);
53}
54
55PAM_EXTERN int
56pam_sm_setcred(pam_handle_t *pamh, int flags __unused, int argc, const char **argv)
57{
58	struct options options;
59
60	pam_std_option(&options, NULL, argc, argv);
61
62	PAM_LOG("Options processed");
63
64	PAM_VERBOSE_ERROR("Unconditional deny");
65
66	PAM_RETURN(PAM_CRED_UNAVAIL);
67}
68
69PAM_EXTERN int
70pam_sm_acct_mgmt(pam_handle_t *pamh, int flags __unused, int argc ,const char **argv)
71{
72	struct options options;
73
74	pam_std_option(&options, NULL, argc, argv);
75
76	PAM_LOG("Options processed");
77
78	PAM_VERBOSE_ERROR("Unconditional deny");
79
80	PAM_RETURN(PAM_ACCT_EXPIRED);
81}
82
83PAM_EXTERN int
84pam_sm_chauthtok(pam_handle_t *pamh, int flags __unused, int argc, const char **argv)
85{
86	struct options options;
87
88	pam_std_option(&options, NULL, argc, argv);
89
90	PAM_LOG("Options processed");
91
92	PAM_VERBOSE_ERROR("Unconditional deny");
93
94	PAM_RETURN(PAM_PERM_DENIED);
95}
96
97PAM_EXTERN int
98pam_sm_open_session(pam_handle_t *pamh, int flags __unused, int argc, const char **argv)
99{
100	struct options options;
101
102	pam_std_option(&options, NULL, argc, argv);
103
104	PAM_LOG("Options processed");
105
106	PAM_VERBOSE_ERROR("Unconditional deny");
107
108	PAM_RETURN(PAM_SESSION_ERR);
109}
110
111PAM_EXTERN int
112pam_sm_close_session(pam_handle_t *pamh, int flags __unused, int argc, const char **argv)
113{
114	struct options options;
115
116	pam_std_option(&options, NULL, argc, argv);
117
118	PAM_LOG("Options processed");
119
120	PAM_VERBOSE_ERROR("Unconditional deny");
121
122	PAM_RETURN(PAM_SESSION_ERR);
123}
124
125PAM_MODULE_ENTRY("pam_deny");
126