4 * This is the single file that will be compiled for pam_unix.
5 * it includes each of the modules that have beed defined in the .-c
6 * files in this directory.
8 * It is a little ugly to do it this way, but it is a simple way of
9 * defining static functions only once, and yet keeping the separate
10 * files modular. If you can think of something better, please email
11 * Andrew Morgan <morgan@linux.kernel.org>
13 * See the end of this file for Copyright information.
16 static const char rcsid[] =
18 " - PWDB Pluggable Authentication module. <morgan@linux.kernel.org>"
23 #include <security/_pam_aconf.h>
25 #include <sys/types.h>
32 #include <time.h> /* for time() */
39 #include <pwdb/pwdb_public.h>
41 /* indicate the following groups are defined */
44 #define PAM_SM_ACCOUNT
45 #define PAM_SM_SESSION
46 #define PAM_SM_PASSWORD
48 #include <security/_pam_macros.h>
49 #include <security/pam_modules.h>
52 #include <security/pam_appl.h>
53 #endif /* LINUX_PAM */
55 #include "./support.-c"
58 * PAM framework looks for these entry-points to pass control to the
59 * authentication module.
62 #include "./pam_unix_auth.-c"
64 PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags
65 , int argc, const char **argv)
73 ctrl = set_ctrl(flags, argc, argv);
74 retval = _unix_auth( pamh, ctrl );
77 if ( on(UNIX_LIKE_AUTH, ctrl) ) {
78 D(("recording return code for next time [%d]", retval));
79 pam_set_data(pamh, "pwdb_setcred_return", (void *) retval, NULL);
82 D(("done. [%s]", pam_strerror(pamh, retval)));
87 PAM_EXTERN int pam_sm_setcred(pam_handle_t *pamh, int flags
88 , int argc, const char **argv)
96 ctrl = set_ctrl(flags, argc, argv);
97 retval = _unix_set_credentials(pamh, ctrl);
100 if ( on(UNIX_LIKE_AUTH, ctrl) ) {
101 int *pretval = &retval;
103 D(("recovering return code from auth call"));
104 pam_get_data(pamh, "pwdb_setcred_return", (const void **) pretval);
105 D(("recovered data indicates that old retval was %d", retval));
112 * PAM framework looks for these entry-points to pass control to the
113 * account management module.
116 #include "./pam_unix_acct.-c"
118 PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
119 int argc, const char **argv)
127 ctrl = set_ctrl(flags, argc, argv);
128 retval = _unix_acct_mgmt(pamh, ctrl);
137 * PAM framework looks for these entry-points to pass control to the
141 #include "./pam_unix_sess.-c"
143 PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags,
144 int argc, const char **argv)
152 ctrl = set_ctrl(flags, argc, argv);
153 retval = _unix_open_session(pamh, ctrl);
159 PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags,
160 int argc, const char **argv)
168 ctrl = set_ctrl(flags, argc, argv);
169 retval = _unix_close_session(pamh, ctrl);
176 * PAM framework looks for these entry-points to pass control to the
177 * password changing module.
180 #include "./pam_unix_passwd.-c"
182 PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
183 int argc, const char **argv)
191 ctrl = set_ctrl(flags, argc, argv);
192 retval = _unix_chauthtok(pamh, ctrl);
200 /* static module data */
203 struct pam_module _pam_pwdb_modstruct = {
209 pam_sm_close_session,
216 * Copyright (c) Andrew G. Morgan, 1996. All rights reserved
218 * Redistribution and use in source and binary forms, with or without
219 * modification, are permitted provided that the following conditions
221 * 1. Redistributions of source code must retain the above copyright
222 * notice, and the entire permission notice in its entirety,
223 * including the disclaimer of warranties.
224 * 2. Redistributions in binary form must reproduce the above copyright
225 * notice, this list of conditions and the following disclaimer in the
226 * documentation and/or other materials provided with the distribution.
227 * 3. The name of the author may not be used to endorse or promote
228 * products derived from this software without specific prior
229 * written permission.
231 * ALTERNATIVELY, this product may be distributed under the terms of
232 * the GNU Public License, in which case the provisions of the GPL are
233 * required INSTEAD OF the above restrictions. (This clause is
234 * necessary due to a potential bad interaction between the GPL and
235 * the restrictions contained in a BSD-style copyright.)
237 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
238 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
239 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
240 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
241 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
242 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
243 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
244 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
245 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
246 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
247 * OF THE POSSIBILITY OF SUCH DAMAGE.