libadmin: allow tests to skip authentication setup

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
subcommand.

However, some afscp subcommands shouldn't need any authentication setup,
for example:
  UtilErrorTranslate -error <code>
  UtilNameToAddress -host <hostname>

In preparation for a future commit, modify MyBeforeProc to skip
authentication setup for subcommands that haven't called SetupCommonArgs
to define authentication options.

Change-Id: I3d6be062c8264ece8eb27c3b2b72c8c45aacae56
Reviewed-on: https://gerrit.openafs.org/14646
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Mark Vitale 2021-06-22 00:28:54 -04:00 committed by Benjamin Kaduk
parent 6163ebf345
commit b500a76a06

View File

@ -58,6 +58,9 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
char auth_cell[MAXCELLCHARS];
char exec_cell[MAXCELLCHARS];
if (as->nParms < USER_PARAM)
return 0; /* no authentication parms defined for this subcommand */
/*
* Check what kind of authentication is necessary based upon
* the arguments passed