chantra / rpms / rpm

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