#include "addr_compl.h"
#include "utils.h"
#include "alertpanel.h"
+#include "passwordstore.h"
#ifndef DEV_STANDALONE
#include "prefs_gtk.h"
break;
}
}
- xtag = xtagPrev;
}
/* Build list of search attributes */
gboolean bDynSearch;
gboolean bTLS, bSSL;
gint iMatch;
+ gchar *password = NULL;
/* g_print( "addrindex_parse_ldap\n" ); */
/* Set up some defaults */
ldapctl_set_bind_dn( ctl, value );
}
else if( strcmp( name, ATTAG_LDAP_BIND_PASS ) == 0 ) {
- ldapctl_set_bind_password( ctl, value, FALSE, FALSE );
+ password = value;
}
else if( strcmp( name, ATTAG_LDAP_CRITERIA ) == 0 ) {
g_free( criteria );
attr = g_list_next( attr );
}
+ if (password != NULL)
+ passwd_store_set(PWS_CORE, "LDAP", ctl->hostName, password, TRUE);
+
server = ldapsvr_create_noctl();
ldapsvr_set_name( server, serverName );
ldapsvr_set_search_flag( server, bDynSearch );
return -1;
if (addrindex_write_attr( fp, ATTAG_LDAP_BIND_DN, ctl->bindDN ) < 0)
return -1;
- if (addrindex_write_attr( fp, ATTAG_LDAP_BIND_PASS, ctl->bindPass ) < 0)
- return -1;
sprintf( value, "%d", ctl->maxEntries );
if (addrindex_write_attr( fp, ATTAG_LDAP_MAX_ENTRY, value ) < 0)
fileSpec = NULL;
return addrIndex->retVal;
fail:
- g_warning("error writing AB index\n");
+ g_warning("error writing AB index");
addrIndex->retVal = MGU_ERROR_WRITE;
if (pfile)
prefs_file_close_revert( pfile );
node->list = g_list_append( node->list, newNode );
}
else {
- /* g_print( "invalid: !!! \n" ); */
- attr = xml_get_current_tag_attr( file );
+ g_warning("Invalid tag");
}
}
}
folderpath must not be empty or NULL */
if( ! addressbook_peek_folder_exists( folderpath, &book, &folder ) ) {
- g_warning("addrindex_load_completion: folder path '%s' doesn't exist\n", folderpath);
+ g_warning("addrindex_load_completion: folder path '%s' doesn't exist", folderpath);
return FALSE;
}
return TRUE;
} else {
- g_warning("addrindex_load_completion: book/folder path is valid but got no pointer\n");
+ g_warning("addrindex_load_completion: book/folder path is valid but got no pointer");
}
}
return FALSE;
return filename;
}
+#ifdef USE_LDAP
+GSList *addrindex_get_password_protected_ldap_servers()
+{
+ AddressInterface *iface;
+ AddressDataSource *ds;
+ GList *nodeIf;
+ GList *nodeDS;
+ GSList *list = NULL;
+ LdapServer *server;
+ LdapControl *ctl;
+
+ nodeIf = _addressIndex_->searchOrder;
+ while (nodeIf) {
+ iface = nodeIf->data;
+ nodeIf = g_list_next(nodeIf);
+
+ if (!iface->useInterface)
+ continue;
+ if (!iface->externalQuery)
+ continue;
+ if (iface->type != ADDR_IF_LDAP)
+ continue;
+
+ nodeDS = iface->listSource;
+ while (nodeDS) {
+ ds = nodeDS->data;
+ nodeDS = g_list_next(nodeDS);
+ server = ds->rawDataSource;
+ if (!server->searchFlag)
+ continue;
+
+ ctl = server->control;
+
+ if (!ctl)
+ continue;
+
+ if (ctl->bindDN != NULL && strlen(ctl->bindDN)) {
+ list = g_slist_append(list, server);
+ }
+ }
+ }
+
+ return list;
+}
+#endif /* USE_LDAP */
+
/*
* End of Source.
*/