mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-01 14:15:49 +08:00
Change init_w_userconf to not interpet the filename. If it's
give "/foo", then it will check $HOME/foo, $HOME/./foo, then /foo. This might not be what the installer hand it mind... but then again may be it is. w_userconf and w_conf both now use NULL arguments to disable conf loading.
This commit is contained in:
parent
1494cf2a44
commit
21b249ca6e
@ -72,6 +72,11 @@ static void openldap_ldap_init_w_conf(const char *file)
|
||||
char *cmd, *opt;
|
||||
char *start, *end;
|
||||
|
||||
if (file == NULL) {
|
||||
/* no file name */
|
||||
return;
|
||||
}
|
||||
|
||||
fp = fopen(file, "r");
|
||||
if(fp == NULL) {
|
||||
/* could not open file */
|
||||
@ -165,18 +170,25 @@ static void openldap_ldap_init_w_conf(const char *file)
|
||||
|
||||
static void openldap_ldap_init_w_userconf(const char *file)
|
||||
{
|
||||
if (file[file[0] == '.'] != '/') {
|
||||
char *home = getenv("HOME");
|
||||
char *home;
|
||||
char *path;
|
||||
|
||||
|
||||
if (file == NULL) {
|
||||
/* no file name */
|
||||
return;
|
||||
}
|
||||
|
||||
home = getenv("HOME");
|
||||
|
||||
if (home != NULL) {
|
||||
path = malloc(strlen(home) + strlen(file) + 3);
|
||||
} else {
|
||||
path = malloc(strlen(file) + 3);
|
||||
}
|
||||
|
||||
|
||||
if(home != NULL && path != NULL) {
|
||||
/* we assume UNIX path syntax is used... */
|
||||
|
||||
/* try ~/file */
|
||||
sprintf(path, "%s/%s", home, file);
|
||||
openldap_ldap_init_w_conf(path);
|
||||
@ -185,8 +197,10 @@ static void openldap_ldap_init_w_userconf(const char *file)
|
||||
sprintf(path, "%s/.%s", home, file);
|
||||
openldap_ldap_init_w_conf(path);
|
||||
}
|
||||
free(path);
|
||||
}
|
||||
|
||||
if(path != NULL) {
|
||||
free(path);
|
||||
}
|
||||
|
||||
/* try file */
|
||||
openldap_ldap_init_w_conf(file);
|
||||
|
Loading…
Reference in New Issue
Block a user