xref: /dflybsd-src/lib/libpam/modules/pam_deny/pam_deny.c (revision c98db40744766ab0803912f29557df02814bcd9d)
1242be47eSzrj /*-
2*c98db407SSascha Wildner  * SPDX-License-Identifier: BSD-3-Clause
3*c98db407SSascha Wildner  *
4242be47eSzrj  * Copyright 2001 Mark R V Murray
5242be47eSzrj  * All rights reserved.
6242be47eSzrj  *
7242be47eSzrj  * Redistribution and use in source and binary forms, with or without
8242be47eSzrj  * modification, are permitted provided that the following conditions
9242be47eSzrj  * are met:
10242be47eSzrj  * 1. Redistributions of source code must retain the above copyright
11242be47eSzrj  *    notice, this list of conditions and the following disclaimer.
12242be47eSzrj  * 2. Redistributions in binary form must reproduce the above copyright
13242be47eSzrj  *    notice, this list of conditions and the following disclaimer in the
14242be47eSzrj  *    documentation and/or other materials provided with the distribution.
15242be47eSzrj  *
16242be47eSzrj  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17242be47eSzrj  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18242be47eSzrj  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19242be47eSzrj  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20242be47eSzrj  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21242be47eSzrj  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22242be47eSzrj  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23242be47eSzrj  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24242be47eSzrj  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25242be47eSzrj  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26242be47eSzrj  * SUCH DAMAGE.
27242be47eSzrj  *
28*c98db407SSascha Wildner  * $FreeBSD: head/lib/libpam/modules/pam_deny/pam_deny.c 326219 2017-11-26 02:00:33Z pfg $
29242be47eSzrj  */
30242be47eSzrj 
31242be47eSzrj #include <stddef.h>
32242be47eSzrj 
33242be47eSzrj #define PAM_SM_AUTH
34242be47eSzrj #define PAM_SM_ACCOUNT
35242be47eSzrj #define PAM_SM_SESSION
36242be47eSzrj #define PAM_SM_PASSWORD
37242be47eSzrj 
38242be47eSzrj #include <security/pam_appl.h>
39242be47eSzrj #include <security/pam_modules.h>
40242be47eSzrj 
41242be47eSzrj PAM_EXTERN int
pam_sm_authenticate(pam_handle_t * pamh,int flags __unused,int argc __unused,const char * argv[]__unused)42242be47eSzrj pam_sm_authenticate(pam_handle_t *pamh, int flags __unused,
43242be47eSzrj     int argc __unused, const char *argv[] __unused)
44242be47eSzrj {
45242be47eSzrj 	const char *user;
46242be47eSzrj 	int r;
47242be47eSzrj 
48242be47eSzrj 	if ((r = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS)
49242be47eSzrj 		return (r);
50242be47eSzrj 
51242be47eSzrj 	return (PAM_AUTH_ERR);
52242be47eSzrj }
53242be47eSzrj 
54242be47eSzrj PAM_EXTERN int
pam_sm_setcred(pam_handle_t * pamh __unused,int flags __unused,int argc __unused,const char * argv[]__unused)55242be47eSzrj pam_sm_setcred(pam_handle_t *pamh __unused, int flags __unused,
56242be47eSzrj     int argc __unused, const char *argv[] __unused)
57242be47eSzrj {
58242be47eSzrj 
59242be47eSzrj 	return (PAM_CRED_ERR);
60242be47eSzrj }
61242be47eSzrj 
62242be47eSzrj PAM_EXTERN int
pam_sm_acct_mgmt(pam_handle_t * pamh __unused,int flags __unused,int argc __unused,const char * argv[]__unused)63242be47eSzrj pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused,
64242be47eSzrj     int argc __unused, const char *argv[] __unused)
65242be47eSzrj {
66242be47eSzrj 
67242be47eSzrj 	return (PAM_AUTH_ERR);
68242be47eSzrj }
69242be47eSzrj 
70242be47eSzrj PAM_EXTERN int
pam_sm_chauthtok(pam_handle_t * pamh __unused,int flags __unused,int argc __unused,const char * argv[]__unused)71242be47eSzrj pam_sm_chauthtok(pam_handle_t *pamh __unused, int flags __unused,
72242be47eSzrj     int argc __unused, const char *argv[] __unused)
73242be47eSzrj {
74242be47eSzrj 
75242be47eSzrj 	return (PAM_AUTHTOK_ERR);
76242be47eSzrj }
77242be47eSzrj 
78242be47eSzrj PAM_EXTERN int
pam_sm_open_session(pam_handle_t * pamh __unused,int flags __unused,int argc __unused,const char * argv[]__unused)79242be47eSzrj pam_sm_open_session(pam_handle_t *pamh __unused, int flags __unused,
80242be47eSzrj     int argc __unused, const char *argv[] __unused)
81242be47eSzrj {
82242be47eSzrj 
83242be47eSzrj 	return (PAM_SESSION_ERR);
84242be47eSzrj }
85242be47eSzrj 
86242be47eSzrj PAM_EXTERN int
pam_sm_close_session(pam_handle_t * pamh __unused,int flags __unused,int argc __unused,const char * argv[]__unused)87242be47eSzrj pam_sm_close_session(pam_handle_t *pamh __unused, int flags __unused,
88242be47eSzrj     int argc __unused, const char *argv[] __unused)
89242be47eSzrj {
90242be47eSzrj 
91242be47eSzrj 	return (PAM_SESSION_ERR);
92242be47eSzrj }
93242be47eSzrj 
94242be47eSzrj PAM_MODULE_ENTRY("pam_deny");
95