xref: /titanic_51/usr/src/lib/pam_modules/allow/allow.c (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1*bdfc6d18Sgww /*
2*bdfc6d18Sgww  * CDDL HEADER START
3*bdfc6d18Sgww  *
4*bdfc6d18Sgww  * The contents of this file are subject to the terms of the
5*bdfc6d18Sgww  * Common Development and Distribution License, Version 1.0 only
6*bdfc6d18Sgww  * (the "License").  You may not use this file except in compliance
7*bdfc6d18Sgww  * with the License.
8*bdfc6d18Sgww  *
9*bdfc6d18Sgww  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*bdfc6d18Sgww  * or http://www.opensolaris.org/os/licensing.
11*bdfc6d18Sgww  * See the License for the specific language governing permissions
12*bdfc6d18Sgww  * and limitations under the License.
13*bdfc6d18Sgww  *
14*bdfc6d18Sgww  * When distributing Covered Code, include this CDDL HEADER in each
15*bdfc6d18Sgww  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*bdfc6d18Sgww  * If applicable, add the following below this CDDL HEADER, with the
17*bdfc6d18Sgww  * fields enclosed by brackets "[]" replaced with your own identifying
18*bdfc6d18Sgww  * information: Portions Copyright [yyyy] [name of copyright owner]
19*bdfc6d18Sgww  *
20*bdfc6d18Sgww  * CDDL HEADER END
21*bdfc6d18Sgww  */
22*bdfc6d18Sgww /*
23*bdfc6d18Sgww  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*bdfc6d18Sgww  * Use is subject to license terms.
25*bdfc6d18Sgww  */
26*bdfc6d18Sgww 
27*bdfc6d18Sgww #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*bdfc6d18Sgww 
29*bdfc6d18Sgww #include <strings.h>
30*bdfc6d18Sgww #include <syslog.h>
31*bdfc6d18Sgww 
32*bdfc6d18Sgww #include <security/pam_appl.h>
33*bdfc6d18Sgww #include <security/pam_modules.h>
34*bdfc6d18Sgww 
35*bdfc6d18Sgww /*
36*bdfc6d18Sgww  * pam_allow - PAM service module that returns PAM_SUCCESS all service
37*bdfc6d18Sgww  *		module types.
38*bdfc6d18Sgww  *
39*bdfc6d18Sgww  *	Entry	argv = debug, syslog call LOG_AUTH | LOG_DEBUG.
40*bdfc6d18Sgww  *
41*bdfc6d18Sgww  *	Exit	PAM_SUCCESS
42*bdfc6d18Sgww  *
43*bdfc6d18Sgww  *	Uses	PAM_USER, PAM_SERVICE
44*bdfc6d18Sgww  */
45*bdfc6d18Sgww 
46*bdfc6d18Sgww static void
47*bdfc6d18Sgww debug(pam_handle_t *pamh, int flags, int argc, const char **argv, char *mod)
48*bdfc6d18Sgww {
49*bdfc6d18Sgww 	char *user = NULL;
50*bdfc6d18Sgww 	char *service = NULL;
51*bdfc6d18Sgww 
52*bdfc6d18Sgww 	if (argc < 1 || strcmp(argv[0], "debug") != 0)
53*bdfc6d18Sgww 		return;
54*bdfc6d18Sgww 
55*bdfc6d18Sgww 	(void) pam_get_item(pamh, PAM_SERVICE, (void **)&service);
56*bdfc6d18Sgww 	(void) pam_get_item(pamh, PAM_USER, (void **)&user);
57*bdfc6d18Sgww 
58*bdfc6d18Sgww 	syslog(LOG_AUTH | LOG_DEBUG, "%s pam_allow:%s(%x) for %s",
59*bdfc6d18Sgww 	    service ? service : "No Service Specified", mod, flags,
60*bdfc6d18Sgww 	    user ? user : "No User Specified");
61*bdfc6d18Sgww }
62*bdfc6d18Sgww 
63*bdfc6d18Sgww int
64*bdfc6d18Sgww pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv)
65*bdfc6d18Sgww {
66*bdfc6d18Sgww 	debug(pamh, flags, argc, argv, "pam_sm_authenticate");
67*bdfc6d18Sgww 	return (PAM_SUCCESS);
68*bdfc6d18Sgww }
69*bdfc6d18Sgww 
70*bdfc6d18Sgww int
71*bdfc6d18Sgww pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv)
72*bdfc6d18Sgww {
73*bdfc6d18Sgww 	debug(pamh, flags, argc, argv, "pam_sm_setcred");
74*bdfc6d18Sgww 	return (PAM_SUCCESS);
75*bdfc6d18Sgww }
76*bdfc6d18Sgww 
77*bdfc6d18Sgww int
78*bdfc6d18Sgww pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv)
79*bdfc6d18Sgww {
80*bdfc6d18Sgww 	debug(pamh, flags, argc, argv, "pam_sm_acct_mgmt");
81*bdfc6d18Sgww 	return (PAM_SUCCESS);
82*bdfc6d18Sgww }
83*bdfc6d18Sgww 
84*bdfc6d18Sgww int
85*bdfc6d18Sgww pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv)
86*bdfc6d18Sgww {
87*bdfc6d18Sgww 	debug(pamh, flags, argc, argv, "pam_sm_open_session");
88*bdfc6d18Sgww 	return (PAM_SUCCESS);
89*bdfc6d18Sgww }
90*bdfc6d18Sgww 
91*bdfc6d18Sgww int
92*bdfc6d18Sgww pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv)
93*bdfc6d18Sgww {
94*bdfc6d18Sgww 	debug(pamh, flags, argc, argv, "pam_sm_close_session");
95*bdfc6d18Sgww 	return (PAM_SUCCESS);
96*bdfc6d18Sgww }
97*bdfc6d18Sgww 
98*bdfc6d18Sgww int
99*bdfc6d18Sgww pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc, const char **argv)
100*bdfc6d18Sgww {
101*bdfc6d18Sgww 	debug(pamh, flags, argc, argv, "pam_sm_chauthtok");
102*bdfc6d18Sgww 	return (PAM_SUCCESS);
103*bdfc6d18Sgww }
104