summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2018-11-27 13:40:21 +0200
committerPanu Matilainen <pmatilai@redhat.com>2020-03-26 11:57:58 +0200
commit7ab6779e9b8bbdee53a75ec68a5e29910ca15268 (patch)
tree74b71036a450732d46ebf38c1d3ab2a5bb8aceb9
parent7e5a3ef4250fe760c99a9caea9eed899bc84178b (diff)
downloadrpm-7ab6779e9b8bbdee53a75ec68a5e29910ca15268.tar.gz
Consolidate allowed version/release/evr allowed characters to macros
Maintaining multiple variants of the same thing, that always worked soooooo well... No functional changes here. Unless I truly messed up.
-rw-r--r--build/parsePreamble.c2
-rw-r--r--build/parseReqs.c2
-rw-r--r--build/rpmbuild_internal.h2
3 files changed, 4 insertions, 2 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index d2f1a3eff..0d133853a 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -767,7 +767,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
case RPMTAG_VERSION:
case RPMTAG_RELEASE:
SINGLE_TOKEN_ONLY;
- if (rpmCharCheck(spec, field, "._+%{}~"))
+ if (rpmCharCheck(spec, field, WHITELIST_VERREL))
goto exit;
headerPutString(pkg->header, tag, field);
break;
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 715b25e45..5f904e24c 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -57,7 +57,7 @@ static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
rasprintf(emsg, _("Versioned file name not permitted"));
return RPMRC_FAIL;
}
- if (rpmCharCheck(spec, EVR, ".-_+:%{}~"))
+ if (rpmCharCheck(spec, EVR, WHITELIST_EVR))
return RPMRC_FAIL;
if (checkSep(EVR, '-', emsg) != RPMRC_OK ||
checkSep(EVR, ':', emsg) != RPMRC_OK ||
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index cc9de88f9..c76de7c43 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -18,6 +18,8 @@
#undef HTDATATYPE
#define WHITELIST_NAME ".-_+%{}"
+#define WHITELIST_VERREL "._+%{}~"
+#define WHITELIST_EVR WHITELIST_VERREL "-:"
struct TriggerFileEntry {
int index;