diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-11-25 16:42:43 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-11-25 16:42:43 +0200 |
commit | 2b41860984f0c4ebba5ebce93a18c9c0ca5e1065 (patch) | |
tree | 7dfb2fbcff611b6ce81f5c4f8792d4e9860074df /lib | |
parent | 98213fc4192c7af07037a0f3e9cce9e3b8509c02 (diff) | |
download | librpm-tizen-2b41860984f0c4ebba5ebce93a18c9c0ca5e1065.tar.gz librpm-tizen-2b41860984f0c4ebba5ebce93a18c9c0ca5e1065.tar.bz2 librpm-tizen-2b41860984f0c4ebba5ebce93a18c9c0ca5e1065.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/signature.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/signature.c b/lib/signature.c index cd95e1304..7d50db7a5 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -653,6 +653,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; default: /* This case should have been screened out long ago. */ rpmlog(RPMLOG_ERR, _("Invalid %%_signature spec in macro file\n")); @@ -668,7 +669,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) |