lib/ldap_debug_handler.c

説明を見る。
00001 /*
00002  * Unix SMB/CIFS implementation.
00003  * Intercept libldap debug output.
00004  * Copyright (C) Michael Adam 2008
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the Free
00008  * Software Foundation; either version 2 of the License, or (at your option)
00009  * any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00014  * more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along with
00017  * this program; if not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #include "includes.h"
00021 
00022 #if HAVE_LDAP
00023 
00024 static void samba_ldap_log_print_fn(LDAP_CONST char *data)
00025 {
00026         DEBUG(lp_ldap_debug_threshold(), ("[LDAP] %s", data));
00027 }
00028 
00029 #endif
00030 
00031 void init_ldap_debugging(void)
00032 {
00033 #if defined(HAVE_LDAP) && defined(HAVE_LBER_LOG_PRINT_FN)
00034         int ret;
00035         int ldap_debug_level = lp_ldap_debug_level();
00036 
00037         ret = ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug_level);
00038         if (ret != LDAP_OPT_SUCCESS) {
00039                 DEBUG(10, ("Error setting LDAP debug level.\n"));
00040         }
00041 
00042         if (ldap_debug_level == 0) {
00043                 return;
00044         }
00045 
00046         ret = ber_set_option(NULL, LBER_OPT_LOG_PRINT_FN,
00047                              (void *)samba_ldap_log_print_fn);
00048         if (ret != LBER_OPT_SUCCESS) {
00049                 DEBUG(10, ("Error setting LBER log print function.\n"));
00050         }
00051 #endif /* HAVE_LDAP && HAVE_LBER_LOG_PRINT_FN */
00052 }

Sambaに対してSat Aug 29 21:22:58 2009に生成されました。  doxygen 1.4.7