OpenAFS Master Repository branch, master, updated. BP-openafs-stable-1_8_x-623-gcbc5c4b
Gerrit Code Review
Fri, 19 Jun 2020 11:50:45 -0400
The following commit has been merged in the master branch:
Author: Andrew Deason <email@example.com>
Date: Wed Jun 17 12:23:46 2020 -0500
tests: Modernize writekeyfile.c
tests/auth/writekeyfile.c contains some code used to generate
tests/auth/KeyFile, which is used to test code interpreting the
old-style KeyFile format. This code currently has a few problems:
- We don't check the results of afstest_mkdtemp, which could allow
symlink attacks from other users on the system.
- We duplicate some logic from afstest_BuildTestConfig, in order to
build a temporary config dir.
- writekeyfile isn't built or run by default (it only exists to
generate KeyFile, so it's almost never run), so eventual bitrot is
quite likely, and the existing code already generates warnings.
To avoid this, change writekeyfile.c to use the existing
afstest_BuildTestConfig to generate a local config dir. To ensure we
avoid bitrot, build writekeyfile by default, and create a test to run
it, to make sure it can generate a KeyFile as expected.
Note that the KeyFile.short we test against is different than the
KeyFile currently in the tree. The existing KeyFile was generated from
an older OpenAFS release, which always generated 100-byte KeyFiles,
even if we only have a few keys. The current codebase only writes out
as much key data as needed, so the generated KeyFiles are shorter (but
still understandable by older OpenAFS releases).
Keep the old 100-byte KeyFile around, since that's what older OpenAFS
would generate, and create a new KeyFile.short to test against, to
make sure our code for generating KeyFiles doesn't change any further.
Reviewed-by: Cheyenne Wills <firstname.lastname@example.org>
Reviewed-by: Benjamin Kaduk <email@example.com>
Tested-by: BuildBot <firstname.lastname@example.org>
tests/TESTS | 1 +
tests/auth/KeyFile.short | Bin 0 -> 40 bytes
tests/auth/Makefile.in | 8 +++---
tests/auth/writekeyfile.c | 57 ++++++++++++++++----------------------------
tests/auth/writeoldkey-t | 47 +++++++++++++++++++++++++++++++++++++
5 files changed, 73 insertions(+), 40 deletions(-)
OpenAFS Master Repository