diff options
author | jbj <devnull@localhost> | 1999-03-22 17:31:53 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-03-22 17:31:53 +0000 |
commit | bd3990b81cbd1df9b5b5164ef32e44158288e95f (patch) | |
tree | 15494bdeb8a5bd8aeb2c14485297034e91591e8f | |
parent | 7944ca9ba3f29bc3a2f6ba69d2d0c55f080d6e6d (diff) | |
download | rpm-bd3990b81cbd1df9b5b5164ef32e44158288e95f.tar.gz rpm-bd3990b81cbd1df9b5b5164ef32e44158288e95f.tar.bz2 rpm-bd3990b81cbd1df9b5b5164ef32e44158288e95f.zip |
fix: don't add header if signature generation failed (Carlo Wood).
CVS patchset: 2909
CVS date: 1999/03/22 17:31:53
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | build/files.c | 2 | ||||
-rw-r--r-- | build/pack.c | 2 | ||||
-rw-r--r-- | build/parseChangelog.c | 8 | ||||
-rw-r--r-- | checksig.c | 2 | ||||
-rw-r--r-- | lib/cpio.c | 2 | ||||
-rw-r--r-- | lib/install.c | 6 | ||||
-rw-r--r-- | lib/oldheader.c | 2 | ||||
-rw-r--r-- | lib/problems.c | 2 | ||||
-rw-r--r-- | lib/rpmlib.h | 2 | ||||
-rw-r--r-- | lib/rpmrc.c | 9 | ||||
-rw-r--r-- | lib/signature.c | 77 | ||||
-rw-r--r-- | lib/signature.h | 7 | ||||
-rw-r--r-- | po/rpm.pot | 105 | ||||
-rw-r--r-- | popt/po/popt.pot | 2 | ||||
-rw-r--r-- | popt/popt.c | 2 | ||||
-rw-r--r-- | popt/test1.c | 2 | ||||
-rwxr-xr-x | rpm.c | 17 | ||||
-rw-r--r-- | url.c | 2 |
19 files changed, 141 insertions, 111 deletions
@@ -2,6 +2,7 @@ - eliminate old rpmrc configuration syntax. - pgp5 support (Carlo Wood <carlo@runaway.xs4all.nl>) - fix: segfault from double close on ftpGetFileDesc ftpAbort path. + - fix: don't add header if signature generation failed (Carlo Wood). 2.91 -> 2.92 - update with libtool-2.4f. diff --git a/build/files.c b/build/files.c index 54eb10e6a..a915d9a52 100644 --- a/build/files.c +++ b/build/files.c @@ -1046,7 +1046,7 @@ static int processBinaryFile(Package pkg, struct FileList *fl, const char *fileN /* check that file starts with leading "/" */ if (*fileName != '/') { - rpmError(RPMERR_BADSPEC, _("File needs leading \"/\": %s"), *fileName); + rpmError(RPMERR_BADSPEC, _("File needs leading \"/\": %s"), fileName); fl->processingFailed = 1; return 1; } diff --git a/build/pack.c b/build/pack.c index 8a3a25d99..dad770477 100644 --- a/build/pack.c +++ b/build/pack.c @@ -340,7 +340,7 @@ int writeRPM(Header header, const char *fileName, int type, } /* Generate the signature */ - sigtype = rpmLookupSignatureType(); + sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY); fflush(stdout); sig = rpmNewSignature(); rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase); diff --git a/build/parseChangelog.c b/build/parseChangelog.c index 87c58f377..10658255d 100644 --- a/build/parseChangelog.c +++ b/build/parseChangelog.c @@ -63,15 +63,15 @@ static int dateToTimet(const char * datestr, time_t * secs) /* make this noon so the day is always right (as we make this UTC) */ time.tm_hour = 12; - time.tm_mday = strtol(chptr, &chptr, 10); - if (*chptr) return -1; + time.tm_mday = strtol(chptr, &end, 10); + if (!(end && *end == '\0')) return -1; if (time.tm_mday < 0 || time.tm_mday > lengths[time.tm_mon]) return -1; /* year */ if ((chptr = strtok(NULL, " \t\n")) == NULL) return -1; - time.tm_year = strtol(chptr, &chptr, 10); - if (*chptr) return -1; + time.tm_year = strtol(chptr, &end, 10); + if (!(end && *end == '\0')) return -1; if (time.tm_year < 1997 || time.tm_year >= 3000) return -1; time.tm_year -= 1900; diff --git a/checksig.c b/checksig.c index 008ac6233..318ff44ac 100644 --- a/checksig.c +++ b/checksig.c @@ -87,7 +87,7 @@ int doReSign(int add, char *passPhrase, const char **argv) } /* Generate the signature */ - sigtype = rpmLookupSignatureType(); + sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY); rpmMessage(RPMMESS_VERBOSE, _("Generating signature: %d\n"), sigtype); if (add != ADD_SIGNATURE) { sig = rpmNewSignature(); diff --git a/lib/cpio.c b/lib/cpio.c index ae40dd4fe..78c4a51c1 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -359,7 +359,7 @@ static int expandRegular(CFD_t * cfd, struct cpioHeader * hdr, strcpy(buf, hdr->path); strcat(buf, "-RPMDELETE"); if (rename(hdr->path, buf)) { - fprintf(stderr, _("can't rename %s to %x: %s\n"), + fprintf(stderr, _("can't rename %s to %s: %s\n"), hdr->path, buf, strerror(errno)); return CPIOERR_UNLINK_FAILED; } diff --git a/lib/install.c b/lib/install.c index 9ed8a7f70..0995bc94b 100644 --- a/lib/install.c +++ b/lib/install.c @@ -205,9 +205,9 @@ static void trimChangelog(Header h) { xfree(buf); } - if (*end) { - rpmError(RPMERR_RPMRC, _("instchangelog value in rpmrc should be a " - "number, but isn't")); + if (!(end && *end == '\0')) { + rpmError(RPMERR_RPMRC, _("%%instchangelog value in macro file should " + "be a number, but isn't")); return; } diff --git a/lib/oldheader.c b/lib/oldheader.c index 75a3d96bf..cbd4d2d19 100644 --- a/lib/oldheader.c +++ b/lib/oldheader.c @@ -289,7 +289,7 @@ void oldrpmfileFromInfoLine(char * path, char * state, char * str, else if (!strcmp(state, "replaced")) fi->state = RPMFILE_STATE_REPLACED; else - rpmError(RPMERR_INTERNAL, _("bad file state: "), state); + rpmError(RPMERR_INTERNAL, _("bad file state: %s"), state); infoFromFields(fields, fi); diff --git a/lib/problems.c b/lib/problems.c index 3f4f82c85..b35ec6d8e 100644 --- a/lib/problems.c +++ b/lib/problems.c @@ -64,7 +64,7 @@ char * rpmProblemString(rpmProblem prob) { break; case RPMPROB_DISKSPACE: - sprintf(buf, _("installing package %s-%s-%s needs %d%c on the %s" + sprintf(buf, _("installing package %s-%s-%s needs %ld%c on the %s" " filesystem"), name, version, release, prob.ulong1 > (1024*1024) ? (prob.ulong1 + 1024 * 1024 - 1) / (1024 * 1024) : diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 3467cc2c8..0006cf333 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -480,7 +480,7 @@ struct oldrpmlead { /* for version 1 packages */ typedef void (*rpmErrorCallBackType)(void); -void rpmError(int code, char * format, ...); +void rpmError(int code, char * format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); int rpmErrorCode(void); char *rpmErrorCodeString(void); char *rpmErrorString(void); diff --git a/lib/rpmrc.c b/lib/rpmrc.c index c36f458a1..3a2dc99ac 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -758,7 +758,7 @@ static int doReadRC(FD_t fd, const char * filename) { strcpy(buf, start); if (expandMacros(NULL, &globalMacroContext, buf, sizeof(buf))) { - rpmError(RPMERR_RPMRC, _("expansion failed at %s:d \"%s\""), + rpmError(RPMERR_RPMRC, _("expansion failed at %s:%d \"%s\""), filename, linenum, start); return 1; } @@ -1034,17 +1034,16 @@ char *rpmGetVar(int var) int rpmGetBooleanVar(int var) { char * val; int num; - char * chptr; + char * end; val = rpmGetVar(var); if (!val) return 0; if (val[0] == 'y' || val[0] == 'Y') return 1; - num = strtol(val, &chptr, 0); - if (chptr && *chptr == '\0') { + num = strtol(val, &end, 0); + if (end && *end == '\0') return num != 0; - } return 0; } diff --git a/lib/signature.c b/lib/signature.c index 2b99b1c17..715e22987 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -36,25 +36,41 @@ static int verifyGPGSignature(const char *datafile, void *sig, int count, char *result); static int checkPassPhrase(const char *passPhrase, const int sigTag); -int rpmLookupSignatureType(void) +int rpmLookupSignatureType(int action) { - const char *name = rpmExpand("%{_signature}", NULL); - int rc; - - if (!(name && *name != '%')) - rc = 0; - else if (!strcasecmp(name, "none")) - rc = 0; - else if (!strcasecmp(name, "pgp")) - rc = RPMSIGTAG_PGP; - else if (!strcasecmp(name, "pgp5")) - rc = RPMSIGTAG_PGP5; - else if (!strcasecmp(name, "gpg")) - rc = RPMSIGTAG_GPG; - else - rc = -1; - - xfree(name); + static int rc = 0; + + switch (action) + { + case RPMLOOKUPSIG_DISABLE: + rc = -2; + return 0; + case RPMLOOKUPSIG_ENABLE: + rc = 0; + /* fall through */ + case RPMLOOKUPSIG_QUERY: + if (rc == -2) + return 0; /* Disabled */ + else + { + const char *name = rpmExpand("%{_signature}", NULL); + if (!(name && *name != '%')) + rc = 0; + else if (!strcasecmp(name, "none")) + rc = 0; + else if (!strcasecmp(name, "pgp")) + rc = RPMSIGTAG_PGP; + else if (!strcasecmp(name, "pgp5")) + rc = RPMSIGTAG_PGP5; + else if (!strcasecmp(name, "gpg")) + rc = RPMSIGTAG_GPG; + else + rc = -1; /* Invalid %_signature spec in macro file */ + xfree(name); + } + break; + } + return rc; } @@ -65,7 +81,7 @@ const char * rpmDetectPGPVersion(int sigTag) { /* Actually this should support having more then one pgp version. */ /* At the moment only one version is possible since we only */ - /* have one %__pgp and one pgp_path. */ + /* have one %_pgpbin and one %_pgp_path. */ static int pgp_version; const char *pgpbin = rpmGetPath("%{_pgpbin}", NULL); @@ -216,29 +232,34 @@ int rpmAddSignature(Header header, const char *file, int_32 sigTag, const char * int_32 size; unsigned char buf[16]; void *sig; + int ret = -1; switch (sigTag) { case RPMSIGTAG_SIZE: stat(file, &statbuf); size = statbuf.st_size; + ret = 0; headerAddEntry(header, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1); break; case RPMSIGTAG_MD5: - mdbinfile(file, buf); - headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16); + ret = mdbinfile(file, buf); + if (ret == 0) + headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16); break; case RPMSIGTAG_PGP: case RPMSIGTAG_PGP5: - makePGPSignature(file, &sig, &size, passPhrase, sigTag); - headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size); + ret = makePGPSignature(file, &sig, &size, passPhrase, sigTag); + if (ret == 0) + headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size); break; case RPMSIGTAG_GPG: - makeGPGSignature(file, &sig, &size, passPhrase); - headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size); + ret = makeGPGSignature(file, &sig, &size, passPhrase); + if (ret == 0) + headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size); break; } - return 0; + return ret; } static int makePGPSignature(const char *file, void **sig, int_32 *size, @@ -710,7 +731,7 @@ char *rpmGetPassPhrase(const char *prompt, const int sigTag) /* Currently the calling function (rpm.c:main) is checking this and * doing a better job. This section should never be accessed. */ - rpmError(RPMERR_SIGGEN, _("Invalid signature spec in rc file")); + rpmError(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file")); return NULL; } @@ -790,7 +811,7 @@ static int checkPassPhrase(const char *passPhrase, const int sigTag) _exit(RPMERR_EXEC); } break; default: /* This case should have been screened out long ago. */ - rpmError(RPMERR_SIGGEN, _("Invalid signature spec in rc file")); + rpmError(RPMERR_SIGGEN, _("Invalid %%_signature spec in macro file")); _exit(RPMERR_SIGGEN); break; } diff --git a/lib/signature.h b/lib/signature.h index f7ac50aba..9c87fb8bf 100644 --- a/lib/signature.h +++ b/lib/signature.h @@ -43,8 +43,13 @@ int rpmAddSignature(Header header, const char *file, /******************************************************************/ +/* Possible actions for rpmLookupSignatureType() */ +#define RPMLOOKUPSIG_QUERY 0 /* Lookup type in effect */ +#define RPMLOOKUPSIG_DISABLE 1 /* Disable (--sign was not given) */ +#define RPMLOOKUPSIG_ENABLE 2 /* Re-enable %_signature */ + /* Return type of signature in effect for building */ -int rpmLookupSignatureType(void); +int rpmLookupSignatureType(int action); /* Utility to read a pass phrase from the user */ char *rpmGetPassPhrase(const char *prompt, const int sigTag); diff --git a/po/rpm.pot b/po/rpm.pot index 85728a17b..1b5e39204 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-03-22 11:02-0500\n" +"POT-Creation-Date: 1999-03-22 12:20-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -1367,7 +1367,7 @@ msgid "pgp not found: " msgstr "" #: ../rpm.c:1114 -msgid "Use `signature: pgp5' instead of `signature: pgp' in spec file.\n" +msgid "Use `%%_signature pgp5' instead of `%%_signature pgp' in macro file.\n" msgstr "" #: ../rpm.c:1121 @@ -1375,7 +1375,7 @@ msgid "pgp version 5 not found: " msgstr "" #: ../rpm.c:1124 -msgid "Use `signature: pgp' instead of `signature: pgp5' in spec file.\n" +msgid "Use `%%_signature pgp' instead of `%%_signature pgp5' in macro file.\n" msgstr "" #: ../rpm.c:1131 @@ -1386,59 +1386,59 @@ msgstr "" msgid "Pass phrase is good.\n" msgstr "" -#: ../rpm.c:1140 -msgid "Invalid signature spec in rc file.\n" +#: ../rpm.c:1141 +msgid "Invalid %%_signature spec in macro file.\n" msgstr "" -#: ../rpm.c:1145 +#: ../rpm.c:1146 msgid "--sign may only be used during package building" msgstr "" -#: ../rpm.c:1160 +#: ../rpm.c:1163 msgid "exec failed\n" msgstr "" -#: ../rpm.c:1179 +#: ../rpm.c:1182 msgid "unexpected arguments to --querytags " msgstr "" -#: ../rpm.c:1190 +#: ../rpm.c:1193 msgid "no packages given for signature check" msgstr "" -#: ../rpm.c:1198 +#: ../rpm.c:1201 msgid "no packages given for signing" msgstr "" -#: ../rpm.c:1207 +#: ../rpm.c:1210 msgid "no packages files given for rebuild" msgstr "" -#: ../rpm.c:1264 +#: ../rpm.c:1267 msgid "no spec files given for build" msgstr "" -#: ../rpm.c:1266 +#: ../rpm.c:1269 msgid "no tar files given for build" msgstr "" -#: ../rpm.c:1279 +#: ../rpm.c:1282 msgid "no packages given for uninstall" msgstr "" -#: ../rpm.c:1327 +#: ../rpm.c:1330 msgid "no packages given for install" msgstr "" -#: ../rpm.c:1349 +#: ../rpm.c:1352 msgid "extra arguments given for query of all packages" msgstr "" -#: ../rpm.c:1355 +#: ../rpm.c:1358 msgid "no arguments given for query" msgstr "" -#: ../rpm.c:1373 +#: ../rpm.c:1376 msgid "no arguments given for verify" msgstr "" @@ -2211,7 +2211,7 @@ msgstr "" #: ../lib/cpio.c:362 #, c-format -msgid "can't rename %s to %x: %s\n" +msgid "can't rename %s to %s: %s\n" msgstr "" #: ../lib/cpio.c:368 @@ -2434,7 +2434,7 @@ msgid "group %s does not exist - using root" msgstr "" #: ../lib/install.c:209 -msgid "instchangelog value in rpmrc should be a number, but isn't" +msgid "%%instchangelog value in macro file should be a number, but isn't" msgstr "" #: ../lib/install.c:275 @@ -2616,7 +2616,8 @@ msgid "error creating temporary file %s" msgstr "" #: ../lib/oldheader.c:292 -msgid "bad file state: " +#, c-format +msgid "bad file state: %s" msgstr "" #: ../lib/package.c:51 @@ -3017,7 +3018,7 @@ msgstr "" #: ../lib/rpmrc.c:761 #, c-format -msgid "expansion failed at %s:d \"%s\"" +msgid "expansion failed at %s:%d \"%s\"" msgstr "" #: ../lib/rpmrc.c:767 @@ -3035,138 +3036,138 @@ msgstr "" msgid "bad option '%s' at %s:%d" msgstr "" -#: ../lib/rpmrc.c:1206 +#: ../lib/rpmrc.c:1205 #, c-format msgid "Unknown system: %s\n" msgstr "" -#: ../lib/rpmrc.c:1207 +#: ../lib/rpmrc.c:1206 msgid "Please contact rpm-list@redhat.com\n" msgstr "" -#: ../lib/signature.c:129 +#: ../lib/signature.c:145 msgid "No signature\n" msgstr "" -#: ../lib/signature.c:132 +#: ../lib/signature.c:148 msgid "Old PGP signature\n" msgstr "" -#: ../lib/signature.c:145 +#: ../lib/signature.c:161 msgid "Old (internal-only) signature! How did you get that!?" msgstr "" -#: ../lib/signature.c:149 +#: ../lib/signature.c:165 msgid "New Header signature\n" msgstr "" #. 8-byte pad -#: ../lib/signature.c:157 ../lib/signature.c:195 +#: ../lib/signature.c:173 ../lib/signature.c:211 #, c-format msgid "Signature size: %d\n" msgstr "" -#: ../lib/signature.c:158 ../lib/signature.c:196 +#: ../lib/signature.c:174 ../lib/signature.c:212 #, c-format msgid "Signature pad : %d\n" msgstr "" -#: ../lib/signature.c:283 ../lib/signature.c:789 +#: ../lib/signature.c:304 ../lib/signature.c:810 msgid "Couldn't exec pgp" msgstr "" -#: ../lib/signature.c:294 +#: ../lib/signature.c:315 msgid "pgp failed" msgstr "" #. PGP failed to write signature #. Just in case -#: ../lib/signature.c:301 +#: ../lib/signature.c:322 msgid "pgp failed to write signature" msgstr "" -#: ../lib/signature.c:306 +#: ../lib/signature.c:327 #, c-format msgid "PGP sig size: %d\n" msgstr "" -#: ../lib/signature.c:317 ../lib/signature.c:393 +#: ../lib/signature.c:338 ../lib/signature.c:414 msgid "unable to read the signature" msgstr "" -#: ../lib/signature.c:322 +#: ../lib/signature.c:343 #, c-format msgid "Got %d bytes of PGP sig\n" msgstr "" -#: ../lib/signature.c:359 ../lib/signature.c:764 +#: ../lib/signature.c:380 ../lib/signature.c:785 msgid "Couldn't exec gpg" msgstr "" -#: ../lib/signature.c:370 +#: ../lib/signature.c:391 msgid "gpg failed" msgstr "" #. GPG failed to write signature #. Just in case -#: ../lib/signature.c:377 +#: ../lib/signature.c:398 msgid "gpg failed to write signature" msgstr "" -#: ../lib/signature.c:382 +#: ../lib/signature.c:403 #, c-format msgid "GPG sig size: %d\n" msgstr "" -#: ../lib/signature.c:398 +#: ../lib/signature.c:419 #, c-format msgid "Got %d bytes of GPG sig\n" msgstr "" -#: ../lib/signature.c:413 +#: ../lib/signature.c:434 #, c-format msgid "sigsize : %d\n" msgstr "" -#: ../lib/signature.c:414 +#: ../lib/signature.c:435 #, c-format msgid "Header + Archive: %d\n" msgstr "" -#: ../lib/signature.c:415 +#: ../lib/signature.c:436 #, c-format msgid "expected size : %d\n" msgstr "" -#: ../lib/signature.c:419 +#: ../lib/signature.c:440 msgid "file is not regular -- skipping size check\n" msgstr "" -#: ../lib/signature.c:537 ../lib/signature.c:584 +#: ../lib/signature.c:558 ../lib/signature.c:605 msgid "Could not run pgp. Use --nopgp to skip PGP checks." msgstr "" -#: ../lib/signature.c:582 ../lib/signature.c:654 +#: ../lib/signature.c:603 ../lib/signature.c:675 msgid "exec failed!\n" msgstr "" -#: ../lib/signature.c:656 +#: ../lib/signature.c:677 msgid "Could not run gpg. Use --nogpg to skip GPG checks." msgstr "" -#: ../lib/signature.c:693 +#: ../lib/signature.c:714 msgid "You must set \"%%_gpg_name\" in your macro file" msgstr "" -#: ../lib/signature.c:705 +#: ../lib/signature.c:726 msgid "You must set \"%%_pgp_name\" in your macro file" msgstr "" #. Currently the calling function (rpm.c:main) is checking this and #. * doing a better job. This section should never be accessed. #. -#: ../lib/signature.c:713 ../lib/signature.c:793 -msgid "Invalid signature spec in rc file" +#: ../lib/signature.c:734 ../lib/signature.c:814 +msgid "Invalid %%_signature spec in macro file" msgstr "" #: ../lib/transaction.c:744 diff --git a/popt/po/popt.pot b/popt/po/popt.pot index 9df8ebe85..8a3d5b9e1 100644 --- a/popt/po/popt.pot +++ b/popt/po/popt.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-03-08 21:55-0500\n" +"POT-Creation-Date: 1999-03-22 12:03-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/popt/popt.c b/popt/popt.c index b4564ae6b..98c439bf8 100644 --- a/popt/popt.c +++ b/popt/popt.c @@ -407,7 +407,7 @@ int poptGetNextOpt(poptContext con) { case POPT_ARG_INT: case POPT_ARG_LONG: aLong = strtol(con->os->nextArg, &end, 0); - if (*end) + if (!(end && *end == '\0')) return POPT_ERROR_BADNUMBER; if (aLong == LONG_MIN || aLong == LONG_MAX) diff --git a/popt/test1.c b/popt/test1.c index 90ac9c68c..0039415d0 100644 --- a/popt/test1.c +++ b/popt/test1.c @@ -7,7 +7,7 @@ #include "popt.h" -void option_callback(poptContext con, enum poptCallbackReason reason, +static void option_callback(poptContext con, enum poptCallbackReason reason, const struct poptOption * opt, char * arg, void * data) { fprintf(stdout, "callback: %c %s %s ", opt->val, (char *) data, arg); @@ -1100,7 +1100,7 @@ int main(int argc, char ** argv) { if (errors) return errors; if (poptPeekArg(optCon)) { - switch (sigTag = rpmLookupSignatureType()) { + switch (sigTag = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) { case 0: break; case RPMSIGTAG_GPG: @@ -1111,7 +1111,7 @@ int main(int argc, char ** argv) { fprintf(stderr, _("pgp not found: ")); if (rpmDetectPGPVersion(RPMSIGTAG_PGP5)) { fprintf(stderr, - _("Use `signature: pgp5' instead of `signature: pgp' in spec file.\n")); + _("Use `%%_signature pgp5' instead of `%%_signature pgp' in macro file.\n")); exit(EXIT_FAILURE); } /* Fall through to default: */ @@ -1121,7 +1121,7 @@ int main(int argc, char ** argv) { fprintf(stderr, _("pgp version 5 not found: ")); if (rpmDetectPGPVersion(RPMSIGTAG_PGP)) { fprintf(stderr, - _("Use `signature: pgp' instead of `signature: pgp5' in spec file.\n")); + _("Use `%%_signature pgp' instead of `%%_signature pgp5' in macro file.\n")); exit(EXIT_FAILURE); } /* Fall through to default: */ @@ -1137,16 +1137,19 @@ int main(int argc, char ** argv) { } /* Fall through */ default: - fprintf(stderr, _("Invalid signature spec in rc file.\n")); + fprintf(stderr, + _("Invalid %%_signature spec in macro file.\n")); exit(EXIT_FAILURE); } } } else { argerror(_("--sign may only be used during package building")); } - } else { - /* Override any rpmrc setting */ - addMacro(&globalMacroContext, "_signature", NULL, "none", RMIL_CMDLINE); + } + else + { + /* Make rpmLookupSignatureType() return 0 ("none") from now on */ + rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE); } if (pipeOutput) { @@ -267,7 +267,7 @@ int urlSplit(const char * url, urlinfo **uret) if (u->portstr != NULL && u->portstr[0] != '\0') { char *end; u->port = strtol(u->portstr, &end, 0); - if (*end) { + if (!(end && *end == '\0')) { rpmMessage(RPMMESS_ERROR, _("url port must be a number\n")); if (myurl) free(myurl); freeUrlinfo(u); |