audit.c (cee38678) | audit.c (1a578a15) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. 24 */ 25#pragma ident "%Z%%M% %I% %E% SMI" 26 27#include <fcntl.h> 28#include <libscf.h> 29#include <secdb.h> 30#include <stdlib.h> --- 181 unchanged lines hidden (view full) --- 212static boolean_t 213is_audit_control_ok(char *filename) { 214 char buf[TRADITIONAL_MAX]; 215 int outputs = 0; 216 int state = 1; /* 1 is ok, 0 is not */ 217 int rc; 218 int min; 219 kva_t *kvlist; | 23 * Use is subject to license terms. 24 */ 25#pragma ident "%Z%%M% %I% %E% SMI" 26 27#include <fcntl.h> 28#include <libscf.h> 29#include <secdb.h> 30#include <stdlib.h> --- 181 unchanged lines hidden (view full) --- 212static boolean_t 213is_audit_control_ok(char *filename) { 214 char buf[TRADITIONAL_MAX]; 215 int outputs = 0; 216 int state = 1; /* 1 is ok, 0 is not */ 217 int rc; 218 int min; 219 kva_t *kvlist; |
220 char *value; | 220 char *plugin_name; 221 char *plugin_dir; |
221 au_acinfo_t *ach; 222 223 ach = _openac(filename); /* open audit_control */ 224 if (ach == NULL) { 225 perror(progname); 226 exit(9); 227 } 228 /* --- 8 unchanged lines hidden (view full) --- 237 progname); 238 state = 0; /* is_not_ok */ 239 } 240 241 /* 242 * _getacplug -- all that is of interest is the return code. 243 */ 244 _rewindac(ach); /* rewind audit_control */ | 222 au_acinfo_t *ach; 223 224 ach = _openac(filename); /* open audit_control */ 225 if (ach == NULL) { 226 perror(progname); 227 exit(9); 228 } 229 /* --- 8 unchanged lines hidden (view full) --- 238 progname); 239 state = 0; /* is_not_ok */ 240 } 241 242 /* 243 * _getacplug -- all that is of interest is the return code. 244 */ 245 _rewindac(ach); /* rewind audit_control */ |
245 if ((rc = _getacplug(ach, &kvlist)) == 0) { 246 value = kva_match(kvlist, "name"); 247 if (value == NULL) { | 246 while ((rc = _getacplug(ach, &kvlist)) == 0) { 247 plugin_name = kva_match(kvlist, "name"); 248 if (plugin_name == NULL) { |
248 (void) fprintf(stderr, gettext("%s: audit_control " 249 "\"plugin:\" missing name\n"), progname); 250 state = 0; /* is_not_ok */ | 249 (void) fprintf(stderr, gettext("%s: audit_control " 250 "\"plugin:\" missing name\n"), progname); 251 state = 0; /* is_not_ok */ |
252 } else { 253 if (strcmp(plugin_name, "audit_binfile.so") == 0) { 254 plugin_dir = kva_match(kvlist, "p_dir"); 255 if ((plugin_dir == NULL) && (outputs == 0)) { 256 (void) fprintf(stderr, 257 gettext("%s: audit_control " 258 "\"plugin:\" missing p_dir\n"), 259 progname); 260 state = 0; /* is_not_ok */ 261 } else { 262 outputs++; 263 } 264 } |
|
251 } | 265 } |
252 else 253 outputs++; 254 | |
255 _kva_free(kvlist); | 266 _kva_free(kvlist); |
256 } else if (rc < -1) { | 267 } 268 if (rc < -1) { |
257 (void) fprintf(stderr, 258 gettext("%s: audit_control \"plugin:\" spec invalid\n"), 259 progname); 260 state = 0; /* is_not_ok */ 261 } 262 if (outputs == 0) { 263 (void) fprintf(stderr, 264 gettext("%s: audit_control must have either a " | 269 (void) fprintf(stderr, 270 gettext("%s: audit_control \"plugin:\" spec invalid\n"), 271 progname); 272 state = 0; /* is_not_ok */ 273 } 274 if (outputs == 0) { 275 (void) fprintf(stderr, 276 gettext("%s: audit_control must have either a " |
265 "\"dir:\" or a \"plugin:\" specified.\n"), | 277 "valid \"dir:\" entry or a valid \"plugin:\" " 278 "entry with \"p_dir:\" specified.\n"), |
266 progname); 267 state = 0; /* is_not_ok */ 268 } 269 /* minfree is not required */ 270 _rewindac(ach); 271 if ((rc = _getacmin(ach, &min)) < -1) { 272 (void) fprintf(stderr, 273 gettext( --- 113 unchanged lines hidden --- | 279 progname); 280 state = 0; /* is_not_ok */ 281 } 282 /* minfree is not required */ 283 _rewindac(ach); 284 if ((rc = _getacmin(ach, &min)) < -1) { 285 (void) fprintf(stderr, 286 gettext( --- 113 unchanged lines hidden --- |