[asterisk-commits] russell: trunk r115523 - /trunk/res/res_config_ldap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 7 13:33:50 CDT 2008


Author: russell
Date: Wed May  7 13:33:50 2008
New Revision: 115523

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115523
Log:
Only save a password if a username exists.

(closes issue #12600)
Reported By: suretec
Patch by me

Modified:
    trunk/res/res_config_ldap.c

Modified: trunk/res/res_config_ldap.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_config_ldap.c?view=diff&rev=115523&r1=115522&r2=115523
==============================================================================
--- trunk/res/res_config_ldap.c (original)
+++ trunk/res/res_config_ldap.c Wed May  7 13:33:50 2008
@@ -1401,11 +1401,14 @@
 	} else 
 		ast_copy_string(user, s, sizeof(user));
 
-	if (!(s = ast_variable_retrieve(config, "_general", "pass"))) {
-		ast_log(LOG_WARNING, "No directory password found, using 'asterisk' as default.\n");
-		ast_copy_string(pass, "asterisk", sizeof(pass) - 1);
-	} else
-		ast_copy_string(pass, s, sizeof(pass));
+	if (!ast_strlen_zero(user)) {
+		if (!(s = ast_variable_retrieve(config, "_general", "pass"))) {
+			ast_log(LOG_WARNING, "No directory password found, using 'asterisk' as default.\n");
+			ast_copy_string(pass, "asterisk", sizeof(pass));
+		} else {
+			ast_copy_string(pass, s, sizeof(pass));
+		}
+	}
 
 	/* URL is preferred, use host and port if not found */
 	if ((s = ast_variable_retrieve(config, "_general", "url"))) {




More information about the asterisk-commits mailing list