From: Kurt Zeilenga Date: Mon, 23 Nov 1998 03:03:06 +0000 (+0000) Subject: Change init_w_userconf to not interpet the filename. If it's X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1037 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=21b249ca6edcee4ffe3e54549a2ec28ad50f83ac;p=openldap 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. --- diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 527f4e876b..c79bdb93cf 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -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);