Deleted Added
full compact
bsm_control.c (162503) bsm_control.c (162621)
1/*
2 * Copyright (c) 2004 Apple Computer, Inc.
3 * Copyright (c) 2006 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 13 unchanged lines hidden (view full) ---

22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
1/*
2 * Copyright (c) 2004 Apple Computer, Inc.
3 * Copyright (c) 2006 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 13 unchanged lines hidden (view full) ---

22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#15 $
30 * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_control.c#16 $
31 */
32
33#include <bsm/libbsm.h>
34
35#include <errno.h>
36#include <string.h>
37#include <pthread.h>
38#include <stdio.h>

--- 352 unchanged lines hidden (view full) ---

391 return (1);
392 }
393 *min_val = atoi(min);
394 pthread_mutex_unlock(&mutex);
395 return (0);
396}
397
398/*
31 */
32
33#include <bsm/libbsm.h>
34
35#include <errno.h>
36#include <string.h>
37#include <pthread.h>
38#include <stdio.h>

--- 352 unchanged lines hidden (view full) ---

391 return (1);
392 }
393 *min_val = atoi(min);
394 pthread_mutex_unlock(&mutex);
395 return (0);
396}
397
398/*
399 * Return the desired trail rotation size from the audit control file.
400 */
401int
402getacfilesz(size_t *filesz_val)
403{
404 char *filesz, *dummy;
405 long long ll;
406
407 pthread_mutex_lock(&mutex);
408 setac_locked();
409 if (getstrfromtype_locked(FILESZ_CONTROL_ENTRY, &filesz) < 0) {
410 pthread_mutex_unlock(&mutex);
411 return (-2);
412 }
413 if (filesz == NULL) {
414 pthread_mutex_unlock(&mutex);
415 errno = EINVAL;
416 return (1);
417 }
418 ll = strtoll(filesz, &dummy, 10);
419 if (*dummy != '\0') {
420 pthread_mutex_unlock(&mutex);
421 errno = EINVAL;
422 return (-1);
423 }
424 /*
425 * The file size must either be 0 or >= MIN_AUDIT_FILE_SIZE. 0
426 * indicates no rotation size.
427 */
428 if (ll < 0 || (ll > 0 && ll < MIN_AUDIT_FILE_SIZE)) {
429 pthread_mutex_unlock(&mutex);
430 errno = EINVAL;
431 return (-1);
432 }
433 *filesz_val = ll;
434 pthread_mutex_unlock(&mutex);
435 return (0);
436}
437
438/*
399 * Return the system audit value from the audit contol file.
400 */
401int
402getacflg(char *auditstr, int len)
403{
404 char *str;
405
406 pthread_mutex_lock(&mutex);

--- 70 unchanged lines hidden ---
439 * Return the system audit value from the audit contol file.
440 */
441int
442getacflg(char *auditstr, int len)
443{
444 char *str;
445
446 pthread_mutex_lock(&mutex);

--- 70 unchanged lines hidden ---