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 <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 <code>
  UtilNameToAddress -host <hostname>

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 <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Mark Vitale 2021-06-22 00:04:23 -04:00 committed by Benjamin Kaduk
parent b500a76a06
commit 2eed23e159

View File

@ -90,7 +90,7 @@ SetupUtilAdminCmd(void)
ts = cmd_CreateSyntax("UtilErrorTranslate", DoUtilErrorTranslate, NULL, 0, ts = cmd_CreateSyntax("UtilErrorTranslate", DoUtilErrorTranslate, NULL, 0,
"translate an error code"); "translate an error code");
cmd_AddParm(ts, "-error", CMD_SINGLE, CMD_REQUIRED, "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, ts = cmd_CreateSyntax("UtilDatabaseServerList", DoUtilDatabaseServerList,
NULL, 0, "list the database servers in a cell"); NULL, 0, "list the database servers in a cell");
@ -100,5 +100,5 @@ SetupUtilAdminCmd(void)
ts = cmd_CreateSyntax("UtilNameToAddress", DoUtilNameToAddress, NULL, 0, ts = cmd_CreateSyntax("UtilNameToAddress", DoUtilNameToAddress, NULL, 0,
"translate a host name to an address"); "translate a host name to an address");
cmd_AddParm(ts, "-host", CMD_SINGLE, CMD_REQUIRED, "host name"); cmd_AddParm(ts, "-host", CMD_SINGLE, CMD_REQUIRED, "host name");
SetupCommonCmdArgs(ts); /* don't add common args, they are not needed for this function */
} }