uadmin.c revision e333042d319d2ba8ccbbd914d8b6ee5b8b990931
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <bsm/adt_event.h>
#include <libscf.h>
#include <strings.h>
#define AUDITD_FMRI "svc:/system/auditd:default"
static const char *Usage = "Usage: %s cmd fcn [mdep]\n";
static int turnoff_auditd(int, int);
static void wait_for_auqueue();
int
{
enum adt_uadmin_fcn fcn_id;
return (1);
}
(void) sigfillset(&set);
"allowed for this cmd value\n", argv[0]);
return (1);
} else {
}
}
/* set up audit session and event */
argv[0]);
}
switch (cmd) {
case A_SHUTDOWN:
break;
case A_REBOOT:
break;
case A_DUMP:
break;
case A_REMOUNT:
break;
case A_FREEZE:
break;
case A_FTRACE:
break;
case A_SWAPCTL:
break;
default:
event_id = 0;
}
if ((event_id != 0) &&
argv[0]);
}
switch (fcn) {
case AD_HALT:
break;
case AD_POWEROFF:
break;
case AD_BOOT:
break;
case AD_IBOOT:
break;
case AD_SBOOT:
break;
case AD_SIBOOT:
break;
case AD_NOSYNC:
break;
default:
fcn_id = 0;
}
switch (fcn) {
case AD_SUSPEND_TO_DISK:
break;
case AD_CHECK_SUSPEND_TO_DISK:
break;
case AD_FORCE:
break;
case AD_SUSPEND_TO_RAM:
break;
case AD_CHECK_SUSPEND_TO_RAM:
break;
case AD_REUSEINIT:
break;
case AD_REUSABLE:
break;
case AD_REUSEFINI:
break;
}
switch (fcn) {
case AD_FTRACE_START:
break;
case AD_FTRACE_STOP:
break;
}
}
if (geteuid() == 0) {
switch (cmd) {
case A_SHUTDOWN:
break;
case A_REBOOT:
break;
case A_DUMP:
break;
case A_REMOUNT:
/* no parameters */
break;
case A_FREEZE:
break;
case A_FTRACE:
break;
case A_SWAPCTL:
break;
}
"%s: can't put audit event\n", argv[0]);
}
/*
* allow audit record to be processed in the kernel
* audit queue
*/
}
argv[0]);
}
(void) adt_free_event(event);
(void) adt_end_session(ah);
perror("uadmin");
return (1);
}
return (0);
}
static int
{
char *smf_state;
int rc = -1;
int retries = 15;
switch (cmd) {
case A_SHUTDOWN:
case A_REBOOT:
case A_DUMP:
/* system shutting down, turn off auditd */
break;
case A_REMOUNT:
case A_SWAPCTL:
case A_FTRACE:
/* No system discontinuity, don't turn off auditd */
return (0);
case A_FREEZE:
switch (fcn) {
case AD_CHECK_SUSPEND_TO_DISK: /* AD_CHECK */
case AD_CHECK_SUSPEND_TO_RAM:
case AD_REUSEINIT:
case AD_REUSEFINI:
/* No system discontinuity, don't turn off auditd */
return (0);
case AD_REUSABLE:
case AD_SUSPEND_TO_DISK: /* AD_COMPRESS */
case AD_SUSPEND_TO_RAM:
case AD_FORCE:
/* suspend the system, change audit files */
/* XXX not implemented for now */
default:
return (-1);
}
default:
return (-1);
}
scf_strerror(scf_error()));
return (-1);
}
/* wait for auditd to finish its work */
do {
"getting state of auditd failed: %s\n",
scf_strerror(scf_error()));
return (-1);
}
retries--;
(void) sleep(1);
} else {
rc = 0;
}
return (rc);
}
static void
{
int retries = 10;
break;
}
(void) sleep(1);
}
}