summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2015-08-18 17:12:26 +0200
committerAndre Heinecke <[email protected]>2015-08-18 18:06:03 +0200
commit1b954394030e52a1602e7e5d7c272b6d838d9aba (patch)
tree526d9c5eec62b016f08c353c3be3d0139ac142da
parent9accc171a356315ed7abae3532093cc08688a916 (diff)
Add support for gpgme_set_offline
gpgme_set_offline is required so that we can do a CMS keylisting with verification but without CRL checks. This is required to fix bug 339385. REVIEW: 124803
-rw-r--r--src/ConfigureChecks.cmake9
-rw-r--r--src/config-gpgme++.h.cmake3
-rw-r--r--src/context.cpp17
-rw-r--r--src/context.h3
4 files changed, 32 insertions, 0 deletions
diff --git a/src/ConfigureChecks.cmake b/src/ConfigureChecks.cmake
index 4075109..14ccbb0 100644
--- a/src/ConfigureChecks.cmake
+++ b/src/ConfigureChecks.cmake
@@ -429,6 +429,15 @@ check_cxx_source_compiles ("
}
" HAVE_GPGME_CONF_ARG_NEW_WITH_CONST_VALUE )
+# check if gpgme has offline mode support (new in 1.5.6)
+check_cxx_source_compiles ("
+ #include <gpgme.h>
+ int main() {
+ gpgme_set_offline( NULL, 1 );
+ return 0;
+ }
+" HAVE_GPGME_CTX_OFFLINE )
+
set(CMAKE_EXTRA_INCLUDE_FILES gpgme.h)
# defined in gpgme versions >= 1.4.2
check_type_size(gpgme_ssize_t GPGME_SSIZE_T)
diff --git a/src/config-gpgme++.h.cmake b/src/config-gpgme++.h.cmake
index 982f5cd..c5a6cfd 100644
--- a/src/config-gpgme++.h.cmake
+++ b/src/config-gpgme++.h.cmake
@@ -124,6 +124,9 @@ static inline void gpg_err_set_errno( int x ) { errno = x; }
/* Define to 1 if your gpgme_conf_arg_new takes its 'value' parameter as const void* */
#cmakedefine HAVE_GPGME_CONF_ARG_NEW_WITH_CONST_VALUE 1
+/* Define to 1 if gpgme supports the context offline mode* */
+#cmakedefine HAVE_GPGME_CTX_OFFLINE 1
+
#ifndef GPGMEPP_ERR_SOURCE_DEFAULT
#define GPGMEPP_ERR_SOURCE_DEFAULT 22
#endif
diff --git a/src/context.cpp b/src/context.cpp
index 0e98c6f..ab633d7 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -371,6 +371,23 @@ bool Context::textMode() const
return gpgme_get_textmode(d->ctx);
}
+void Context::setOffline(bool useOfflineMode)
+{
+#ifdef HAVE_GPGME_CTX_OFFLINE
+ gpgme_set_offline(d->ctx, int(useOfflineMode));
+#else
+ Q_UNUSED(useOfflineMode);
+#endif
+}
+bool Context::offline() const
+{
+#ifdef HAVE_GPGME_CTX_OFFLINE
+ return gpgme_get_offline(d->ctx);
+#else
+ return false;
+#endif
+}
+
void Context::setIncludeCertificates(int which)
{
if (which == DefaultCertificates) {
diff --git a/src/context.h b/src/context.h
index e36fe1d..ee4f847 100644
--- a/src/context.h
+++ b/src/context.h
@@ -84,6 +84,9 @@ public:
void setTextMode(bool useTextMode);
bool textMode() const;
+ void setOffline(bool useOfflineMode);
+ bool offline() const;
+
enum CertificateInclusion {
DefaultCertificates = -256,
AllCertificatesExceptRoot = -2,