audit_rexd.c revision f89940742f5d14dde79b69b98a414dd7b7f585c7
/*
* 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 <unistd.h>
#include <bsm/audit_record.h>
#include <bsm/audit_uevents.h>
#include <bsm/audit_private.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <pwd.h>
#include <locale.h>
#include "generic.h"
#ifdef C2_DEBUG
#else
#define dprintf(x)
#endif
#define UNKNOWN_CMD "???"
static au_event_t event;
static int audit_rexd_status = 0;
static char *
{
int i, l;
char *r;
return (NULL);
/* count the total length of command line */
if (l == 0)
return (NULL);
r = malloc(l);
if (r != NULL) {
(void) strcat(r, " ");
}
}
return (r);
}
static int
char *user;
int sf;
{
int sorf;
/* get non-attrib flags */
} else {
}
if (sf == 0) {
} else if (sf == -1) {
} else {
sorf = AU_PRS_BOTH;
}
}
void
{
dprintf(("audit_rexd_setup()\n"));
}
/* ARGSUSED */
static void
{
int rc;
struct auditinfo_addr info;
perror("getaudit_addr");
exit(1);
}
mask.am_success = 0;
mask.am_failure = 0;
if (rc < 0) {
perror("setaudit_addr");
}
}
void
char *msg; /* message containing failure information */
char *hostname; /* hostname of machine requesting service */
char *user; /* username of user requesting service */
char *shell; /* login shell of user requesting service */
char **cmd; /* argv to be executed locally */
{
int rd; /* audit record descriptor */
char *tbuf; /* temporary buffer */
int tlen;
const char *gtxt; /* gettext return value */
char *cmdbuf;
int dont_free = 0;
struct auditinfo_addr info;
dprintf(("audit_rexd_fail()\n"));
/*
* check if audit_rexd_fail() or audit_rexd_success()
* have been called already.
*/
if (audit_rexd_status == 1) {
return;
}
if (cannot_audit(0)) {
return;
}
/*
* set status to prevent multiple calls
* to audit_rexd_fail() and audit_rexd_success()
*/
audit_rexd_status = 1;
/* determine if we're preselected */
return;
perror("getaudit_addr");
exit(1);
}
/* add subject token */
if (is_system_labeled())
/* add reason for failure */
/* add hostname of machine requesting service */
"Remote execution requested by: %s"), hostname);
/* add username of user requesting service */
user = "???";
"Username: %s"), user);
"User id: %d"), uid);
}
dont_free = 1;
}
/* over estimate of size of buffer needed (%s is replaced) */
return;
}
if (!dont_free)
/* add return token */
#ifdef _LP64
#else
#endif
/* write audit record */
return;
}
}
void
char *hostname; /* hostname of machine requesting service */
char *user; /* username of user requesting service, may be NULL */
char *shell; /* login shell of user requesting service */
char **cmd; /* argv to be executed locally, may be NULL */
{
int rd; /* audit record descriptor */
char *tbuf; /* temporary buffer */
int tlen;
const char *gtxt;
char *cmdbuf;
int dont_free = 0;
struct auditinfo_addr info;
char *empty = "";
dprintf(("audit_rexd_success()\n"));
/*
* check if audit_rexd_fail() or audit_rexd_success()
* have been called already.
*/
if (audit_rexd_status == 1) {
return;
}
if (cannot_audit(0)) {
return;
}
/* a little bullet proofing... */
/*
* set status to prevent multiple calls
* to audit_rexd_fail() and audit_rexd_success()
*/
audit_rexd_status = 1;
/* determine if we're preselected */
goto rexd_audit_session;
perror("getaudit_addr");
exit(1);
}
/* add subject token */
if (is_system_labeled())
/* add hostname of machine requesting service */
"Remote execution requested by: %s"), hostname);
/* add username at machine requesting service */
"Username: %s"), user);
}
dont_free = 1;
}
goto rexd_audit_session;
}
if (!dont_free)
/* add return token */
#ifdef _LP64
#else
#endif
/* write audit record */
}
}