volser: Avoid calling osi_audit before audit init 72/13772/20
authorCheyenne Wills <cwills@sinenomine.net>
Thu, 6 Jun 2019 20:08:53 +0000 (14:08 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 1 Nov 2020 19:27:06 +0000 (14:27 -0500)
volmain.c calls osi_audit before the audit facility is fully
initialized.

Commit 16d67791 (auditlogs-for-everyone-20050702) introduced the
-auditlog parameter; it appears that it didn't remove the call
to osi_audit (right after osi_audit_init) that was called before command
line argument processing. This resulted in calling the audit facility
before it was fulling initialized with the -auditlog and
-audit-interface parameters.  The 16d67791 commit replicated the
osi_audit call after command line processing.

Change-Id: Ia0c0054a2fb11892b5b30c0f0838a4d6bbdf9bbb
Reviewed-on: https://gerrit.openafs.org/13772
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/volser/volmain.c

index a56f657..22e3e15 100644 (file)
@@ -461,7 +461,6 @@ main(int argc, char **argv)
     sigaction(SIGSEGV, &nsa, NULL);
 #endif
     osi_audit_init();
-    osi_audit(VS_StartEvent, 0, AUD_END);
 
     /* Initialize dirpaths */
     if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
@@ -480,9 +479,12 @@ main(int argc, char **argv)
     }
 
     if (auditFileName) {
-       osi_audit_file(auditFileName);
-       osi_audit(VS_StartEvent, 0, AUD_END);
+       if (osi_audit_file(auditFileName)) {
+           fprintf(stderr, "error from opening auditlog %s\n", auditFileName);
+           exit(1);
+       }
     }
+    osi_audit(VS_StartEvent, 0, AUD_END);
 #ifdef AFS_SGI_VNODE_GLUE
     if (afs_init_kernel_config(-1) < 0) {
        printf