Generate a zero-length signature for symlinks

The fsverity utility follows the symlink when generating a signature.
Since we don't want to sign the same file twice, we need to skip these
links, and instead just generate a dummy zero-length signature here.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Jes Sorensen 2020-04-14 10:33:32 -04:00 committed by Panu Matilainen
parent 131eeb2bbe
commit 201596f995
1 changed files with 4 additions and 1 deletions

View File

@ -45,7 +45,10 @@ static char *rpmVeritySignFile(rpmfi fi, size_t *sig_size, char *key,
uint8_t *sig = NULL;
int status;
file_size = rpmfiFSize(fi);
if (S_ISLNK(rpmfiFMode(fi)))
file_size = 0;
else
file_size = rpmfiFSize(fi);
memset(&params, 0, sizeof(struct libfsverity_merkle_tree_params));
params.version = 1;