aklog: Avoid misleading AFSCELL message 71/13371/5
authorAndrew Deason <adeason@sinenomine.net>
Tue, 30 Oct 2018 20:41:22 +0000 (15:41 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 29 Jun 2019 02:25:11 +0000 (22:25 -0400)
commit877d9d79a32b9e81911cb567f844b11c693229f0
treee07da3f92dea1d819a1e0c365855cfb0a4984e1f
parente14a69cf925172d699c2ff31078f8a634a90747f
aklog: Avoid misleading AFSCELL message

Currently, if the AFSCELL environment variable is set, aklog (and
other libauth-using utilities) print out a message when
afsconf_GetLocalCell is called:

    Note: Operation is performed on cell env.example.com

However, this message is also printed (with the AFSCELL cell) when
aklog is given the -cell command-line argument, even though aklog
actually uses the cell given on the command line. For example:

    $ AFSCELL=env.example.com aklog -cell cli.example.com -d
    Note: Operation is performed on cell env.example.com
    Authenticating to cell cli.example.com (server srv1.example.com).
    [...]

libauth will normally not print the "Operation" message if we're not
using the default cell, but it determines this by checking if someone
called afsconf_GetCellInfo before calling afsconf_GetLocalCell. And
currently, aklog calls afsconf_GetLocalCell before
afsconf_GetCellInfo, so the message gets printed because libauth has
no way of knowing that we're actually using a different cell.

klog gets around this by making an additional ignored call to
afsconf_GetCellInfo before afsconf_GetLocalCell, but we can fix this
in aklog by just changing the order of the calls. So, just call
afsconf_GetCellInfo first; if we're using the local cell, we can just
give a NULL cell parameter, instead of looking up the local cellname
first.

Change-Id: I53469ee93d6e88632a944a87a031e0ffa4ede584
Reviewed-on: https://gerrit.openafs.org/13371
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/aklog/aklog.c