cpp: Fix adding duplicated sigs on multiple uids
authorAndre Heinecke <aheinecke@gnupg.org>
Fri, 1 Nov 2019 11:02:07 +0000 (12:02 +0100)
committerAndre Heinecke <aheinecke@gnupg.org>
Fri, 1 Nov 2019 11:02:07 +0000 (12:02 +0100)
* lang/cpp/src/gpgsignkeyeditinteractor.cpp: Add another
state DUPE_OK2 to allow gpg looping over all uids.

--
When duplicated signatures should be added to multiple
user ids GnuPG will ask for each uid so we have to
add a transition for that.

GnuPG-Bug-Id: T4734

lang/cpp/src/gpgsignkeyeditinteractor.cpp

index d43d2f9..80c5f12 100644 (file)
@@ -162,6 +162,7 @@ enum SignKeyState {
     CONFIRM,
     CONFIRM2,
     DUPE_OK,
+    DUPE_OK2,
     QUIT,
     SAVE,
     ERROR = EditInteractor::ErrorState
@@ -197,6 +198,7 @@ static GpgSignKeyEditInteractor_Private::TransitionMap makeTable()
     addEntry(SET_EXPIRE, GET_BOOL, "sign_uid.class", SET_CHECK_LEVEL);
     addEntry(CONFIRM, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM);
     addEntry(DUPE_OK, GET_BOOL, "sign_uid.okay", CONFIRM);
+    addEntry(DUPE_OK2, GET_BOOL, "sign_uid.okay", CONFIRM);
     addEntry(CONFIRM, GET_BOOL, "sign_uid.okay", CONFIRM);
     addEntry(CONFIRM2, GET_BOOL, "sign_uid.okay", CONFIRM);
     addEntry(CONFIRM, GET_LINE, "keyedit.prompt", COMMAND);
@@ -210,6 +212,8 @@ static GpgSignKeyEditInteractor_Private::TransitionMap makeTable()
     addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
     addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.okay", CONFIRM);
     addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
+    addEntry(DUPE_OK, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK2);
+    addEntry(DUPE_OK2, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
     addEntry(CONFIRM, GET_LINE, "keyedit.prompt", QUIT);
     addEntry(ERROR, GET_LINE, "keyedit.prompt", QUIT);
     addEntry(QUIT, GET_BOOL, "keyedit.save.okay", SAVE);
@@ -242,6 +246,7 @@ const char *GpgSignKeyEditInteractor::action(Error &err) const
     case SET_CHECK_LEVEL:
         return check_level_strings[d->checkLevel];
     case DUPE_OK:
+    case DUPE_OK2:
         return answer(d->dupeOk);
     case CONFIRM2:
     case CONFIRM: