summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorroot <devnull@localhost>1996-07-12 19:27:34 +0000
committerroot <devnull@localhost>1996-07-12 19:27:34 +0000
commit2e4837fb6d5bc329c1a0dda2f12d3f5049a6f6bd (patch)
treecaf2efd5368db2c4637f1cd8e8a988091e2261c6 /lib
parentebc8ff6e5798965524ccee5e7de54ecb8ce7e974 (diff)
downloadrpm-2e4837fb6d5bc329c1a0dda2f12d3f5049a6f6bd.tar.gz
rpm-2e4837fb6d5bc329c1a0dda2f12d3f5049a6f6bd.tar.bz2
rpm-2e4837fb6d5bc329c1a0dda2f12d3f5049a6f6bd.zip
add stuff for missing PGP keys
CVS patchset: 800 CVS date: 1996/07/12 19:27:34
Diffstat (limited to 'lib')
-rw-r--r--lib/signature.c14
-rw-r--r--lib/signature.h1
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/signature.c b/lib/signature.c
index e2ac3ad9b..29451424c 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -278,9 +278,7 @@ int verifySignature(char *file, int_32 sigTag, void *sig, int count,
}
break;
case SIGTAG_PGP:
- if (verifyPGPSignature(file, sig, count, result)) {
- return 1;
- }
+ return verifyPGPSignature(file, sig, count, result);
break;
default:
sprintf(result, "Do not know how to verify sig type %d\n", sigTag);
@@ -345,6 +343,7 @@ static int verifyPGPSignature(char *datafile, void *sig,
char *sigfile;
unsigned char buf[8192];
FILE *file;
+ int res = RPMSIG_OK;
/* Write out the signature */
sigfile = tempnam("/var/tmp", "rpmsig");
@@ -380,16 +379,19 @@ static int verifyPGPSignature(char *datafile, void *sig,
buf[0] != '\n') {
strcat(result, buf);
}
+ if (!strncmp("WARNING: Can't find the right public key", buf, 40)) {
+ res = RPMSIG_NOKEY;
+ }
}
fclose(file);
waitpid(pid, &status, 0);
unlink(sigfile);
- if (!WIFEXITED(status) || WEXITSTATUS(status)) {
- return 1;
+ if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
+ res = RPMSIG_BAD;
}
- return 0;
+ return res;
}
char *getPassPhrase(char *prompt)
diff --git a/lib/signature.h b/lib/signature.h
index 07038bc8a..a583a3da8 100644
--- a/lib/signature.h
+++ b/lib/signature.h
@@ -45,6 +45,7 @@
#define RPMSIG_OK 0
#define RPMSIG_UNKNOWN 1
#define RPMSIG_BAD 2
+#define RPMSIG_NOKEY 3 /* Do not have the key to check this signature */
/**************************************************/
/* */