forked from osmocom/wireshark
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>
This commit is contained in:
parent
7b04a4f797
commit
9feb7fb522
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ¤t, const QModelIndex &previous);
|
||||
void on_addLibraryButton_clicked();
|
||||
void on_deleteLibraryButton_clicked();
|
||||
#endif /* HAVE_LIBGNUTLS */
|
||||
};
|
||||
|
||||
#endif /* RSA_KEYS_FRAME_H */
|
||||
|
|
Loading…
Reference in New Issue