cpp: Fix adding duplicated sigs on multiple uids

* 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
This commit is contained in:
Andre Heinecke 2019-11-01 12:02:07 +01:00
parent a4d5394b46
commit 266e05eee8
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

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