* Don't check the signature unless we have to.

This commit is contained in:
Eelco Dolstra 2007-03-01 12:30:24 +00:00
parent 2ea3bebc23
commit b4a040e52b

View file

@ -840,6 +840,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
if (haveSignature) {
string signature = readString(hashAndReadSource);
if (requireSignature) {
Path sigFile = tmpDir + "/sig";
writeStringToFile(sigFile, signature);
@ -853,8 +854,8 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
args.push_back(sigFile);
string hash2 = runProgram("openssl", true, args);
/* Note: runProgram() throws an exception if the signature is
invalid. */
/* Note: runProgram() throws an exception if the signature
is invalid. */
if (printHash(hash) != hash2)
throw Error(
@ -862,6 +863,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
"archive; archive could be corrupt, or someone is trying "
"to import a Trojan horse");
}
}
/* Do the actual import. */