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