/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdlib.h>
#include <pwd.h>
#include <shadow.h>
#include <syslog.h>
#include <errno.h>
#include <string.h>
#include <crypt.h>
#include <unistd.h>
#include <user_attr.h>
#include <auth_attr.h>
#include <userdefs.h>
#include <deflt.h>
#include <stdarg.h>
#include <ctype.h>
#include <macros.h>
#include <time.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#include <security/pam_impl.h>
#include <user_attr.h>
#include <secdb.h>
#include <libintl.h>
#include <passwdutil.h>
/*PRINTFLIKE2*/
void
{
}
static int
{
int do_lock = 0;
int retval = 0;
char *p;
void *defp;
} else {
}
}
if (do_lock) {
}
}
return (retval);
}
static void
int sp_flag)
{
return;
if (failures == 1) {
"attempt at %s since last successful authentication."),
} else if (failures < FAILCOUNT_MASK) {
"attempts since last successful authentication. "
} else {
"authentication attempts since last successful "
"authentication. "
}
}
/*
* roleauth=user means we want the users not the roles password, so return true.
* roleauth=role or a non existent roleauth= entry means use the role
* password so return false.
* If roleauth is (incorrectly) present for an account that isn't type=role
* then we effectively ignore it by returning false.
*/
static boolean_t
{
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
return (B_FALSE);
}
/*
* int pam_sm_authenticate(pamh, flags, arc, argv)
*
* This routine verifies that the password as stored in the
* PAM_AUTHTOK item is indeed the password that belongs to the user
* as stored in PAM_USER.
*
* This routine will not establish Secure RPC Credentials, the pam_dhkeys
* module should be stacked before us if Secure RPC Credentials are needed
* to obtain passwords.
*/
int
{
int i;
int debug = 0;
char *user;
char *auser;
char *passwd;
char *crypt_passwd;
int result;
int server_policy = 0;
int old_failed_count;
for (i = 0; i < argc; i++) {
debug = 1;
nowarn = 1;
server_policy = 1;
dolock = 0;
}
if (debug)
"pam_unix_auth: entering pam_sm_authenticate()");
"pam_unix_auth: USER NULL or empty!\n");
return (PAM_USER_UNKNOWN);
}
}
"pam_unix_auth: AUTHTOK not set!\n");
return (PAM_SYSTEM_ERR);
}
return (PAM_BUF_ERR);
} else {
}
/*
* Get password and the name of the repository where the
* password resides.
*/
/*
* Also get the current number of failed logins; we use
* this later to determine whether we need to reset the count
* on a succesful authentication. We use the home-directory
* to look for .hushlogin in order to optionaly surpress the
* "failed attempts" message.
*/
if (pwu_rep != PWU_DEFAULT_REP)
if (result == PWU_NOT_FOUND) {
"pam_unix_auth: user %s not found\n", user);
return (PAM_USER_UNKNOWN);
}
if (result == PWU_DENIED) {
"pam_unix_auth: failed to obtain attributes");
return (PAM_PERM_DENIED);
}
if (result != PWU_SUCCESS)
return (PAM_SYSTEM_ERR);
/*
* Chop off old SunOS-style password aging information.
*
* Note: old style password aging is only defined for UNIX-style
* crypt strings, hence the comma will always be at position 14.
* Note: This code is here because some other vendors might still
* support this style of password aging. If we don't remove
* the age field, no one will be able to login.
* XXX yank this code when we're certain this "compatibility"
* isn't needed anymore.
*/
/* Is a password check required? */
if (flags & PAM_DISALLOW_NULL_AUTHTOK) {
"pam_unix_auth: empty password for %s not allowed.",
user);
goto out;
} else {
goto out;
}
}
/*
* Password check *is* required. Make sure we have a valid
* pointer in PAM_AUTHTOK
*/
goto out;
}
if (server_policy &&
result = PAM_IGNORE;
goto out;
}
/* Now check the entered password */
switch (errno) {
case ENOMEM:
break;
case ELIBACC:
break;
default:
}
goto out;
}
/* clear and display failed count */
if (old_failed_count > 0) {
if (nowarn == 0) {
}
}
} else {
int locked;
/* increment failed count */
if (dolock == 1 &&
locked == PWU_ACCOUNT_LOCKED) {
/* account locked */
} else {
}
}
out:
return (result);
}
/*ARGSUSED*/
int
{
return (PAM_IGNORE);
}