/*
* 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
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libtsnet.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <zone.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#include <security/pam_impl.h>
/*
* pam_tsol_account - Trusted Extensions account management.
* Validates that the user's label range contains
* the process label (label of the zone).
*/
static void
{
m_label_free(r->lower_bound);
m_label_free(r->upper_bound);
free(r);
m_label_free(l);
}
/* ARGSUSED */
int
{
int i;
int debug = 0;
int allow_unlabeled = 0;
char *user;
char *rhost;
for (i = 0; i < argc; i++) {
debug = 1;
allow_unlabeled = 1;
} else {
"pam_tsol_account: illegal option %s", argv[i]);
}
}
/* Trusted Extensions not enabled */
if (!is_system_labeled())
return (PAM_IGNORE);
if (debug) {
"pam_tsol_account: allowed_unlabeled = %d, user %s, "
"rhost %s",
user,
rhost);
}
"pam_tsol_account: no user");
return (PAM_USER_UNKNOWN);
}
"pam_tsol_account: getuserrange(%s) failure", user);
return (PAM_SYSTEM_ERR);
}
"pam_tsol_account: out of memory");
return (PAM_BUF_ERR);
}
"pam_tsol_account: Unable to get process label %m");
return (PAM_SYSTEM_ERR);
}
return (PAM_PERM_DENIED);
}
/* Remote Host Type Policy Check */
if ((allow_unlabeled == 0) &&
(getzoneid() == GLOBAL_ZONEID) &&
switch (host_type) {
case SUN_CIPSO:
break;
case UNLABELED:
default:
return (PAM_PERM_DENIED);
}
}
return (PAM_SUCCESS);
}