Panu Matilainen 6dc5ba
commit 507f21f6bb4bf7029a0bca255cfe4aae3361f358
Panu Matilainen 6dc5ba
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 6dc5ba
Date:   Thu Dec 17 08:43:31 2009 +0200
Panu Matilainen 6dc5ba
Panu Matilainen 6dc5ba
    Permit unexpanded macros to slip through spec tag sanity checks (RhBug:547997)
Panu Matilainen 6dc5ba
    - For now, let %{} characters through our valid character set checks
Panu Matilainen 6dc5ba
      on specs. This isn't right really, but unexpanded, unrelated macros
Panu Matilainen 6dc5ba
      in spec can now cause failure to parse out buildrequires which would
Panu Matilainen 6dc5ba
      allow those macros to be expanded. This needs a better fix.
Panu Matilainen 6dc5ba
Panu Matilainen 6dc5ba
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
Panu Matilainen 6dc5ba
index 82744fd..b5f1780 100644
Panu Matilainen 6dc5ba
--- a/build/parsePreamble.c
Panu Matilainen 6dc5ba
+++ b/build/parsePreamble.c
Panu Matilainen 6dc5ba
@@ -517,13 +517,13 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
Panu Matilainen 6dc5ba
     switch (tag) {
Panu Matilainen 6dc5ba
     case RPMTAG_NAME:
Panu Matilainen 6dc5ba
 	SINGLE_TOKEN_ONLY;
Panu Matilainen 6dc5ba
-	if (rpmCharCheck(spec, field, strlen(field), ".-_+") != RPMRC_OK) return RPMRC_FAIL;
Panu Matilainen 6dc5ba
+	if (rpmCharCheck(spec, field, strlen(field), ".-_+%{}") != RPMRC_OK) return RPMRC_FAIL;
Panu Matilainen 6dc5ba
 	headerPutString(pkg->header, tag, field);
Panu Matilainen 6dc5ba
 	break;
Panu Matilainen 6dc5ba
     case RPMTAG_VERSION:
Panu Matilainen 6dc5ba
     case RPMTAG_RELEASE:
Panu Matilainen 6dc5ba
 	SINGLE_TOKEN_ONLY;
Panu Matilainen 6dc5ba
-	if (rpmCharCheck(spec, field, strlen(field), "._+") != RPMRC_OK) return RPMRC_FAIL;
Panu Matilainen 6dc5ba
+	if (rpmCharCheck(spec, field, strlen(field), "._+%{}") != RPMRC_OK) return RPMRC_FAIL;
Panu Matilainen 6dc5ba
 	headerPutString(pkg->header, tag, field);
Panu Matilainen 6dc5ba
 	break;
Panu Matilainen 6dc5ba
     case RPMTAG_URL:
Panu Matilainen 6dc5ba
diff --git a/build/parseReqs.c b/build/parseReqs.c
Panu Matilainen 6dc5ba
index 1a657a6..d12aca3 100644
Panu Matilainen 6dc5ba
--- a/build/parseReqs.c
Panu Matilainen 6dc5ba
+++ b/build/parseReqs.c
Panu Matilainen 6dc5ba
@@ -168,7 +168,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTag tagN,
Panu Matilainen 6dc5ba
 	    }
Panu Matilainen 6dc5ba
 	    EVR = xmalloc((ve-v) + 1);
Panu Matilainen 6dc5ba
 	    rstrlcpy(EVR, v, (ve-v) + 1);
Panu Matilainen 6dc5ba
-	    if (rpmCharCheck(spec, EVR, ve-v, ".-_+:")) goto exit;
Panu Matilainen 6dc5ba
+	    if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}")) goto exit;
Panu Matilainen 6dc5ba
 	    re = ve;	/* ==> next token after EVR string starts here */
Panu Matilainen 6dc5ba
 	} else
Panu Matilainen 6dc5ba
 	    EVR = NULL;