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,
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 :
local $_;
&open_readfile(FILE, $_[0]) || return 0;
while(<FILE>) {
+ 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 ||