4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/types.h>
30 #include <sys/systeminfo.h>
31 #include <bsm/audit.h>
32 #include <bsm/libbsm.h>
33 #include <bsm/audit_uevents.h>
34 #include <bsm/audit_private.h>
42 #define AUDIT_AT_TEXTBUF 256
43 static char textbuf
[AUDIT_AT_TEXTBUF
];
46 audit_at_create(char *path
, int sorf
)
50 if (cannot_audit(0)) {
56 if (getaudit_addr(&ai
, sizeof (ai
))) {
61 * create an ancilary file if audit characteristics exist
64 anc_name
= audit_cron_make_anc_name(path
);
67 else if (audit_crontab_process_not_audited())
70 r
= audit_cron_setinfo(anc_name
, &ai
);
75 aug_save_auid(ai
.ai_auid
);
76 aug_save_euid(geteuid());
77 aug_save_egid(getegid());
78 aug_save_uid(getuid());
79 aug_save_gid(getgid());
80 aug_save_pid(getpid());
81 aug_save_asid(ai
.ai_asid
);
82 aug_save_tid_ex(ai
.ai_termid
.at_port
, ai
.ai_termid
.at_addr
,
83 ai
.ai_termid
.at_type
);
86 aug_save_event(AUE_at_create
);
97 audit_at_delete(char *name
, char *path
, int sorf
)
100 char full_path
[PATH_MAX
];
106 if (strlen(path
) + strlen(name
) + 2 > PATH_MAX
)
107 r
= -2; /* bad at-job name */
109 (void) strcat(strcat(strcpy(full_path
, path
), "/"),
117 anc_name
= audit_cron_make_anc_name(name
);
118 r
= unlink(anc_name
);
125 (void) aug_save_me();
127 (void) snprintf(textbuf
, sizeof (textbuf
),
128 dgettext(bsm_dom
, "ancillary file: %s"),
130 aug_save_text(textbuf
);
131 } else if (r
== -2) {
133 dgettext(bsm_dom
, "bad format of at-job name"));
137 aug_save_event(AUE_at_delete
);
140 if (aug_audit() != 0)