aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/gpg_context/GpgContextKeyOpera.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-08-23 08:20:19 +0000
committerSaturneric <[email protected]>2021-08-23 08:20:19 +0000
commitbe69cccea41c17214631529cd265476d31dc3406 (patch)
treed8d36c2a85b5d3ab89f2ce011b7b5ff3294bf1dc /src/gpg/gpg_context/GpgContextKeyOpera.cpp
parentFunctions addition and improvement; (diff)
downloadGpgFrontend-be69cccea41c17214631529cd265476d31dc3406.tar.gz
GpgFrontend-be69cccea41c17214631529cd265476d31dc3406.zip
Improve the automatic key exchange function; fix some known problems;
Diffstat (limited to 'src/gpg/gpg_context/GpgContextKeyOpera.cpp')
-rw-r--r--src/gpg/gpg_context/GpgContextKeyOpera.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gpg/gpg_context/GpgContextKeyOpera.cpp b/src/gpg/gpg_context/GpgContextKeyOpera.cpp
index 5ead0629..4fa2e8c5 100644
--- a/src/gpg/gpg_context/GpgContextKeyOpera.cpp
+++ b/src/gpg/gpg_context/GpgContextKeyOpera.cpp
@@ -115,19 +115,29 @@ bool GpgME::GpgContext::exportKeys(QStringList *uidList, QByteArray *outBuffer)
return false;
}
+ // Alleviate another crash problem caused by an unknown array out-of-bounds access
+ gpgme_ctx_t ctx = create_ctx();
+
for (int i = 0; i < uidList->count(); i++) {
err = gpgme_data_new(&dataOut);
checkErr(err);
- err = gpgme_op_export(mCtx, uidList->at(i).toUtf8().constData(), 0, dataOut);
+ err = gpgme_op_export(ctx, uidList->at(i).toUtf8().constData(), 0, dataOut);
checkErr(err);
read_bytes = gpgme_data_seek(dataOut, 0, SEEK_END);
+ qDebug() << "exportKeys read_bytes" << read_bytes;
+
err = readToBuffer(dataOut, outBuffer);
checkErr(err);
gpgme_data_release(dataOut);
}
+
+ qDebug() << "outBuffer" << *outBuffer;
+
+ gpgme_release(ctx);
+
return true;
}
@@ -188,19 +198,13 @@ void GpgME::GpgContext::fetch_keys() {
return;
}
- qDebug() << "Operate KeyList End";
-
gpgmeError = gpgme_op_keylist_end(mCtx);
if (gpg_err_code(gpgmeError) != GPG_ERR_NO_ERROR) {
checkErr(gpgmeError);
return;
}
- gpgmeError = gpgme_op_keylist_end(mCtx);
- if (gpg_err_code(gpgmeError) != GPG_ERR_NO_ERROR) {
- checkErr(gpgmeError);
- return;
- }
+ qDebug() << "Operate KeyList End";
mKeyList = keys;
}
@@ -343,7 +347,10 @@ bool GpgME::GpgContext::exportSecretKey(const GpgKey &key, QByteArray *outBuffer
* @param expires expire date and time of the signature
* @return if successful
*/
-bool GpgME::GpgContext::signKey(const GpgKey &target, const QString &uid, const QDateTime *expires) {
+bool GpgME::GpgContext::signKey(const GpgKey &target, const QVector<GpgKey> &keys, const QString &uid,
+ const QDateTime *expires) {
+
+ setSigners(keys, mCtx);
unsigned int flags = 0;