Blame SOURCES/0024-Generate-a-zero-length-signature-for-symlinks.patch

45afda
From 202359dc598f2162175e3a8552c9b338d27b8989 Mon Sep 17 00:00:00 2001
45afda
From: Jes Sorensen <jsorensen@fb.com>
45afda
Date: Tue, 14 Apr 2020 10:33:32 -0400
45afda
Subject: [PATCH 24/33] Generate a zero-length signature for symlinks
45afda
45afda
The fsverity utility follows the symlink when generating a signature.
45afda
Since we don't want to sign the same file twice, we need to skip these
45afda
links, and instead just generate a dummy zero-length signature here.
45afda
45afda
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
45afda
---
45afda
 sign/rpmsignverity.c | 5 ++++-
45afda
 1 file changed, 4 insertions(+), 1 deletion(-)
45afda
45afda
diff --git a/sign/rpmsignverity.c b/sign/rpmsignverity.c
45afda
index 177561957..2c7d21620 100644
45afda
--- a/sign/rpmsignverity.c
45afda
+++ b/sign/rpmsignverity.c
45afda
@@ -45,7 +45,10 @@ static char *rpmVeritySignFile(rpmfi fi, size_t *sig_size, char *key,
45afda
     uint8_t *sig = NULL;
45afda
     int status;
45afda
 
45afda
-    file_size = rpmfiFSize(fi);
45afda
+    if (S_ISLNK(rpmfiFMode(fi)))
45afda
+	file_size = 0;
45afda
+    else
45afda
+	file_size = rpmfiFSize(fi);
45afda
 
45afda
     memset(&params, 0, sizeof(struct libfsverity_merkle_tree_params));
45afda
     params.version = 1;
45afda
-- 
45afda
2.27.0
45afda