/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001-2006 Match Grun and the Sylpheed-Claws team
+ * Copyright (C) 2001-2007 Match Grun and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
/*
*ptr = ' ';
ptr++;
}
+ debug_print("cleaned criteria list: %s\n", criteria);
/* Parse string */
splitStr = g_strsplit( criteria, " ", 0 );
g_strchomp( sPass ); g_strchug( sPass );
if( *sHost != '\0' ) {
/* Test connection to server */
+ debug_print("ldap server: %s\nport: %d\nssl: %d\ntls: %d\nbindDN: %s\n", sHost, iPort, ssl, tls, sBind);
if( ldaputil_test_connect( sHost, iPort, ssl, tls ) ) {
/* Attempt to read base DN */
baseDN = ldaputil_read_basedn( sHost, iPort, sBind, sPass, iTime, ssl, tls );
if( sBaseDN ) {
/* Load search DN */
+ debug_print("baseDN: %s\n", sBaseDN);
gtk_entry_set_text(GTK_ENTRY(ldapedit.entry_baseDN), sBaseDN);
g_free( sBaseDN );
}
g_strchomp( sHost ); g_strchug( sHost );
g_strchomp( sBind ); g_strchug( sBind );
g_strchomp( sPass ); g_strchug( sPass );
+ debug_print("ldap server: %s\nport: %d\nssl: %d\ntls: %d\nbindDN: %s\n", sHost, iPort, ssl, tls, sBind);
selectDN = edit_ldap_basedn_selection( sHost, iPort, sBase, iTime, sBind, sPass, ssl, tls );
if( selectDN ) {
gtk_entry_set_text(GTK_ENTRY(ldapedit.entry_baseDN), selectDN);
g_free( sPass );
}
-static void edit_ldap_search_reset( void ) {
- gtk_entry_set_text(GTK_ENTRY(ldapedit.entry_criteria), LDAPCTL_DFL_ATTR_LIST );
+static void edit_ldap_search_reset(void) {
+ gtk_entry_set_text(GTK_ENTRY(ldapedit.entry_criteria), LDAPCTL_DFL_ATTR_LIST);
}
static void addressbook_edit_ldap_dialog_create( gboolean *cancelled ) {
GtkWidget *hsbox;
GtkWidget *statusbar;
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ debug_print("creating edit_ldap_dialog\n");
+ window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "editldap");
gtk_widget_set_size_request(window, 450, -1);
gtk_container_set_border_width(GTK_CONTAINER(window), 0);
gtk_window_set_title(GTK_WINDOW(window), _("Edit LDAP Server"));
gtk_spin_button_set_value(
GTK_SPIN_BUTTON( ldapedit.spinbtn_port ),
val ? LDAPCTL_DFL_SSL_PORT:LDAPCTL_DFL_PORT );
+ debug_print("Setting port: %d\n", val ? LDAPCTL_DFL_SSL_PORT:LDAPCTL_DFL_PORT);
}
static void addressbook_edit_ldap_page_basic( gint pageNum, gchar *pageLbl ) {
GtkObject *spinbtn_port_adj;
GtkWidget *spinbtn_port;
#ifdef USE_LDAP_TLS
- GtkWidget *enable_ssl_chkbtn, *enable_tls_chkbtn;
+ GtkWidget *enable_ssl_checkbtn, *enable_tls_checkbtn;
#endif
GtkWidget *entry_baseDN;
GtkWidget *check_btn;
"\"ldap.mydomain.com\" may be appropriate for the " \
"\"mydomain.com\" organization. An IP address may also be " \
"used. You may specify \"localhost\" if running an LDAP " \
- "server on the same computer as Sylpheed-Claws." ),
+ "server on the same computer as Claws Mail." ),
NULL );
/* Next row */
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_port), TRUE);
#ifdef USE_LDAP_TLS
- enable_tls_chkbtn = gtk_check_button_new_with_label(_("TLS"));
- enable_ssl_chkbtn = gtk_check_button_new_with_label(_("SSL"));
- SET_TOGGLE_SENSITIVITY_REVERSE(enable_tls_chkbtn, enable_ssl_chkbtn);
- SET_TOGGLE_SENSITIVITY_REVERSE(enable_ssl_chkbtn, enable_tls_chkbtn);
- gtk_tooltips_set_tip( toolTip, enable_tls_chkbtn, _(
+ enable_tls_checkbtn = gtk_check_button_new_with_label(_("TLS"));
+ enable_ssl_checkbtn = gtk_check_button_new_with_label(_("SSL"));
+ SET_TOGGLE_SENSITIVITY_REVERSE(enable_tls_checkbtn, enable_ssl_checkbtn);
+ SET_TOGGLE_SENSITIVITY_REVERSE(enable_ssl_checkbtn, enable_tls_checkbtn);
+ gtk_tooltips_set_tip( toolTip, enable_tls_checkbtn, _(
"Enable secure connection to the LDAP server via TLS."
"If connection fails, be sure to check the correct "
- "configuration in ldap.conf (TLS_CACERT or TLS_CACERTDIR fields)." ),
+ "configuration in ldap.conf (TLS_CACERTDIR and TLS_REQCERT fields)." ),
NULL );
- gtk_tooltips_set_tip( toolTip, enable_ssl_chkbtn, _(
+ gtk_tooltips_set_tip( toolTip, enable_ssl_checkbtn, _(
"Enable secure connection to the LDAP server via SSL."
"If connection fails, be sure to check the correct "
- "configuration in ldap.conf (TLS_CACERT or TLS_CACERTDIR fields)." ),
+ "configuration in ldap.conf (TLS_CACERTDIR and TLS_REQCERT fields)." ),
NULL );
- gtk_box_pack_start (GTK_BOX (hbox_spin), enable_tls_chkbtn, TRUE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox_spin), enable_ssl_chkbtn, TRUE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_spin), enable_tls_checkbtn, TRUE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_spin), enable_ssl_checkbtn, TRUE, FALSE, 0);
#endif
gtk_table_attach(GTK_TABLE(table), hbox_spin, 1, 2, top, (top + 1),
gtk_tooltips_set_tip( toolTip, entry_baseDN, _(
"This specifies the name of the directory to be searched " \
"on the server. Examples include:\n" \
- " dc=sylpheed,dc=org\n" \
+ " dc=claws-mail,dc=org\n" \
" ou=people,dc=domainname,dc=com\n" \
" o=Organization Name,c=Country\n"
),
ldapedit.spinbtn_port = spinbtn_port;
ldapedit.entry_baseDN = entry_baseDN;
#ifdef USE_LDAP_TLS
- ldapedit.enable_ssl = enable_ssl_chkbtn;
- ldapedit.enable_tls = enable_tls_chkbtn;
+ ldapedit.enable_ssl = enable_ssl_checkbtn;
+ ldapedit.enable_tls = enable_tls_checkbtn;
- g_signal_connect(G_OBJECT(enable_ssl_chkbtn), "toggled", \
+ g_signal_connect(G_OBJECT(enable_ssl_checkbtn), "toggled", \
G_CALLBACK(editldap_update_port), NULL);
#endif
}
gtk_tooltips_set_tip( toolTip, entry_bindDN, _(
"The LDAP user account name to be used to connect to the server. " \
"This is usually only used for protected servers. This name " \
- "is typically formatted as: \"cn=user,dc=sylpheed,dc=com\". " \
+ "is typically formatted as: \"cn=user,dc=claws-mail,dc=org\". " \
"This is usually left empty when performing a search." ),
NULL );
gtk_widget_show_all( ldapedit.window );
}
-void edit_ldap_set_optmenu( GtkOptionMenu *optmenu, const gint value ) {
- GList *cur;
- GtkWidget *menu;
- GtkWidget *menuitem;
- gint menuVal;
- gint n = 0;
-
- g_return_if_fail(optmenu != NULL);
-
- menu = gtk_option_menu_get_menu(optmenu);
- for( cur = GTK_MENU_SHELL(menu)->children; cur != NULL; cur = cur->next ) {
- menuitem = GTK_WIDGET(cur->data);
- menuVal = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), "user_data"));
- if( menuVal == value ) {
- gtk_option_menu_set_history(optmenu, n);
- return;
- }
- n++;
- }
- gtk_option_menu_set_history(optmenu, 0);
-}
-
-gint edit_ldap_get_optmenu( GtkOptionMenu *optmenu ) {
- GtkWidget *menu;
- GtkWidget *menuitem;
-
- g_return_val_if_fail(optmenu != NULL, -1);
-
- menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu));
- menuitem = gtk_menu_get_active(GTK_MENU(menu));
- return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), "user_data"));
-}
-
/**
* Format criteria list for display.
* \param ctl Control object.
/**
* Clear entry fields to reasonable defaults (for a new server entry).
*/
-static void edit_ldap_clear_fields( void ) {
+static void edit_ldap_clear_fields(void) {
gtk_entry_set_text(
GTK_ENTRY(ldapedit.entry_name), ADDRESSBOOK_GUESS_LDAP_NAME );
gtk_entry_set_text(
gtk_spin_button_set_value(
GTK_SPIN_BUTTON( ldapedit.spinbtn_maxentry ), LDAPCTL_DFL_TIMEOUT );
gtk_entry_set_text(
- GTK_ENTRY(ldapedit.entry_criteria), LDAPCTL_DFL_ATTR_LIST );
+ GTK_ENTRY(ldapedit.entry_criteria), LDAPCTL_DFL_ATTR_LIST);
gtk_spin_button_set_value(
GTK_SPIN_BUTTON(ldapedit.spinbtn_queryage), LDAPCTL_DFL_QUERY_AGE );
gtk_toggle_button_set_active(
if( ctl->bindPass )
gtk_entry_set_text(
GTK_ENTRY(ldapedit.entry_bindPW), ctl->bindPass );
- gtk_spin_button_set_value(
- GTK_SPIN_BUTTON(ldapedit.spinbtn_port), ctl->port );
gtk_spin_button_set_value(
GTK_SPIN_BUTTON(ldapedit.spinbtn_timeout), ctl->timeOut );
gtk_spin_button_set_value(
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON(ldapedit.enable_ssl), ctl->enableSSL );
#endif
+ gtk_spin_button_set_value(
+ GTK_SPIN_BUTTON(ldapedit.spinbtn_port), ctl->port );
/* Format criteria */
crit = editldap_build_criteria_list( ctl );
if( crit ) {
tls = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON( ldapedit.enable_tls ) );
#endif
+ debug_print("saving server config:\nname: %s\nhost: %s\nbase: %s\ncriteria: %s\nbind: %s\nport: %d\ntime: %d\nmax_entries: %d\ntimeout: %d\ndynamic: %d\ncheck_match: %d\n",sName, sHost, sBase, sCrit, sBind, iPort, iTime, iMaxE, iAge, bSrch, bMatch);
fin = FALSE;
if( *sName == '\0' ) fin = TRUE;
if( *sHost == '\0' ) fin = TRUE;