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