chantra / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
f6faf3
From e8fce62467a421132f4ebb6ca9c0926b623ec00e Mon Sep 17 00:00:00 2001
f6faf3
Message-Id: <e8fce62467a421132f4ebb6ca9c0926b623ec00e.1574338687.git.pmatilai@redhat.com>
f6faf3
From: Panu Matilainen <pmatilai@redhat.com>
f6faf3
Date: Tue, 27 Nov 2018 13:40:21 +0200
f6faf3
Subject: [PATCH 1/2] Consolidate allowed version/release/evr allowed
f6faf3
 characters to macros
f6faf3
f6faf3
Maintaining multiple variants of the same thing, that always worked
f6faf3
soooooo well... No functional changes here. Unless I truly messed up.
f6faf3
---
f6faf3
 build/parsePreamble.c     | 2 +-
f6faf3
 build/parseReqs.c         | 2 +-
f6faf3
 build/rpmbuild_internal.h | 2 ++
f6faf3
 3 files changed, 4 insertions(+), 2 deletions(-)
f6faf3
f6faf3
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
f6faf3
index 2d54abeee..f5e06bac8 100644
f6faf3
--- a/build/parsePreamble.c
f6faf3
+++ b/build/parsePreamble.c
f6faf3
@@ -772,7 +772,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
f6faf3
     case RPMTAG_VERSION:
f6faf3
     case RPMTAG_RELEASE:
f6faf3
 	SINGLE_TOKEN_ONLY;
f6faf3
-	if (rpmCharCheck(spec, field, "._+%{}~"))
f6faf3
+	if (rpmCharCheck(spec, field, WHITELIST_VERREL))
f6faf3
 	   goto exit;
f6faf3
 	headerPutString(pkg->header, tag, field);
f6faf3
 	break;
f6faf3
diff --git a/build/parseReqs.c b/build/parseReqs.c
f6faf3
index 2201eebf1..9b081a5ff 100644
f6faf3
--- a/build/parseReqs.c
f6faf3
+++ b/build/parseReqs.c
f6faf3
@@ -57,7 +57,7 @@ static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
f6faf3
             rasprintf(emsg, _("Versioned file name not permitted"));
f6faf3
             return RPMRC_FAIL;
f6faf3
         }
f6faf3
-        if (rpmCharCheck(spec, EVR, ".-_+:%{}~"))
f6faf3
+        if (rpmCharCheck(spec, EVR, WHITELIST_EVR))
f6faf3
             return RPMRC_FAIL;
f6faf3
 	if (checkSep(EVR, '-', emsg) != RPMRC_OK ||
f6faf3
 	    checkSep(EVR, ':', emsg) != RPMRC_OK ||
f6faf3
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
f6faf3
index 86cc549a7..f758e6620 100644
f6faf3
--- a/build/rpmbuild_internal.h
f6faf3
+++ b/build/rpmbuild_internal.h
f6faf3
@@ -18,6 +18,8 @@
f6faf3
 #undef HTDATATYPE
f6faf3
 
f6faf3
 #define WHITELIST_NAME ".-_+%{}"
f6faf3
+#define WHITELIST_VERREL "._+%{}~"
f6faf3
+#define WHITELIST_EVR WHITELIST_VERREL "-:"
f6faf3
 
f6faf3
 struct TriggerFileEntry {
f6faf3
     int index;
f6faf3
-- 
f6faf3
2.23.0
f6faf3