From 69946181642eddbc217f4e3766ea5aab254f33ea Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 7 Feb 2011 10:57:58 -0800 Subject: [PATCH] Use default LDAP protocols, as seem on RHEL 6 https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3171578&group_id=17457 --- ldap-server/ldap-server-lib.pl | 5 +++++ web-lib-funcs.pl | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ldap-server/ldap-server-lib.pl b/ldap-server/ldap-server-lib.pl index 153356b32..705ce16ab 100755 --- a/ldap-server/ldap-server-lib.pl +++ b/ldap-server/ldap-server-lib.pl @@ -758,6 +758,11 @@ if ($gconfig{'os_type'} eq 'redhat-linux') { local %ldap; &read_env_file("/etc/init.d/ldap", \%ldap); &read_env_file("/etc/sysconfig/ldap", \%ldap); + if (!$ldap{'SLAPD_LDAP'} && + !$ldap{'SLAPD_LDAPI'} && + !$ldap{'SLAPD + &read_env_file("/etc/sysconfig/ldap", \%ldap, 1); + } return { 'ldap' => $ldap{'SLAPD_LDAP'} eq 'yes' ? 1 : 0, 'ldapi' => $ldap{'SLAPD_LDAPI'} eq 'yes' ? 1 : 0, 'ldaps' => $ldap{'SLAPD_LDAPS'} eq 'yes' ? 1 : 0, diff --git a/web-lib-funcs.pl b/web-lib-funcs.pl index bc679ac91..f5303087f 100755 --- a/web-lib-funcs.pl +++ b/web-lib-funcs.pl @@ -4798,7 +4798,7 @@ if (!@main::list_languages_cache) { return @main::list_languages_cache; } -=head2 read_env_file(file, &hash) +=head2 read_env_file(file, &hash, [include-commented]) Similar to Webmin's read_file function, but handles files containing shell environment variables formatted like : @@ -4815,6 +4815,10 @@ sub read_env_file local $_; &open_readfile(FILE, $_[0]) || return 0; while() { + if ($_[2]) { + # Remove start of line comments + s/^\s*#+\s*//; + } s/#.*$//g; if (/^\s*(export\s*)?([A-Za-z0-9_\.]+)\s*=\s*"(.*)"/i || /^\s*(export\s*)?([A-Za-z0-9_\.]+)\s*=\s*'(.*)'/i ||