From 2eed23e1591f9a988ff0e9b785abddb2e91f42ee Mon Sep 17 00:00:00 2001 From: Mark Vitale Date: Tue, 22 Jun 2021 00:04:23 -0400 Subject: [PATCH] libadmin: skip authentication setup for tests that don't need it src/libadmin/test/afscp is a testbed with subcommands to test many libadmin functions. Almost all of these subcommands call SetupCommonArgs to add authentication specification arguments (e.g. -noauth, -cell , etc). These common args are checked in MyBeforeProc to obtain authentication before processing the actual test command. There are a few afscp subcommands which should not require any authentication setup: UtilErrorTranslate -error UtilNameToAddress -host Yet these will segfault in MyBeforeProc unless a valid authentication argument is specified. Instead, do not call SetupCommonArgs for these subcommands; this will cause MyBeforeProcs to skip authentication setup. Change-Id: Iea5067b11e9ad0086acd8f2007e08ed92b45021f Reviewed-on: https://gerrit.openafs.org/14647 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/libadmin/test/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libadmin/test/util.c b/src/libadmin/test/util.c index 3f36040e2d..217d6c2158 100644 --- a/src/libadmin/test/util.c +++ b/src/libadmin/test/util.c @@ -90,7 +90,7 @@ SetupUtilAdminCmd(void) ts = cmd_CreateSyntax("UtilErrorTranslate", DoUtilErrorTranslate, NULL, 0, "translate an error code"); cmd_AddParm(ts, "-error", CMD_SINGLE, CMD_REQUIRED, "error code"); - SetupCommonCmdArgs(ts); + /* don't add common args, they are not needed for this function */ ts = cmd_CreateSyntax("UtilDatabaseServerList", DoUtilDatabaseServerList, NULL, 0, "list the database servers in a cell"); @@ -100,5 +100,5 @@ SetupUtilAdminCmd(void) ts = cmd_CreateSyntax("UtilNameToAddress", DoUtilNameToAddress, NULL, 0, "translate a host name to an address"); cmd_AddParm(ts, "-host", CMD_SINGLE, CMD_REQUIRED, "host name"); - SetupCommonCmdArgs(ts); + /* don't add common args, they are not needed for this function */ }