From 2fa5c80aeba4528b3bdf41ec5740e7db5d4b6d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Thu, 18 Aug 2022 10:43:19 +0200 Subject: [PATCH] cpp: Fix handling of "no key" or "invalid time" situations * lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp (GpgAddExistingSubkeyEditInteractor::Private::nextState): Fix inverted logic of string comparisons. -- This fixes the problem that the interactor didn't return the proper error code if gpg didn't accept the key grip or the expiration date. GnuPG-bug-id: 6137 --- lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp index 547e613d..8eec7460 100644 --- a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp +++ b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp @@ -136,7 +136,7 @@ unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int strcmp(args, "keygen.flags") == 0) { return FLAGS; } else if (status == GPGME_STATUS_GET_LINE && - strcmp(args, "keygen.keygrip")) { + strcmp(args, "keygen.keygrip") == 0) { err = NO_KEY_ERROR; return ERROR; } @@ -157,7 +157,7 @@ unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int strcmp(args, "keyedit.prompt") == 0) { return QUIT; } else if (status == GPGME_STATUS_GET_LINE && - strcmp(args, "keygen.valid")) { + strcmp(args, "keygen.valid") == 0) { err = INV_TIME_ERROR; return ERROR; }