audit_login.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/systeminfo.h>
#include <sys/systeminfo.h>
#include <netdb.h>
#include <signal.h>
#include <pwd.h>
#include <stdlib.h>
#include <shadow.h>
#include <utmpx.h>
#include <unistd.h>
#include <string.h>
#include <bsm/audit_uevents.h>
#include <bsm/audit_record.h>
#include <bsm/audit_private.h>
#include <generic.h>
#include <locale.h>
static void audit_login_record();
static void audit_login_session_setup();
static void get_terminal_id();
static void audit_login_logout();
static int selected();
static char sav_ttyn[512];
static int sav_rflag;
static int sav_hflag;
static char sav_name[512];
static uint32_t sav_iptype;
static char sav_host[512];
int
{
if (cannot_audit(0)) {
return (0);
}
return (0);
}
int
char *host;
{
int rv;
if (cannot_audit(0)) {
return (0);
}
return (rv);
}
int
char *ttyn;
{
if (cannot_audit(0)) {
return (0);
}
return (0);
}
int
{
if (cannot_audit(0)) {
return (0);
}
sav_port = aug_get_port();
return (0);
}
int
{
int rv;
if (cannot_audit(0)) {
return (0);
}
return (rv);
}
int
{
if (cannot_audit(0)) {
return (0);
}
sav_name[0] = '\0';
sav_uid = -1;
sav_gid = -1;
} else {
}
return (0);
}
int
{
if (cannot_audit(0)) {
return (0);
}
return (0);
}
int
{
if (cannot_audit(0)) {
return (0);
}
return (0);
}
int
{
if (cannot_audit(0)) {
return (0);
}
if (sav_uid == -1) {
"invalid user name"), AUE_login);
} else {
"invalid password"), AUE_login);
}
return (0);
}
int
{
if (cannot_audit(0)) {
return (0);
}
"invalid dialup password"), AUE_login);
return (0);
}
int
{
if (cannot_audit(0)) {
return (0);
}
"successful login"), AUE_login);
return (0);
}
static void
int typ;
char *string;
{
if (typ == 0) {
rc = 0;
} else {
rc = -1;
}
if (sav_hflag) {
}
if (sav_rflag) {
}
}
return;
#ifdef _LP64
#else
#endif
if (rc < 0) {
perror("audit");
}
}
static void
{
int rc;
struct auditinfo_addr info;
struct auditinfo_addr now;
mask.am_success = 0;
mask.am_failure = 0;
/* see if terminal id already set */
perror("getaudit");
}
/*
* Don't allow even a privileged process to change terminal
* info once it has been set
*/
/* update terminal ID with real values */
} else
if (rc < 0) {
perror("setaudit");
}
}
static void
{
}
static void
{
int ret; /* return value of wait() */
int status; /* wait status */
return;
} else if (pid == -1) {
"login: could not fork\n"), stderr);
exit(1);
} else {
char textbuf[BSM_TEXTBUFSZ];
/*
* When this routine is called, the current working
* directory is the user's home directory. Change it
* to root for the waiting process so that the user's
* home directory can be unmounted if necessary.
*/
if (chdir("/") != 0) {
"login: could not chdir\n"), stderr);
/* since we let the child finish we just bail */
exit(0);
}
/* keep waiting */
exit(0);
}
}
static int
{
int rc;
char hostname[256];
int stat;
} else {
if (rc < 0) {
perror("sysinfo");
return (0);
}
}
return (stat);
}
static int
char *nam;
int sf;
{
char naflags[512];
if (uid < 0) {
if (rc == 0)
} else {
}
if (sf == 0) {
} else {
}
return (rc);
}