diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-05-07 18:33:50 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-05-07 18:33:50 +0000 |
commit | 60f877ad5f2190ef2454777804e136b391da472c (patch) | |
tree | 7868dabf3b2f86bf43aea07a02573816a948e636 /res/res_config_ldap.c | |
parent | aeb41dbdf4619e6e860a250414425b5f14b44dc9 (diff) |
Only save a password if a username exists.
(closes issue #12600)
Reported By: suretec
Patch by me
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@115523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_config_ldap.c')
-rw-r--r-- | res/res_config_ldap.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c index 52855fdec..33ed247b7 100644 --- a/res/res_config_ldap.c +++ b/res/res_config_ldap.c @@ -1401,11 +1401,14 @@ int parse_config(void) } 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"))) { |