auth: fix afsconf_GetExtendedCellInfo memory leak 96/13396/7
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 15 Nov 2018 21:19:51 +0000 (16:19 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 25 Jan 2019 13:45:19 +0000 (08:45 -0500)
commit6575af97f4baf1728882ebe8f4ce474334f52ea5
treee80316d6ed714c34e796165aeb6f2bc0bda557dc
parent80ed9d98779135d43f23c9e51e7bd6bce36405f1
auth: fix afsconf_GetExtendedCellInfo memory leak

Commit c4a127d0578e521b97131c5dedf9da58f71b0242
(ubik-clone-support-20010212) added changes to support ubik clone sites.
This commit added the afsconf_GetExtendedCellInfo function, which
returns the info given by the original afsconf_GetCellInfo, plus an
array of booleans (as chars) to indicate which cell servers are ubik
clones.

Unfortunately, the afsconf_GetExtendedCellInfo function calls the
afsconf_OpenInternal function on an already opened configuration. It
does so to look for server entries which are marked as clone sites in
the CellServDB file. Opening the already opened configuration leaks at
least the cellName and local realms information, and is generally
confusing.

Instead, remember which sites are designated as clone sites when the
CellServDB is read when the configuration is opened, and return that
info to the callers of afsconf_GetExtendedCellInfo.

This commit adds the clone array to the afsconf_cell structure and
changes to afsconf_GetCellInfo() for this new server-related data.

As part of this change, remove the no longer needed cell and clones
arguments to the internal function afsconf_OpenInternal, which were
added by commit c4a127d0578e521b97131c5dedf9da58f71b0242.

Update the testcellconfig test program to output the new afsconf_cell
clone member.

This leak was found with valgrind.

Change-Id: I73db60b6a4a77e620e0511ca45cc3418503278a4
Reviewed-on: https://gerrit.openafs.org/13396
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/auth/cellconfig.c
src/auth/cellconfig.p.h
src/auth/test/testcellconf.c