[asterisk-commits] branch oej/res_config_ldap r12830 - in /team/oej/res_config_ldap: configs/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 13 12:18:38 MST 2006


Author: oej
Date: Mon Mar 13 13:18:35 2006
New Revision: 12830

URL: http://svn.digium.com/view/asterisk?rev=12830&view=rev
Log:
-small formatting fixes
-adding option_debug checks for some chatty messages

Modified:
    team/oej/res_config_ldap/configs/res_ldap.conf.sample
    team/oej/res_config_ldap/res/res_config_ldap.c

Modified: team/oej/res_config_ldap/configs/res_ldap.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/res_config_ldap/configs/res_ldap.conf.sample?rev=12830&r1=12829&r2=12830&view=diff
==============================================================================
--- team/oej/res_config_ldap/configs/res_ldap.conf.sample (original)
+++ team/oej/res_config_ldap/configs/res_ldap.conf.sample Mon Mar 13 13:18:35 2006
@@ -6,7 +6,7 @@
 ; sip.conf => ldap,"dc=myDomain,dc=myDomainExt",config
 
 
-[general]
+[_general]
 ;dbhost=192.168.1.1,ldap.mydomain.com	; LDAP host(s)
 ;dbbasedn=MyRootDN	; Base DN
 ;dbpass=MyPassword	; Bind password

Modified: team/oej/res_config_ldap/res/res_config_ldap.c
URL: http://svn.digium.com/view/asterisk/team/oej/res_config_ldap/res/res_config_ldap.c?rev=12830&r1=12829&r2=12830&view=diff
==============================================================================
--- team/oej/res_config_ldap/res/res_config_ldap.c (original)
+++ team/oej/res_config_ldap/res/res_config_ldap.c Mon Mar 13 13:18:35 2006
@@ -86,21 +86,25 @@
 /*! \brief Log variable */
 static void ast_variable_log(const char *log_prefix, struct ast_variable *var)
 {
-	ast_log(LOG_DEBUG, "LOG Variable: %s\n", log_prefix);
+	if (option_debug > 1)
+		ast_log(LOG_DEBUG, "LOG Variable: %s\n", log_prefix);
 	while (var) {
 		ast_log(LOG_DEBUG, "%s => %s\n", var->name, var->value);
 		var = var->next;
 	};
-	ast_log(LOG_DEBUG, "END LOG Variable: %s\n", log_prefix);
+	if (option_debug > 1)
+		ast_log(LOG_DEBUG, "END LOG Variable: %s\n", log_prefix);
 }
 
 /*! \brief Log config */
 static void ast_config_log(const char *log_prefix, struct ast_config *config)
 {
-	ast_log(LOG_DEBUG, "LOG Config: %s\n", log_prefix);
+	if (option_debug > 1)
+		ast_log(LOG_DEBUG, "LOG Config: %s\n", log_prefix);
 	char *category_name = NULL;
 	while ((category_name = ast_category_browse(config, category_name))) {
-		ast_log(LOG_DEBUG, "========= category: %s ==========\n",
+		if (option_debug > 1)
+			ast_log(LOG_DEBUG, "========= category: %s ==========\n",
 				category_name);
 		struct ast_variable *var = ast_variable_browse(config, category_name);
 		if (var) {
@@ -110,7 +114,8 @@
 			}
 		}
 	}
-	ast_log(LOG_DEBUG, "END LOG Config: %s\n", log_prefix);
+	if (option_debug > 1)
+		ast_log(LOG_DEBUG, "END LOG Config: %s\n", log_prefix);
 };
 
 /*! \brief Table configuration */
@@ -128,8 +133,7 @@
 /*! \brief Create a new table_config */
 static struct ldap_table_config *table_config_new(const char *table_name)
 {
-	struct ldap_table_config *p = malloc(sizeof(struct ldap_table_config));
-	memset(p, 0, sizeof(struct ldap_table_config));
+	struct ldap_table_config *p = ast_calloc(sizeof(*p));
 	if (table_name)
 		p->table_name = strdup(table_name);
 	return p;
@@ -323,8 +327,7 @@
 	struct ast_variable *var = NULL;
 	struct ast_variable *prev = NULL;
 
-	char *ldap_attribute_name =
-		ldap_first_attribute(ldapConn, ldap_entry, &ber);
+	char *ldap_attribute_name = ldap_first_attribute(ldapConn, ldap_entry, &ber);
 
 	while (ldap_attribute_name) {
 		const char *attribute_name =
@@ -334,13 +337,13 @@
 		char **values = NULL;
 
 		values = ldap_get_values(ldapConn, ldap_entry, ldap_attribute_name);
-		if (!values) {
-		} else {
+		if (values) {
 			char **v = values;
 
 			while (*v) {
 				char *value = *v;
-				ast_log(LOG_DEBUG,
+				if (option_debug > 1)
+					ast_log(LOG_DEBUG,
 						"LDAP RealTime (%d): attribute_name: %s value: %s\n",
 						__LINE__, attribute_name, value);
 				if (is_realmed_password_attribute) {
@@ -348,7 +351,8 @@
 						value += 5;
 					else
 						value = NULL;
-					ast_log(LOG_DEBUG, "LDAP RealTime (%d): md5: %s\n",
+					if (option_debug > 1)
+						ast_log(LOG_DEBUG, "LDAP RealTime (%d): md5: %s\n",
 							__LINE__, value);
 				};
 				if (value) {



More information about the asterisk-commits mailing list