Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chris2511 committed Oct 24, 2021
2 parents 13b0992 + 8c0a5ad commit 3e858c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/db_x509.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@ void db_x509::certRenewal(QModelIndexList indexes)
CertExtend *dlg = NULL;
x509rev r;
bool doRevoke = false;
bool doReplace = false;

if (indexes.size() == 0)
return;
Expand All @@ -866,6 +867,7 @@ void db_x509::certRenewal(QModelIndexList indexes)
r = revoke->getRevocation();
delete revoke;
}
doReplace = dlg->replace->isChecked();
foreach(idx, indexes) {
oldcert = fromIndex<pki_x509>(idx);
if (!oldcert)
Expand All @@ -891,6 +893,10 @@ void db_x509::certRenewal(QModelIndexList indexes)
newcert->sign(signkey, oldcert->getDigest());
newcert = dynamic_cast<pki_x509 *>(insert(newcert));
createSuccess(newcert);

// delete old certificate if requested
if (doReplace)
deletePKI(idx);
}
if (doRevoke)
do_revoke(indexes, r);
Expand Down
10 changes: 10 additions & 0 deletions ui/CertExtend.ui
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@
<property name="text">
<string>Revoke old certificate</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="replace">
<property name="text">
<string>Replace old certificate</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
Expand Down

0 comments on commit 3e858c8

Please sign in to comment.