2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include <afs/param.h>
15 #include <afs/afsutil.h>
17 #include "audit-api.h"
19 static FILE *auditout;
24 fprintf(auditout, "\n");
29 append_msg(const char *format, ...)
33 va_start(vaList, format);
34 vfprintf(auditout, format, vaList);
39 open_file(const char *fileName)
47 if ((lstat(fileName, &statbuf) == 0)
48 && (S_ISFIFO(statbuf.st_mode))) {
49 flags = O_WRONLY | O_NONBLOCK;
53 r = asprintf(&oldName, "%s.old", fileName);
54 if (r < 0 || oldName == NULL) {
55 printf("Warning: Unable to create backup filename. Auditing ignored\n");
58 rk_rename(fileName, oldName);
59 flags = O_WRONLY | O_TRUNC | O_CREAT;
62 tempfd = open(fileName, flags, 0666);
64 auditout = fdopen(tempfd, "a");
66 printf("Warning: auditlog %s not writable, ignored.\n", fileName);
70 printf("Warning: auditlog %s not writable, ignored.\n", fileName);
77 print_interface_stats(FILE *out)
82 const struct osi_audit_ops audit_file_ops = {
86 &print_interface_stats,