talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 8aaf0276c11cecaca09672e440c421df2e0b2e22
parent 1225798a8760c4dc40452168ce0147694dd7ea5f
Author: Ricardo Mones <ricardo@mones.org>
Date:   Thu, 15 Dec 2022 13:27:14 +0100

Exclude LDAP debug functions unless requested

Diffstat:
Mconfigure.ac | 12++++++++++++
Msrc/addrindex.c | 4+++-
Msrc/ldapctrl.c | 5+++--
Msrc/ldapctrl.h | 5+++--
Msrc/ldapquery.c | 14++++++++++----
Msrc/ldapquery.h | 5+++--
Msrc/ldapserver.c | 14++++++++------
Msrc/ldapserver.h | 5+++--
8 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -337,6 +337,10 @@ AC_ARG_ENABLE(addressbook-debug, [ --enable-addressbook-debug Build with addressbook debug calls], [enable_addressbook_debug=$enableval], [enable_addressbook_debug=no]) +AC_ARG_ENABLE(ldap-debug, + [ --enable-ldap-debug Build with LDAP debug calls], + [enable_ldap_debug=$enableval], [enable_ldap_debug=no]) + manualdir='${docdir}/manual' AC_ARG_WITH(manualdir, [ --with-manualdir=DIR Manual directory], @@ -1062,6 +1066,14 @@ else AC_MSG_RESULT(no) fi +AC_MSG_CHECKING([whether to build LDAP debug calls]) +if test x$enable_ldap_debug = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(DEBUG_LDAP, 1, [Define if you want LDAP debug calls]) +else + AC_MSG_RESULT(no) +fi + dnl ************************* dnl ** section for plugins ** dnl ************************* diff --git a/src/addrindex.c b/src/addrindex.c @@ -1460,7 +1460,9 @@ static AddressDataSource *addrindex_parse_ldap( XMLFile *file ) { } g_free( criteria ); } - /* ldapsvr_print_data( server, stdout ); */ +#ifdef DEBUG_LDAP + ldapsvr_print_data( server, stdout ); +#endif return ds; } diff --git a/src/ldapctrl.c b/src/ldapctrl.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2003-2021 the Claws Mail team and Match Grun + * Copyright (C) 2003-2022 the Claws Mail team and Match Grun * * 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 @@ -14,7 +14,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * */ /* @@ -322,6 +321,7 @@ void ldapctl_free( LdapControl *ctl ) { g_free( ctl ); } +#ifdef DEBUG_LDAP /** * Display object to specified stream. * \param ctl Control object to process. @@ -363,6 +363,7 @@ void ldapctl_print( const LdapControl *ctl, FILE *stream ) { } pthread_mutex_unlock( ctl->mutexCtl ); } +#endif /** * Copy member variables to specified object. Mutex lock object is diff --git a/src/ldapctrl.h b/src/ldapctrl.h @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2003-2012 Match Grun and the Claws Mail team + * Copyright (C) 2003-2022 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 @@ -14,7 +14,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * */ /* @@ -99,7 +98,9 @@ GList *ldapctl_get_criteria_list( const LdapControl* ctl ); void ldapctl_criteria_list_clear( LdapControl *ctl ); void ldapctl_criteria_list_add ( LdapControl *ctl, gchar *attr ); void ldapctl_free ( LdapControl *ctl ); +#ifdef DEBUG_LDAP void ldapctl_print ( const LdapControl *ctl, FILE *stream ); +#endif void ldapctl_copy ( const LdapControl *ctlFrom, LdapControl *ctlTo ); gchar *ldapctl_format_criteria ( LdapControl *ctl, const gchar *searchVal ); diff --git a/src/ldapquery.c b/src/ldapquery.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2003-2018 Match Grun and the Claws Mail team + * Copyright (C) 2003-2022 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 @@ -695,13 +695,17 @@ static gint ldapqry_connect( LdapQuery *qry ) { /* Initialize connection */ if (debug_get_mode()) { debug_print("===ldapqry_connect===\n"); - /*ldapqry_print(qry, stdout);*/ +#ifdef DEBUG_LDAP + ldapqry_print(qry, stdout); +#endif } ctl = qry->control; - /*if (debug_get_mode()) { +#ifdef DEBUG_LDAP + if (debug_get_mode()) { ldapctl_print(ctl, stdout); debug_print("======\n"); - }*/ + } +#endif ldapqry_touch( qry ); qry->startTime = qry->touchTime; qry->elapsedTime = -1; @@ -1348,6 +1352,7 @@ gboolean ldapquery_remove_results( LdapQuery *qry ) { return retVal; } +#ifdef DEBUG_LDAP void ldapqry_print(LdapQuery *qry, FILE *stream) { cm_return_if_fail( qry != NULL ); @@ -1363,6 +1368,7 @@ void ldapqry_print(LdapQuery *qry, FILE *stream) { fprintf(stream, "touchTime: %d\n", (int) qry->touchTime); fprintf(stream, "data: %s\n", qry->data?(gchar *)qry->data:"null"); } +#endif #endif /* USE_LDAP */ diff --git a/src/ldapquery.h b/src/ldapquery.h @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2003-2012 Match Grun and the Claws Mail team + * Copyright (C) 2003-2022 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 @@ -14,7 +14,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * */ /* @@ -74,7 +73,9 @@ struct _NameValuePair { }; /* Function prototypes */ +#ifdef DEBUG_LDAP void ldapqry_print(LdapQuery *qry, FILE *stream); +#endif void ldapqry_initialize ( void ); LdapQuery *ldapqry_create ( void ); void ldapqry_set_control ( LdapQuery *qry, LdapControl *ctl ); diff --git a/src/ldapserver.c b/src/ldapserver.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2003-2021 the Claws Mail team and Match Grun + * Copyright (C) 2003-2022 the Claws Mail team and Match Grun * * 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 @@ -119,11 +119,11 @@ gint ldapsvr_get_status( LdapServer *server ) { */ ItemFolder *ldapsvr_get_root_folder( LdapServer *server ) { cm_return_val_if_fail( server != NULL, NULL ); - /* - g_print( "ldapsvr_get_root_folder/start\n" ); +#ifdef DEBUG_LDAP + debug_print( "ldapsvr_get_root_folder/start\n" ); ldapsvr_print_data( server, stdout ); - g_print( "ldapsvr_get_root_folder/done\n" ); - */ + debug_print( "ldapsvr_get_root_folder/done\n" ); +#endif return addrcache_get_root_folder( server->addressCache ); } @@ -277,10 +277,11 @@ void ldapsvr_free( LdapServer *server ) { g_free( server ); } +#ifdef DEBUG_LDAP /** * Display object to specified stream. * \param server Server object. - * \param stream Output stream. + * \param stream Output stream. */ void ldapsvr_print_data( LdapServer *server, FILE *stream ) { GList *node; @@ -311,6 +312,7 @@ void ldapsvr_print_data( LdapServer *server, FILE *stream ) { node = g_list_next( node ); } } +#endif /** * Return link list of persons. diff --git a/src/ldapserver.h b/src/ldapserver.h @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 2003-2012 Match Grun and the Claws Mail team + * Copyright (C) 2003-2022 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 @@ -14,7 +14,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. - * */ /* @@ -91,7 +90,9 @@ gboolean ldapsvr_get_search_flag( LdapServer *server ); void ldapsvr_set_search_flag ( LdapServer *server, const gboolean value ); gint ldapsvr_read_data ( LdapServer *server ); +#ifdef DEBUG_LDAP void ldapsvr_print_data ( LdapServer *server, FILE *stream ); +#endif void ldapsvr_cancel_read ( LdapServer *server ); ItemFolder *ldapsvr_get_root_folder ( LdapServer *server );