38
38
#include <afs/afsutil.h>
40
/* C99 requires va_copy. Older versions of GCC provide __va_copy. Per t
41
Autoconf manual, memcpy is a generally portable fallback. */
44
# define va_copy(d, s) __va_copy((d), (s))
46
# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
42
52
int osi_audit_all = (-1); /* Not determined yet */
87
97
*(afs_int32 *) bufferPtr = vaLong;
88
98
bufferPtr += sizeof(vaLong);
90
case AUD_LST: /* Ptr to another list */
91
vaLst = va_arg(vaList, va_list);
92
audmakebuf(audEvent, vaLst);
94
100
case AUD_FID: /* AFSFid - contains 3 entries */
95
101
vaFid = (struct AFSFid *)va_arg(vaList, struct AFSFid *);
140
printbuf(FILE *out, int rec, char *audEvent, afs_int32 errCode, va_list vaList)
146
printbuf(FILE *out, int rec, char *audEvent, char *afsName, afs_int32 hostId,
147
afs_int32 errCode, va_list vaList)
164
171
fprintf(out, "[%d] ", num);
167
if (strcmp(audEvent, "VALST") != 0)
168
fprintf(out, "EVENT %s CODE %d ", audEvent, errCode);
174
fprintf(out, "EVENT %s CODE %d ", audEvent, errCode);
177
hostAddr.s_addr = hostId;
178
fprintf(out, "NAME %s HOST %s ", afsName, inet_ntoa(hostAddr));
170
181
vaEntry = va_arg(vaList, int);
171
182
while (vaEntry != AUD_END) {
212
223
vaLong = va_arg(vaList, afs_int32);
213
224
fprintf(out, "LONG %d ", vaLong);
215
case AUD_LST: /* Ptr to another list */
216
vaLst = va_arg(vaList, va_list);
217
printbuf(out, 1, "VALST", 0, vaLst);
219
226
case AUD_FID: /* AFSFid - contains 3 entries */
220
227
vaFid = va_arg(vaList, struct AFSFid *);
284
290
/* The routine that acually does the audit call.
285
291
* ************************************************************************** */
287
osi_audit(char *audEvent, /* Event name (15 chars or less) */
288
afs_int32 errCode, /* The error code */
293
osi_audit_internal(char *audEvent, /* Event name (15 chars or less) */
294
afs_int32 errCode, /* The error code */
291
299
#ifdef AFS_AIX32_ENV
342
352
*(int *)bufferPtr = errCode;
343
353
bufferPtr += sizeof(errCode);
345
va_start(vaList, errCode);
346
355
audmakebuf(audEvent, vaList);
349
358
if (osi_echo_trail) {
350
va_start(vaList, errCode);
351
printbuf(stdout, 0, audEvent, errCode, vaList);
359
printbuf(stdout, 0, audEvent, afsName, hostId, errCode, vaList);
354
363
#ifdef AFS_AIX32_ENV
355
364
bufferLen = (int)((afs_int32) bufferPtr - (afs_int32) & BUFFER[0]);
356
365
code = auditlog(audEvent, result, BUFFER, bufferLen);
360
code = auditlog("AFS_Aud_Fail", result, &err, sizeof(err));
362
printf("Error while writing audit entry: %d.\n", errno);
367
va_start(vaList, errCode);
368
printbuf(auditout, 0, audEvent, errCode, vaList);
368
printbuf(auditout, 0, audEvent, afsName, hostId, errCode, vaList);
369
369
fflush(auditout);
379
osi_audit(char *audEvent, /* Event name (15 chars or less) */
380
afs_int32 errCode, /* The error code */
385
if ((osi_audit_all < 0) || (osi_echo_trail < 0))
387
if (!osi_audit_all && !auditout)
390
va_start(vaList, errCode);
391
osi_audit_internal(audEvent, errCode, NULL, 0, vaList);
379
397
/* ************************************************************************** */
380
398
/* Given a RPC call structure, this routine extracts the name and host id from the
461
479
osi_audit("AFS_Aud_NoCall", (-1), AUD_STR, audEvent, AUD_END);
463
481
va_start(vaList, errCode);
464
osi_audit(audEvent, errCode, AUD_NAME, afsName, AUD_HOST, hostId,
465
AUD_LST, vaList, AUD_END);
482
osi_audit_internal(audEvent, errCode, afsName, hostId, vaList);