/*
* 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 <stdio.h>
#include <string.h>
#include <syslog.h>
#include <netdb.h>
#include <malloc.h>
#include <unistd.h>
#include <errno.h>
#include <user_attr.h>
#include <secdb.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#include <security/pam_impl.h>
typedef enum {
static const char *
{
}
static void
{
}
static boolean_t
{
char *utype;
}
}
return (res);
}
/*ARGSUSED*/
int
{
char *bufp;
char *rhost;
char *limit;
int userok = 0;
int hostok = 0;
int i;
int allow_deny_test = 0;
for (i = 0; i < argc; ++i) {
check_user = B_TRUE;
sizeof ("nouser")) == 0) {
check_host = B_TRUE;
sizeof ("nohost")) == 0) {
sizeof ("user_host_exact")) == 0) {
check_role = B_TRUE;
sizeof ("norole")) == 0) {
if (op_mode == LIST_PLUS_CHECK) {
} else {
log_illegal_combination("compat",
return (PAM_SERVICE_ERR);
}
sizeof ("allow=") - 1) == 0) {
if (op_mode == LIST_PLUS_CHECK) {
allowdeny_filename = argv[i] +
sizeof ("allow=") - 1;
} else {
log_illegal_combination("allow",
return (PAM_SERVICE_ERR);
}
sizeof ("deny=") - 1) == 0) {
if (op_mode == LIST_PLUS_CHECK) {
allowdeny_filename = argv[i] +
sizeof ("deny=") - 1;
} else {
log_illegal_combination("deny",
return (PAM_SERVICE_ERR);
}
} else {
"pam_list: illegal option %s", argv[i]);
return (PAM_SERVICE_ERR);
}
}
(allow_deny_test > 1)) {
return (PAM_SERVICE_ERR);
}
return (PAM_SERVICE_ERR);
}
if (debug) {
"pam_list: check_user = %d, check_host = %d,"
"check_exact = %d, check_role = %d\n",
"pam_list: auth_file: %s, %s\n", allowdeny_filename,
}
(*username == '\0'))) {
"pam_list: username not supplied, critical error");
return (PAM_USER_UNKNOWN);
}
/*
* If roles should be ignored and username is role then do not
* evaluate it and return ignore value.
*/
if (debug) {
"pam_list: %s is role, ignoring", username);
}
return (PAM_IGNORE);
}
(*rhost == '\0'))) {
} else {
"pam_list: error by gethostname - %m");
return (PAM_SERVICE_ERR);
}
}
if (debug) {
"pam_list: pam_sm_acct_mgmt for (%s,%s,)",
}
if (strlen(allowdeny_filename) == 0) {
"pam_list: file name not specified");
return (PAM_SERVICE_ERR);
}
return (PAM_SERVICE_ERR);
}
/* lines longer than BUFSIZ-1 */
continue;
}
"pam_list: long line in file,"
}
/* remove unneeded colons if necessary */
*limit = '\0';
}
/* ignore free values */
if (buf[0] == '\0') {
continue;
}
if (op_mode == LIST_COMPAT_MODE) {
/* simple + matches all */
break;
}
/* simple - is not defined */
"pam_list: simple minus unknown, "
"illegal line in " PF_PATH);
return (PAM_SERVICE_ERR);
}
/* @ is not allowed on the first position */
if (buf[0] == '@') {
"pam_list: @ is not allowed on the first "
"position in " PF_PATH);
return (PAM_SERVICE_ERR);
}
/* -user or -@netgroup */
if (buf[0] == '-') {
bufp++;
/* +user or +@netgroup */
} else if (buf[0] == '+') {
bufp++;
/* user */
} else {
}
} else if (op_mode == LIST_PLUS_CHECK) {
continue;
}
if (buf[0] == '+') {
} else {
}
bufp++;
}
/*
* if -> netgroup line
* else -> user line
*/
bufp++;
if (check_exact) {
NULL) == 1) {
break;
}
} else {
if (check_user) {
NULL);
} else {
userok = 1;
}
if (check_host) {
NULL);
} else {
hostok = 1;
}
break;
}
}
} else {
if (check_user) {
break;
}
}
}
/*
* a failure to match should result in a return of
* PAM_PERM_DENIED which is achieved below if 'matched'
* is false and 'allow' is true.
*/
if (op_mode == LIST_COMPAT_MODE) {
}
}
if (debug) {
}
if (matched) {
}
/*
* For compatibility with passwd_compat mode to prevent root access
* denied.
*/
if (op_mode == LIST_PLUS_CHECK) {
return (PAM_IGNORE);
}
}