commit e0f41407ce397eed880ba0360d9b5725f9176ed8
parent 48f72c22f91fbe0d6e872e89bd4dce9d39090e81
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Sun, 10 Dec 2017 10:49:02 +0100
Fix bug 3931: segfault searching server with master password
Request master passphrase earlier and inhibit search if no master
passphrase is available.
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/addressbook.c b/src/addressbook.c
@@ -49,6 +49,7 @@
#include "codeconv.h"
#include "about.h"
#include "addr_compl.h"
+#include "password.h"
#include "mgutils.h"
#include "addressitem.h"
@@ -4695,6 +4696,10 @@ static void addressbook_lup_clicked( GtkButton *button, gpointer data ) {
AddressInterface *iface;
gchar *searchTerm;
GtkCMCTreeNode *node, *parentNode;
+#ifdef USE_LDAP
+ LdapServer *ldap_server;
+ LdapControl *ldap_ctl;
+#endif
node = addrbook.treeSelected;
if( ! node ) return;
@@ -4720,6 +4725,21 @@ static void addressbook_lup_clicked( GtkButton *button, gpointer data ) {
if( ! iface->haveLibrary ) return;
if( ! iface->externalQuery ) return;
+#ifdef USE_LDAP
+ if (iface->type == ADDR_IF_LDAP) {
+ ldap_server = ds->rawDataSource;
+ ldap_ctl = ldap_server->control;
+ if (ldap_ctl != NULL &&
+ ldap_ctl->bindDN != NULL && strlen(ldap_ctl->bindDN) > 0) {
+ /* LDAP server is password-protected. */
+ if (master_passphrase() == NULL) {
+ /* User did not enter master passphrase, do not start a search. */
+ return;
+ }
+ }
+ }
+#endif
+
searchTerm =
gtk_editable_get_chars( GTK_EDITABLE(addrbook.entry), 0, -1 );
g_strchomp( searchTerm );