summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-11-25 16:42:43 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-12-02 16:37:30 +0200
commit31c5e0f9b7b09661611b50d84d26ba47ce97fffe (patch)
treeb67e5820bf0431e7a79e847af608af60faa78a5a
parent6eeb0bb06466d9eb75eb55efd514d3ecfe089042 (diff)
downloadrpm-31c5e0f9b7b09661611b50d84d26ba47ce97fffe.tar.gz
Fix signature password checking result on abnormal conditions (RhBug:496754)
- Execve() failure wasn't returning an error code, causing rpm to think the password was ok when we couldn't even try verifying - Stricter return code checking from the password checking child: the password can only be ok if the child exits with WIFEXITED() *and* WIFEXITCODE() of 0. Also WIFEXITCODE() should only be called if WIFEXITED() returns true. (cherry picked from commit 2b41860984f0c4ebba5ebce93a18c9c0ca5e1065)
-rw-r--r--lib/signature.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/signature.c b/lib/signature.c
index a501f3ee2..a2eaf9b41 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -883,6 +883,7 @@ static int checkPassPhrase(const char * passPhrase, const rpmSigTag sigTag)
rpmlog(RPMLOG_ERR, _("Could not exec %s: %s\n"), "gpg",
strerror(errno));
+ _exit(EXIT_FAILURE);
} break;
case RPMSIGTAG_RSA:
case RPMSIGTAG_PGP5: /* XXX legacy */
@@ -932,7 +933,7 @@ static int checkPassPhrase(const char * passPhrase, const rpmSigTag sigTag)
(void) waitpid(pid, &status, 0);
- return ((!WIFEXITED(status) || WEXITSTATUS(status)) ? 1 : 0);
+ return ((WIFEXITED(status) && WEXITSTATUS(status) == 0)) ? 0 : 1;
}
char * rpmGetPassPhrase(const char * prompt, const rpmSigTag sigTag)