audit_ftpd.c revision f48205be61a214698b763ff550ab9e657525104c
/*
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <bsm/audit_record.h>
#include <bsm/audit_uevents.h>
#include <bsm/audit_private.h>
#include <locale.h>
#include <pwd.h>
#include <generic.h>
#define BAD_PASSWD (1)
#define UNKNOWN_USER (2)
#define EXCLUDED_USER (3)
#define NO_ANONYMOUS (4)
#define MISC_FAILURE (5)
static char luser[16];
static void generate_record(char *, int, char *);
void
audit_ftpd_bad_pw(char *uname)
{
if (cannot_audit(0)) {
return;
}
"bad password"));
}
void
audit_ftpd_unknown(char *uname)
{
if (cannot_audit(0)) {
return;
}
"unknown user"));
}
void
audit_ftpd_excluded(char *uname)
{
if (cannot_audit(0)) {
return;
}
"excluded user"));
}
void
audit_ftpd_no_anon(void)
{
if (cannot_audit(0)) {
return;
}
"no anonymous"));
}
void
audit_ftpd_failure(char *uname)
{
if (cannot_audit(0)) {
return;
}
"misc failure"));
}
void
audit_ftpd_success(char *uname)
{
if (cannot_audit(0)) {
return;
}
}
static void
char *locuser, /* username of local user */
int err, /* error status */
/* (=0 success, >0 error code) */
char *msg) /* error message */
{
int rd; /* audit record descriptor */
struct auditinfo_addr info;
if (cannot_audit(0)) {
return;
}
} else {
}
(void) seteuid(0); /* change to root so you can audit */
/* determine if we're preselected */
return;
}
/* see if terminal id already set */
perror("getaudit");
}
/* add subject token */
if (is_system_labeled())
/* add return token */
errno = 0;
if (err) {
/* add reason for failure */
if (err == UNKNOWN_USER)
else
#ifdef _LP64
#else
#endif
} else {
#ifdef _LP64
#else
#endif
}
/* write audit record */
}
}
static int
char *locuser,
int err)
{
char naflags[512];
if (rc == 0)
} else {
}
if (err == 0)
else if (err >= 1)
else
sorf = AU_PRS_BOTH;
return (rc);
}
void
audit_ftpd_logout(void)
{
int rd; /* audit record descriptor */
struct auditinfo_addr info;
if (cannot_audit(0)) {
return;
}
/* see if terminal id already set */
perror("getaudit");
}
/* determine if we're preselected */
AU_PRS_USECACHE) == 0) {
NULL);
return;
}
/* add subject token */
if (is_system_labeled())
/* add return token */
errno = 0;
#ifdef _LP64
#else
#endif
/* write audit record */
}
}