4 * See end of file for Copyright information.
7 static const char rcsid_auth[] =
8 "$Id$: pam_unix_auth.-c,v 1.2 1996/09/05 06:46:53 morgan Exp morgan $\n"
9 " - PAM_PWDB authentication functions. <morgan@parc.power.net>";
12 * _unix_auth() is a front-end for UNIX/shadow authentication
14 * First, obtain the password from the user. Then use a
15 * routine in 'support.-c' to authenticate the user.
18 #define _UNIX_AUTHTOK "-UN*X-PASS"
20 static int _unix_auth(pam_handle_t *pamh, unsigned int ctrl)
27 /* get the user'name' */
29 retval = _unix_get_user(pamh, ctrl, NULL, &name);
30 if (retval != PAM_SUCCESS ) {
31 if (retval != PAM_CONV_AGAIN) {
32 if ( on(UNIX_DEBUG,ctrl) ) {
33 _log_err(LOG_DEBUG, "auth could not identify user");
36 D(("pam_get_user/conv() function is not ready yet"));
37 /* it is safe to resume this function so we translate this
38 retval to the value that indicates we're happy to resume. */
39 retval = PAM_INCOMPLETE;
44 /* if this user does not have a password... */
46 if ( _unix_blankpasswd(ctrl, name) ) {
47 D(("user '%s' has blank passwd", name));
52 /* get this user's authentication token */
54 retval = _unix_read_password(pamh, ctrl, NULL, "Password: ", NULL
56 if (retval != PAM_SUCCESS) {
57 if (retval != PAM_CONV_AGAIN) {
58 _log_err(LOG_CRIT, "auth could not identify password for [%s]"
61 D(("conversation function is not ready yet"));
62 /* it is safe to resume this function so we translate this
63 retval to the value that indicates we're happy to resume. */
64 retval = PAM_INCOMPLETE;
69 D(("user=%s, password=[%s]", name, p));
71 /* verify the password of this user */
72 retval = _unix_verify_password(pamh, name, p, ctrl);
75 D(("done [%d]", retval));
81 * This function is for setting unix credentials. Sun has indicated
82 * that there are *NO* authentication credentials for unix. The
83 * obvious credentials would be the group membership of the user as
84 * listed in the /etc/group file. However, Sun indicates that it is
85 * the responsibility of the application to set these.
88 static int _unix_set_credentials(pam_handle_t *pamh, unsigned int ctrl)
90 D(("called <empty function> returning."));
95 /********************************************************************
96 * Copyright (c) Alexander O. Yuriev, 1996.
97 * Copyright (c) Andrew G. Morgan <morgan@parc.power.net> 1996
98 * Copyright (c) Cristian Gafton <gafton@redhat.com> 1996, 1997
100 * Redistribution and use in source and binary forms, with or without
101 * modification, are permitted provided that the following conditions
103 * 1. Redistributions of source code must retain the above copyright
104 * notice, and the entire permission notice in its entirety,
105 * including the disclaimer of warranties.
106 * 2. Redistributions in binary form must reproduce the above copyright
107 * notice, this list of conditions and the following disclaimer in the
108 * documentation and/or other materials provided with the distribution.
109 * 3. The name of the author may not be used to endorse or promote
110 * products derived from this software without specific prior
111 * written permission.
113 * ALTERNATIVELY, this product may be distributed under the terms of
114 * the GNU Public License, in which case the provisions of the GPL are
115 * required INSTEAD OF the above restrictions. (This clause is
116 * necessary due to a potential bad interaction between the GPL and
117 * the restrictions contained in a BSD-style copyright.)
119 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
120 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
121 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
122 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
123 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
124 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
125 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
126 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
127 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
128 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
129 * OF THE POSSIBILITY OF SUCH DAMAGE.