From f372ec041a83288a5d096360f0ad8589e4db666a Mon Sep 17 00:00:00 2001 From: Mark Vitale Date: Tue, 6 Oct 2020 10:18:11 -0400 Subject: [PATCH] bozo: defer audit open until log dir is created and current On a new OpenAFS install where the log directory has not yet been created. 'bosserver -auditlog /usr/afs/logs/' (absolute path) fails with ENOENT because the log directory doesn't exist yet. Furthermore, 'bosserver -auditlog ' (relative path) succeeds, but the audit file is created in the current working directory when bosserver was started, not in the expected log directory (Transarc /usr/afs/logs). Both problems have been present since bosserver audit log support was introduced by commit 16d67791dce45e5d4ee9b854c796492ffcde2113 'auditlogs-for-everyone-20050702'. Reorder the bosserver initialization steps to ensure that the log directory has been created and is the current working directory, before creating and opening the audit log. Change-Id: I1dc3c136edd12c5425ef0b7a3212a18d4c3036f7 Reviewed-on: https://gerrit.openafs.org/14381 Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Benjamin Kaduk --- src/bozo/bosserver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bozo/bosserver.c b/src/bozo/bosserver.c index 2c46d80..1befdc9 100644 --- a/src/bozo/bosserver.c +++ b/src/bozo/bosserver.c @@ -1072,9 +1072,6 @@ main(int argc, char **argv, char **envp) /* rxkad options */ cmd_OptionAsFlag(opts, OPT_dotted, &rxkadDisableDotCheck); - if (auditFileName != NULL) - osi_audit_file(auditFileName); - #ifndef AFS_NT40_ENV if (geteuid() != 0) { printf("bosserver: must be run as root.\n"); @@ -1141,6 +1138,9 @@ main(int argc, char **argv, char **envp) exit(1); } + if (auditFileName != NULL) + osi_audit_file(auditFileName); + /* try to read the key from the config file */ tdir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH); if (!tdir) { -- 1.9.4