aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-01-31 12:14:00 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-01-31 13:14:22 +0000
commit9feb7fb5225765aa2eba97e33b169727a376931d (patch)
treedc339d39a27d040e0be6c1962ca30e27b3473db5
parent7b04a4f797ce6001f33df3cc99896b1fa53103ff (diff)
Fix build without GnuTLS
The RSA Keys API and GUI are only functional when GnuTLS support is available. Be sure to hide the functions in the header and hide the preferences panel when GnuTLS support is missing. Change-Id: I0a52ab142c4d45b8186780ea9b1645542dcc6305 Fixes: v2.9.1rc0-585-gec8f506c4b ("Qt: add initial RSA Keys preference frame") Reviewed-on: https://code.wireshark.org/review/31837 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--epan/secrets.h2
-rw-r--r--ui/qt/models/pref_models.cpp2
-rw-r--r--ui/qt/preferences_dialog.cpp4
-rw-r--r--ui/qt/rsa_keys_frame.cpp8
-rw-r--r--ui/qt/rsa_keys_frame.h4
5 files changed, 17 insertions, 3 deletions
diff --git a/epan/secrets.h b/epan/secrets.h
index 4cae812aa3..facff22994 100644
--- a/epan/secrets.h
+++ b/epan/secrets.h
@@ -79,6 +79,7 @@ typedef void (*secrets_block_callback_t)(const void *secrets, guint size);
*/
void secrets_register_type(guint32 secrets_type, secrets_block_callback_t cb);
+#ifdef HAVE_LIBGNUTLS
/**
* Retrieve a list of available key URIs. PKCS #11 token URIs begin with
* "pkcs11:".
@@ -100,7 +101,6 @@ secrets_get_available_keys(void);
WS_DLL_PUBLIC gboolean
secrets_verify_key(const char *uri, const char *password, gboolean *need_password, char **error);
-#ifdef HAVE_LIBGNUTLS
/** Returns a new hash table, mapping cert_key_id_t -> gnutls_privkey_t. */
GHashTable *privkey_hash_table_new(void);
diff --git a/ui/qt/models/pref_models.cpp b/ui/qt/models/pref_models.cpp
index 10bb05ed10..0f5784dbbb 100644
--- a/ui/qt/models/pref_models.cpp
+++ b/ui/qt/models/pref_models.cpp
@@ -322,8 +322,10 @@ void PrefsModel::populate()
root_->prependChild(special_item);
special_item = new PrefsItem(FILTER_BUTTONS_PREFERENCE_TREE_NAME, root_);
root_->prependChild(special_item);
+#ifdef HAVE_LIBGNUTLS
special_item = new PrefsItem(RSA_KEYS_PREFERENCE_TREE_NAME, root_);
root_->prependChild(special_item);
+#endif
special_item = new PrefsItem(ADVANCED_PREFERENCE_TREE_NAME, root_);
root_->prependChild(special_item);
}
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index 6fb634bdc3..8f0ffacd80 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -218,7 +218,9 @@ void PreferencesDialog::on_buttonBox_accepted()
pd_ui_->columnFrame->unstash();
pd_ui_->filterExpressonsFrame->acceptChanges();
pd_ui_->expertFrame->acceptChanges();
+#ifdef HAVE_LIBGNUTLS
pd_ui_->rsaKeysFrame->acceptChanges();
+#endif
//Filter expressions don't affect dissection, so there is no need to
//send any events to that effect. However, the app needs to know
@@ -279,7 +281,9 @@ void PreferencesDialog::on_buttonBox_rejected()
//handle frames that don't have their own OK/Cancel "buttons"
pd_ui_->filterExpressonsFrame->rejectChanges();
pd_ui_->expertFrame->rejectChanges();
+#ifdef HAVE_LIBGNUTLS
pd_ui_->rsaKeysFrame->rejectChanges();
+#endif
}
void PreferencesDialog::on_buttonBox_helpRequested()
diff --git a/ui/qt/rsa_keys_frame.cpp b/ui/qt/rsa_keys_frame.cpp
index 2ce5fc8fbb..8aef1cae67 100644
--- a/ui/qt/rsa_keys_frame.cpp
+++ b/ui/qt/rsa_keys_frame.cpp
@@ -22,6 +22,7 @@
#include <epan/secrets.h>
#include <QInputDialog>
+#ifdef HAVE_LIBGNUTLS
RsaKeysFrame::RsaKeysFrame(QWidget *parent) :
QFrame(parent),
ui(new Ui::RsaKeysFrame),
@@ -52,7 +53,11 @@ RsaKeysFrame::RsaKeysFrame(QWidget *parent) :
connect(ui->keysView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &RsaKeysFrame::keyCurrentChanged);
}
+#else /* ! HAVE_LIBGNUTLS */
+RsaKeysFrame::RsaKeysFrame(QWidget *parent) : QFrame(parent) { }
+#endif /* ! HAVE_LIBGNUTLS */
+#ifdef HAVE_LIBGNUTLS
RsaKeysFrame::~RsaKeysFrame()
{
delete ui;
@@ -67,7 +72,6 @@ gboolean RsaKeysFrame::verifyKey(const char *uri, const char *password, gboolean
return key_ok;
}
-#include <QDebug>
void RsaKeysFrame::addKey(const QString &uri, const QString &password)
{
// Create a new UAT entry with the given URI and PIN/password.
@@ -266,7 +270,7 @@ void RsaKeysFrame::on_deleteLibraryButton_clicked()
report_failure("%s", qPrintable(error));
}
}
-
+#endif /* HAVE_LIBGNUTLS */
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
diff --git a/ui/qt/rsa_keys_frame.h b/ui/qt/rsa_keys_frame.h
index 02b0a90ea4..a3d7c907c5 100644
--- a/ui/qt/rsa_keys_frame.h
+++ b/ui/qt/rsa_keys_frame.h
@@ -12,6 +12,8 @@
#ifndef RSA_KEYS_FRAME_H
#define RSA_KEYS_FRAME_H
+#include <config.h>
+
#include <QFrame>
#include <ui/qt/models/uat_model.h>
@@ -26,6 +28,7 @@ class RsaKeysFrame : public QFrame
public:
explicit RsaKeysFrame(QWidget *parent = NULL);
+#ifdef HAVE_LIBGNUTLS
~RsaKeysFrame();
void acceptChanges();
@@ -48,6 +51,7 @@ private slots:
void libCurrentChanged(const QModelIndex &current, const QModelIndex &previous);
void on_addLibraryButton_clicked();
void on_deleteLibraryButton_clicked();
+#endif /* HAVE_LIBGNUTLS */
};
#endif /* RSA_KEYS_FRAME_H */